

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A quick reference for essential gdb (gnu debugger) commands and usage for debugging c, c++, and modula-2 programs. It covers topics such as starting gdb, setting breakpoints, running and stepping through code, displaying values, and using shell commands. Useful for both beginners and experienced users who need a quick reminder of gdb's capabilities.
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


program
send to running process
class
list
redirected
set break at offset lines from current stop
n; make unconditional if no expr
disable again when reached
delete when reached
command-list
execute GDB command-list every time
print trace of all frames in stack; or of n
n; if no n, display current frame
continue running; if count specified, ignore this breakpoint next count times
execute until another line reached; repeat count times if specified
step by machine instructions rather than source lines
execute next line, including any function calls
next machine instruction rather than source line
resume execution at specified line number or address
for altering program variables
according to format f:
format spec follows slash N count of how many units to display u unit size; one of
automatically displayed expressions
Expressions
expr an expression in C, C++, or Modula- (including function calls), or:
addr
{type}addr read memory at addr as specified type
show values [n] show last 10 values [or surrounding $n]
Symbol Table
info func [regex] show names, types of defined functions (all, or matching regex)
info var [regex] show names, types of global variables (all, or matching regex)
whatis [expr]
ptype [expr]
show data type of expr [or $] without
GDB Scripts
script
command-list
create new GDB command cmd; execute script defined by command-list
help-text
create online documentation for new GDB command cmd
Signals
Debugging Targets
Controlling GDB
representation
history... h...
groups with the following options:
history
print... p...
groups with the following options:
C++ symbols
instruction output
Working Files file [file] use file for both symbols and executable; with no arg, discard both core [file] read file as coredump; or discard exec [file] use file as executable only; or discard symbol [file] use symbol table from file; or discard
dynamically loaded at addr
executable and symbol files
loaded
Source Files
path
as: [file:]num line number [in named file] [file:]function beginning of function [in named file]
compiled code for source line num
GDB under GNU Emacs
GDB License
Display full no-warranty statement.
Copyright ©c1991, ’92, ’93, ’98 Free Software Foundation, Inc. Roland H. Pesch The author assumes no responsibility for any errors on this card.
This card may be freely distributed under the terms of the GNU General Public License.
Please contribute to development of this card by annotating it. Improvements can be sent to [email protected].
GDB itself is free software; you are welcome to distribute copies of it under the terms of the GNU General Public License. There is absolutely no warranty for GDB.