GDB QUICK REFERENCE

GDB QUICK REFERENCE

GDB Version 4

Essential Commands

program [core] debug program [using coredump core]

le:]function

set breakpoint at function [in le]

run [arglist]

start your program [with arglist]

bt

backtrace: display program stack

p expr

display the value of an expression

c

continue running your program

n

next line, stepping over function calls

s

next line, stepping into function calls

gdb

b [

Starting GDB

gdb

gdb

gdb

program

program core

gdb --help

Stopping GDB

quit

INTERRUPT

Getting Help

help

help

class

help command

start GDB, with no debugging les

begin debugging program

debug coredump core produced by

program

describe command line options

arglist

list classes of commands

one-line descriptions for commands in

class

describe command

kill

tty dev

set args arglist

set args

show args

use dev as stdin and stdout for next

specify arglist for next run

specify empty argument list

display argument list

show environment

show env var

set env var string

unset env var

show all environment variables

show value of environment variable var

set environment variable var

remove var from environment

run

Shell Commands

cd dir

pwd

make : : :

shell cmd

[ ]

change working directory to dir

Print working directory

call \make"

execute arbitrary shell command string

surround optional arguments

:::

show one or more arguments

c 1991, 1992 Free Software Foundation, Inc.

Permissions on back

set breakpoint at line number [in le]

eg: break main.c:37

set breakpoint at function [in le]

set break at o set lines from current stop

tbreak : : :

rbreak regex

watch expr

catch x

set breakpoint at address addr

set breakpoint at next instruction

break conditionally on nonzero expr

new conditional expression on breakpoint

n; make unconditional if no expr

temporary break; disable when reached

break on all functions matching regex

set a watchpoint for expression expr

break at C++ handler for exception x

info break

info watch

show de ned breakpoints

show de ned watchpoints

clear

delete

delete

delete

delete

break

break : : : if

cond

n [expr]

expr

le:]fun

le:]line

delete [n]

clear [

disable [n]

enable [n]

enable once [n]

enable del [n]

ignore

start your program with arglist

start your program with current argument

list

start your program with input, output

redirected

kill running program

run : : : outf

le:]line

b [ le:]line

break [ le:]function

break +o set

break -o set

break *addr

clear [

exit GDB; also q or EOF (eg C-d)

(eg C-c) terminate current command, or

send to running process

Executing your Program

run

run

Breakpoints and Watchpoints

break [

n count

commands n

[silent]

command-list

end

Program Stack

backtrace [n]

bt [n]

frame [n]

up n

down

info

info

info

info

info

info

n

frame [addr]

args

locals

reg [rn]: : :

all-reg [rn]

catch

breakpoints

breakpoints

breakpoints

breakpoints

at next instruction

at entry to fun()

on source line

[or breakpoint n]

disable breakpoints [or breakpoint n]

enable breakpoints [or breakpoint n]

enable breakpoints [or breakpoint n];

disable again when reached

enable breakpoints [or breakpoint n];

delete when reached

ignore breakpoint n, count times

execute GDB command-list every time

breakpoint n is reached. [silent

suppresses default display]

end of command-list

print trace of all frames in stack; or of n

frames|innermost if n>0, outermost if

n ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download