gdb <prog-file>
gdb –args <prog-file> <prog-args…>
: start gdb with program argumentsgdb <prog-file> <core-file>
: inspect the core dumpgdb <prog-file> <pid>
: attach to the running processgdb –pid=<pid> –batch -ex gcore
: dump the core of an alive processrun <prog-args…>
(short “r”) : start the programstep [count]
(short “s”) : step one linestepi [count]
(short “si”) : step one instructionnext [count]
(short “n”) : step one line without entering in functionscontinue
(short “c”) : continue the programfinish
(short “fin”) : execute until selected stack frame returnsadvance [source-file]:<line>
(short “adv”) : continue up to the given locationcall <func-name>
(short “ca”) : call a function (the context is copied so that it is not modified)kill
(short “k”) : stop the programbacktrace
(short “bt”) : show the stackframe <frame-number>
(short “f”) : move to the stack drame numberlist
, list -
, list [source-file]:<line|function>
(short “l”) : show source codethread <thread-num>
(short “t”) : switch to threadinfo threads
(short “i th”) : show list of current threadsthread apply all bt
(short “t a a bt”) : show backtraces of all threadsbreak [source-file]:<line|function> [thread <thread-num>] [if <condition>]
(short “b”) : set a breakpointinfo breakpoints
(short “i b”) : show all current breakpointscondition <breakpoint-number> <condition>
(short “cond”) : specify the breakpoint to break only if condition is truedelete breakpoints <breakpoint-number>
(short “del b”, “del”) : delete a breakpointenable/disable <breakpoint-numbers…>
(short “en” and “dis”) : enable or disable some breakpointsprint <var-name>
(short “p”) : print the value/content of the variableprint *<pointer>@<nelements>
: print nelements of the arrayprint/<format> <var-name>
: print with a certain format (x for hexa, …)display <var-name>
(short “disp”) : display the value/content of the variable at every stepawatch <var-name>
(short “aw”) : stops the execution whenever the variable is read or writtenwatch <cond-on-var>
(short “wa”) : stops the execution whenever the condition on the variable becomes trueptype <var-name>
: type of variablex <addr>
: print the content of memory, can format with /<format> tooset variable <var-name> = <value>
: change variable valueset $variable = <exp>
: create an external variablesource <file-name>
: load a set of commands from a file