1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
\documentclass[12pt,twocolumn]{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{alltt}
\usepackage{multicol}
\usepackage{color}
\usepackage{hyperref}

\hypersetup{colorlinks=true}

\textheight = 684.0pt
\linewidth = 540.0pt
\oddsidemargin = 0.0 in
\evensidemargin = 0.0 in
\marginparwidth=0.0in
\marginparsep=0.0in
\topmargin = 0.0 in
\headheight = 0.0 in
\headsep = 0.0 in
\parskip = 3pt
\parindent = 0.0in

\setlength{\hoffset}{-10pt}
\setlength{\voffset}{-10pt}


\newcommand{\sSecBox}[1]{\begin{minipage}{3in}\begin{alltt}{\small\textrm{\textbf{#1}}}}
\newcommand{\eSecBox}{\end{alltt}\end{minipage}\\ \rule{0pt}{1pt}\hrule}

\newcommand{\blt}{\makebox[2ex]{\(\bullet\)}}
\newcommand{\bsp}{\makebox[2ex]{}}

%\newcommand{\ud}[1]{\underline{#1}}
\newcommand{\ud}[1]{\mbox{\textcolor{red}{#1}}}
%\newcommand{\ud}[1]{\mbox{\colorbox{red}{#1}}}
\newcommand{\ttit}[1]{\textit{#1}}

\newcommand{\srb}[2]{\parbox[t]{#1}{#2}\rule{5pt}{0pt}}

\begin{document}

\pagestyle{empty}

\fbox{{\parbox[b]{2.5in}{\huge \bf G\normalsize NU\huge D\normalsize E\huge B\normalsize UGGER \\ \tiny \copyright 1998-2016 Mitch Richling \url{https://www.mitchr.me}  \\ Last Updated 2016-07-09}}}
\tiny

\sSecBox{Getting Started}
\blt On the command line: gdb [\ttit{options}] [\ttit{prog} [\ttit{core} | \ttit{PID}]]
\bsp \srb{70pt}{\blt -s \ttit{symfile} }\srb{2in}{The symbol file to use    }
\bsp \srb{70pt}{\blt -e \ttit{prog}    }\srb{2in}{The program to debug    }
\bsp \srb{70pt}{\blt -c \ttit{core}    }\srb{2in}{The core file to use        }
\bsp \srb{70pt}{\blt -cd=working_dir   }\srb{2in}{The working diretory for gdb    }
\bsp \srb{70pt}{\blt -tty=dev          }\srb{2in}{TTY for I/O of debugged program }
\bsp \srb{70pt}{\blt -command=file     }\srb{2in}{Run gdb commands in file        }
\bsp \srb{70pt}{\blt -n                }\srb{2in}{Don't run .gdbinit              }
\bsp \srb{70pt}{\blt -q                }\srb{2in}{Quiet mode                      }
\blt After startup:
\bsp \srb{70pt}{\blt \ud{at}tach \ttit{PID}      }\srb{2in}{  connect to another process}
\bsp \srb{70pt}{\blt \ud{det}ach                 }\srb{2in}{  release target from GDB control}
\eSecBox

\sSecBox{Stopping GDB}
\srb{30pt}{\blt \ud{q}uit   }\srb{2in}{Exit GDB (C-d works too)}
\srb{30pt}{\blt C-c         }\srb{2in}{Terminate current command, or send to running process}
\eSecBox

\sSecBox{Working Files}
\srb{65pt}{\blt \ud{fil}e [\ttit{file}]          }\srb{2in}{use \ttit{file} for both symbols and executable}
\srb{65pt}{\blt \ud{cor}e-file [\ttit{file}]     }\srb{2in}{read \ttit{file} as coredump}
\srb{65pt}{\blt \ud{ex}ec-file [\ttit{file}]     }\srb{2in}{use \ttit{file} as executable only}
\srb{65pt}{\blt \ud{symb}ol-file [\ttit{file}]   }\srb{2in}{use symbol table from \ttit{file}}
\srb{65pt}{\blt \ud{i}nfo \ud{fi}les             }\srb{2in}{display working files and targets in use}
\srb{65pt}{\blt \ud{pat}h \ttit{dirs}            }\srb{2in}{push \ttit{dirs} onto executable and symbol search path}
\srb{65pt}{\blt \ud{sho}w \ud{pat}h              }\srb{2in}{display executable and symbol file path}
\srb{65pt}{\blt \ud{i}nfo \ud{sh}aredlibrary     }\srb{2in}{list names of shared libraries currently loaded}
\srb{65pt}{\blt \ud{dir}ectory [\ttit{names}]    }\srb{2in}{push \ttit{names} onto source path, or clear it}
\srb{65pt}{\blt \ud{sho}w \ud{di}rectories       }\srb{2in}{show current source path}
\srb{65pt}{\blt \ud{i}nfo \ud{source}            }\srb{2in}{show name of current source file}
\srb{65pt}{\blt \ud{i}nfo \ud{sources}           }\srb{2in}{list all source files in use}
\eSecBox

\sSecBox{Listing Source \& Code}
\srb{1in}{\blt \ud{li}st [\ttit{bp-spec}]                           }\srb{2in}{display source surrounding \ttit{bp-spec}}
\srb{1in}{\blt \ud{li}st                                            }\srb{2in}{show current/next lines of source}
\srb{1in}{\blt \ud{li}st < + | - >                                  }\srb{2in}{show lines after / before}
\srb{1in}{\blt \ud{li}st \ttit{f},\ttit{t}                          }\srb{2in}{from line \ttit{f} to line \ttit{t}}
\srb{1in}{\blt \ud{i}nfo \ud{li}ne [\ttit{bp-spec}]                 }\srb{2in}{show addresses for compiled code for source line \\ Sets default address for x/i. }
\srb{1in}{\blt \ud{fo}rward-search \ttit{regex}\\\bsp \ud{sea}rch   }\srb{2in}{search following source lines for \ttit{regex}}
\srb{1in}{\blt \ud{rev}erse-search \ttit{regex}                     }\srb{2in}{search preceding source lines for \ttit{regex}}
\srb{1in}{\blt \ud{disas}semble [[\ttit{addr1}] \\\bsp\bsp[\ttit{addr2}]]     }\srb{2in}{display memory as machine instructions \\ Function arround PC, function arround \\ \ttit{addr1}, or between \ttit{addr1} and \ttit{addr2}}
\eSecBox

\sSecBox{Executing Program}
\srb{1.3in}{\blt run [\ttit{args}] [<\ttit{inf}] [>\ttit{outf}]   }\srb{60pt}{Run it}
\srb{1.3in}{\blt kill                                             }\srb{60pt}{kill it}
\blt Before 'run', some things can be set:
\bsp \srb{1in}{\blt \ud{tt}y \ttit{dev}              }\srb{2in}{use \ttit{dev} as stdin and stdout}
\bsp \srb{1in}{\blt set args [\ttit{arglist}]        }\srb{2in}{Set/Clear arg list}
\bsp \srb{1in}{\blt \ud{sho}w args                   }\srb{2in}{Display argument list}
\bsp \srb{1in}{\blt set env \ttit{var} \ttit{string} }\srb{2in}{Set environment variable \ttit{var}}
\bsp \srb{1in}{\blt \ud{uns}et env \ttit{var}        }\srb{2in}{Remove \ttit{var} from environment}
\bsp \srb{1in}{\blt \ud{sho}w env [\ttit{var}]       }\srb{2in}{Show value of one, or all, environment var(s)}
\eSecBox

\sSecBox{Execution Control}
\srb{78pt}{\blt \ud{c}ontinue [\ttit{count}]             }\srb{2in}{continue running past breakpoint}
\srb{78pt}{\blt \ud{adv}ance \ttit{bp-spec}              }\srb{2in}{run upt to \ttit{bp-spec}}
\srb{78pt}{\blt \ud{s}tep [\ttit{count}]                 }\srb{2in}{execute until another line reached}
\srb{78pt}{\blt \ud{s}tep\ud{i} [\ttit{count}]           }\srb{2in}{step by machine instructions}
\srb{78pt}{\blt \ud{n}ext [\ttit{count}]                 }\srb{2in}{execute next line, including any functions}
\srb{78pt}{\blt \ud{n}ext\ud{i} [\ttit{count}]           }\srb{2in}{next machine instruction}
\srb{78pt}{\blt \ud{unt}il [\ttit{bp-spec}]              }\srb{2in}{run till src line after current or \ttit{bp-spec}}
\srb{78pt}{\blt \ud{fin}ish                              }\srb{2in}{run until selected stack frame returns}
\srb{78pt}{\blt \ud{ret}urn [\ttit{expr}]                }\srb{2in}{pop stack frame with function return \ttit{expr}}
\srb{78pt}{\blt \ud{sig}nal \ttit{num}                   }\srb{2in}{resume execution with signal \ttit{num}}
\srb{78pt}{\blt \ud{thr}ead \ttit{thrd}                  }\srb{2in}{switch to thread number \ttit{thrd}}
\srb{78pt}{\blt \ud{thr}ead apply \ttit{thrd} \ttit{cmd} }\srb{2in}{apply \ttit{cmd} to \ttit{thrd} ('all' for all threads)}
\srb{78pt}{\blt \ud{j}ump \ttit{line}           }\srb{2in}{resume execution at specified \ttit{line} number}
\srb{78pt}{\blt \ud{j}ump *\ttit{address}       }\srb{2in}{resume execution at specified \ttit{address}}
\srb{78pt}{\blt set var=\ttit{expr}             }\srb{2in}{Set \ttit{var} by evaluating \ttit{expr}}
\eSecBox

\sSecBox{Signals}
\srb{1in}{\blt \ud{i}nfo signals                    }\srb{2in}{show table of signals \& GDB actions}
\srb{1in}{\blt \ud{ha}ndle \ttit{signal} \ttit{act} }\srb{2in}{Set signal actions for \ttit{signal}. \ttit{act} may be:}
\bsp \srb{38pt}{\blt [no]print  }\srb{2in}{Announce (or not) signal}
\bsp \srb{38pt}{\blt [no]stop   }\srb{2in}{Stop (or not) program execution}
\bsp \srb{38pt}{\blt [no]pass   }\srb{2in}{Pass (or not) signal to program}
\eSecBox

\sSecBox{Program Stack}
\srb{1in}{\blt \ud{b}ack\ud{t}race [\ttit{n}]     }\srb{2in}{print trace of all frames in stack \\  innermost \ttit{n} frames if \ttit{n}>0 \& outermost if \ttit{n}<0}
\srb{1in}{\blt \ud{fr}ame [\ttit{n}]              }\srb{2in}{select frame number \ttit{n} current frame}
\srb{1in}{\blt \ud{up} \ttit{n}                   }\srb{2in}{select frame \ttit{n} frames up}
\srb{1in}{\blt \ud{dow}n \ttit{n}                 }\srb{2in}{select frame \ttit{n} frames down}
\srb{1in}{\blt \ud{i}nfo \ud{fr}ame [\ttit{addr}] }\srb{2in}{describe selected frame, or frame at \ttit{addr}}
\srb{1in}{\blt \ud{i}nfo \ud{ar}gs                }\srb{2in}{arguments of selected frame}
\srb{1in}{\blt \ud{i}nfo \ud{lo}cals              }\srb{2in}{local variables of selected frame}
\eSecBox

\sSecBox{Breakpoints and Watchpoints}
\srb{2in}{\blt \ud{b}reak [\ttit{bp-spec}] [thread \ttit{thrd}]                 }\srb{2in}{set breakpoint. if no \ttit{bp-spec} \\ then set at next instruction}
\srb{2in}{\blt \ud{b}reak \ttit{bp-spec} [thread \ttit{thrd}] if \ttit{expr}    }\srb{2in}{break only when \ttit{expr}!=0}
\srb{1in}{\blt \ttit{bp-spec} may be one of:  }\srb{2in}{}
\srb{47pt}{\bsp\blt [\ttit{file\tt:}]\ttit{line} }\srb{40pt}{\ttit{line}-number}\srb{42pt}{\blt [\ttit{file\tt:}]\ttit{func} }\srb{50pt}{\ttit{func}tion}
\srb{47pt}{\bsp\blt *\ttit{addr}                 }\srb{40pt}{\ttit{addr}ess    }\srb{42pt}{\blt \(\pm\)\ttit{offset}         }\srb{45pt}{\(\pm\)\ttit{offset} lines from stop}
\srb{1in}{\blt \ud{tb}reak \ldots                      }\srb{2in}{Same as break, but disable when reached (temporary)}
\srb{1in}{\blt \ud{rb}reak \ttit{regex}                }\srb{2in}{break on all functions matching \ttit{regex}}
\srb{1in}{\blt \ud{wa}tch \ttit{expr}                  }\srb{2in}{set a watchpoint for expression \ttit{expr}}
\srb{1in}{\blt \ud{cond}ition \ttit{n} [\ttit{expr}]   }\srb{2in}{new conditional expression on breakpoint \ttit{n} \\ make unconditional if no \ttit{expr}}
\srb{1in}{\blt \ud{i}nfo \ud{b}reakpoints              }\srb{2in}{show defined breakpoints}
\srb{1in}{\blt \ud{i}nfo \ud{wat}chpoints              }\srb{2in}{show defined watchpoints}
\srb{1in}{\blt \ud{cl}ear                              }\srb{2in}{delete breakpoints at next instruction}
\srb{1in}{\blt \ud{cl}ear [\ttit{file\tt:}]\ttit{fun}  }\srb{2in}{delete breakpoints at entry to \ttit{fun}()}
\srb{1in}{\blt \ud{cl}ear [\ttit{file\tt:}]\ttit{line} }\srb{2in}{delete breakpoints on source line}
\srb{1in}{\blt \ud{del}ete [\ttit{n}]                  }\srb{2in}{delete breakpoints}
\srb{1in}{\blt \ud{disable} [\ttit{n}]                 }\srb{2in}{disable breakpoints}
\srb{1in}{\blt \ud{ena}ble [\ttit{n}]                  }\srb{2in}{enable breakpoints}
\srb{1in}{\blt \ud{ena}ble once [\ttit{n}]             }\srb{2in}{enable breakpoints; disable again when reached}
\srb{1in}{\blt \ud{ena}ble del [\ttit{n}]              }\srb{2in}{enable breakpoints; delete when reached}
\srb{1in}{\blt \ud{ig}nore \ttit{n} \ttit{count}       }\srb{2in}{ignore breakpoint \ttit{n}, \ttit{count} times}
\srb{1in}{\blt \ud{comm}ands \ttit{n} [\ttit{silent}] \\ \bsp\bsp\ttit{command-list}   }\srb{2in}{execute GDB \ttit{command-list} every time \\ breakpoint \ttit{n} is reached.}
\srb{1in}{\blt end                                     }\srb{2in}{end of \ttit{command-list}}
\eSecBox

\sSecBox{Expressions}
\srb{60pt}{\blt \ttit{expr}                    }\srb{2in}{an expression in C, C++ (including function calls)}
\srb{60pt}{\blt *\ttit{addr}@\ttit{len}        }\srb{2in}{an array of \ttit{len} elements beginning at \ttit{addr}}
\srb{60pt}{\blt [\ttit{file}::]\ttit{name}     }\srb{2in}{a variable or function \ttit{name}}
\srb{60pt}{\blt \{\ttit{type}\}\ttit{addr}     }\srb{2in}{read memory at \ttit{addr} as specified \ttit{type}}
\srb{60pt}{\blt $                              }\srb{2in}{most recently displayed value}
\srb{60pt}{\blt $\ttit{n}                      }\srb{2in}{\ttit{n}th displayed value}
\srb{60pt}{\blt $$                             }\srb{2in}{displayed value previous to $}
\srb{60pt}{\blt $$\ttit{n}                     }\srb{2in}{\ttit{n}th displayed value back from $}
\srb{60pt}{\blt $_                             }\srb{2in}{last address examined with \ttit{x}}
\srb{60pt}{\blt $__                            }\srb{2in}{value at address $_}
\srb{60pt}{\blt set $\ttit{var} = \ttit{expr}  }\srb{2in}{Assign a value to a convenience variable}
\srb{60pt}{\blt $\ttit{var}++                  }\srb{2in}{Increment a convenience variable}                                               
\srb{60pt}{\blt \ud{sho}w values \ttit{n}      }\srb{2in}{show last 10 values or surrounding $\ttit{n}}
\srb{60pt}{\blt \ud{sho}w conv                 }\srb{2in}{display all convenience variables}
\srb{60pt}{\blt $_exitcode                     }\srb{2in}{Exit status of the program}
\srb{60pt}{\blt $bpnum                         }\srb{2in}{Most recently set breakpoint}
\srb{60pt}{\blt $cdir                          }\srb{2in}{Compilation dir for current source file}
\srb{60pt}{\blt $cwd                           }\srb{2in}{Current working directory}
\srb{60pt}{\blt $fp                            }\srb{2in}{Frame pointer register}
\srb{60pt}{\blt $pc                            }\srb{2in}{Program counter register}
\srb{60pt}{\blt $ps                            }\srb{2in}{Processor status register}
\srb{60pt}{\blt $sp                            }\srb{2in}{Stack pointer register}
\srb{60pt}{\blt \ud{wha}tis \ttit{expr}        }\srb{2in}{Data type of \ttit{expr}}
\eSecBox

\sSecBox{Symbol Table}
\srb{77pt}{\blt \ud{i}nfo address \ttit{s}                }\srb{2in}{show where symbol \ttit{s} is stored}
\srb{77pt}{\blt \ud{i}nfo symbol \ttit{addr}              }\srb{2in}{show what symbol is at \ttit{addr}}
\srb{77pt}{\blt \ud{i}nfo \ud{func}tions [\ttit{regex}]   }\srb{2in}{show names, types of functions}
\srb{77pt}{\blt \ud{i}nfo \ud{var}iables [\ttit{regex}]   }\srb{2in}{show names, types of global variables}
\srb{77pt}{\blt \ud{i}nfo types [\ttit{regex}]            }\srb{2in}{show type names}
\srb{77pt}{\blt \ud{wha}tis [\ttit{expr}]                 }\srb{2in}{show data type of \ttit{expr}}
\srb{77pt}{\blt \ud{pt}ype [\ttit{expr}]                  }\srb{2in}{like whatis, but more info.}
\srb{77pt}{\blt \ud{pt}ype \ttit{type}                    }\srb{2in}{describe type, struct, union, or enum}
\textsc{NOTE: } See ``Program Stack'' for info on local variables
\eSecBox

\sSecBox{Display}
\srb{77pt}{\blt \ud{disp}lay [/f] \ttit{expr}                    }\srb{2in}{print \ttit{expr} each time program stops}
\srb{77pt}{\blt \ud{disp}lay                                     }\srb{2in}{display all enabled expressions on list}
\srb{77pt}{\blt \ud{und}isplay \ttit{n}                          }\srb{2in}{remove number specified display elements}
\srb{77pt}{\blt \ud{del}ete \ud{disp}lay \ttit{n}                }\srb{2in}{remove number specified display elements}
\srb{77pt}{\blt \ud{dis}able \ud{d}isplay \ttit{n}               }\srb{2in}{disable display for expression(s) number \ttit{n}}
\srb{77pt}{\blt \ud{en}able \ud{di}splay \ttit{n}                }\srb{2in}{enable display for expression(s) number \ttit{n}}
\srb{77pt}{\blt \ud{i}nfo \ud{di}splay                           }\srb{2in}{numbered list of display expressions}
\eSecBox

\sSecBox{Printing}
\srb{73pt}{\blt \ud{ins}pect [/\ttit{f}] [\ttit{expr}] }\srb{2in}{Same as \ud{p}rint}
\srb{73pt}{\blt \ud{p}rint [/\ttit{f}] [\ttit{expr}]   }\srb{2in}{Show value of \ttit{expr}}
\bsp The format specifyer, /\ttit{f}, can be:
\bsp  \srb{10pt}{\blt x   }\srb{65pt}{hexadecimal     }\bsp  \srb{10pt}{\blt t   }\srb{2in}{binary        }
\bsp  \srb{10pt}{\blt d   }\srb{65pt}{signed decimal  }\bsp  \srb{10pt}{\blt c   }\srb{2in}{character     }
\bsp  \srb{10pt}{\blt u   }\srb{65pt}{unsigned decimal}\bsp  \srb{10pt}{\blt f   }\srb{2in}{floating point}
\bsp  \srb{10pt}{\blt o   }\srb{65pt}{octal           }\bsp  \srb{10pt}{\blt s   }\srb{2in}{string        }
\bsp  \srb{10pt}{\blt a   }\srb{2in}{address (abs or relative)}
\srb{60pt}{\blt \ud{x} [/\ttit{Nuf}] \ttit{expr}    }\srb{2in}{examine memory at address \ttit{expr}}
\bsp \ttit{N} is count of how many units to dispay
\bsp \ttit{u} is the unit and may be one of:
\bsp  \srb{10pt}{\blt b   }\srb{65pt}{bytes           }\bsp \srb{10pt}{\blt h  }\srb{65pt}{half words  (2 bytes) }
\bsp  \srb{10pt}{\blt w   }\srb{65pt}{words (4 bytes) }\bsp \srb{10pt}{\blt g  }\srb{65pt}{giant words (8 bytes) }
\bsp \ttit{f} may be any print format or 
\bsp  \srb{10pt}{\blt s  }\srb{65pt}{null-terminated string }\bsp \srb{10pt}{\blt i }\srb{65pt}{machine instructions}
\srb{97pt}{\blt \ud{printf} "\ttit{fmt_str}" [,\ttit{expr}...]   }\srb{2in}{Print using printf format string}
\eSecBox

\sSecBox{Running Program Info}
\srb{1in}{\blt \ud{i}nfo \ud{pi}d            }\srb{2in}{Process ID of the program}
\srb{1in}{\blt \ud{i}nfo \ud{pr}ogram        }\srb{2in}{Execution status of the program}
\srb{1in}{\blt \ud{i}nfo \ud{al}l-registers  }\srb{2in}{List of all registers and their contents}
\srb{1in}{\blt \ud{i}nfo \ud{f}loat          }\srb{2in}{Print the status of the floating point unit}
\srb{1in}{\blt \ud{i}nfo \ud{r}egisters      }\srb{2in}{List of integer registers and their contents}
\srb{1in}{\blt \ud{i}nfo \ud{ve}ctor         }\srb{2in}{Print the status of the vector unit}
\eSecBox

\sSecBox{Online Help}
\srb{1in}{\blt \ud{apr}opos \ttit{string}    }\srb{2in}{Search the online help for \ttit{string}}
\srb{1in}{\blt \ud{h}elp \ttit{string}       }\srb{2in}{Get help for \ttit{string}.}
\eSecBox

\sSecBox{GDB 2 DBX}
\srb{1in}{GDB                                      }\srb{2in}{DBX}
\srb{1in}{break \ttit{line}|\ttit{fnc}|*\ttit{adr} }\srb{2in}{stop at \ttit{line} | \ttit{func} |\ttit{addr}}
\srb{1in}{break ... if \ttit{expr}                 }\srb{2in}{stop ... -if \ttit{expr}}
\srb{1in}{cond \ttit{n}                            }\srb{2in}{stop ... -if \ttit{expr}}
\srb{1in}{tbreak                                   }\srb{2in}{stop ... -temp}
\srb{1in}{watch \ttit{expr}                        }\srb{2in}{stop \ttit{expr} [slow]}
\srb{1in}{watch \ttit{var}                         }\srb{2in}{stop modify \&\ttit{var} [fast]}
\srb{1in}{catch \ttit{x}                           }\srb{2in}{intercept \ttit{x}}
\srb{1in}{info watch                               }\srb{2in}{status}
\srb{1in}{info break                               }\srb{2in}{status}
\srb{1in}{clear [\ttit{fun}]                       }\srb{2in}{delete [\ttit{n}]}
\srb{1in}{delete                                   }\srb{2in}{delete all}
\srb{1in}{disable                                  }\srb{2in}{handler -disable all}
\srb{1in}{disable \ttit{n}                         }\srb{2in}{handler -disable \ttit{n}}
\srb{1in}{enable                                   }\srb{2in}{handler -enable all}
\srb{1in}{enable \ttit{n}                          }\srb{2in}{handler -enable \ttit{n}}
\srb{1in}{ignore \ttit{n} \ttit{cnt}               }\srb{2in}{handler -count \ttit{n}  \ttit{cnt}}
\srb{1in}{\ud{b}ack\ud{t}race \ttit{n}             }\srb{2in}{where \ttit{n}}
\srb{1in}{frame \ttit{n}                           }\srb{2in}{frame \ttit{n}}
\srb{1in}{info reg \ttit{reg}                      }\srb{2in}{print \$\ttit{reg}}
\srb{1in}{finish                                   }\srb{2in}{step up}
\srb{1in}{signal \ttit{num}                        }\srb{2in}{cont sig \ttit{num}}
\srb{1in}{jump \ttit{line}                         }\srb{2in}{cont at \ttit{line}}
\srb{1in}{set \ttit{var}=\ttit{expr}               }\srb{2in}{assign \ttit{var}=\ttit{expr}}
\srb{1in}{x/<fmt> \ttit{addr}                      }\srb{2in}{x \ttit{addr}/\ttit{fmt}}
\srb{1in}{disassem \ttit{addr}                     }\srb{2in}{dis \ttit{addr}}
\srb{1in}{info func \ttit{regex}                   }\srb{2in}{funcs \ttit{regexp}}
\srb{1in}{ptype \ttit{type}                        }\srb{2in}{whatis -t \ttit{type}}
\srb{1in}{define \ttit{cmd}                        }\srb{2in}{function \ttit{cmd}}
\srb{1in}{handle \ttit{sig}                        }\srb{2in}{stop sig \ttit{sig}}
\srb{1in}{info signals                             }\srb{2in}{status; catch}
\srb{1in}{attach \ttit{pid}                        }\srb{2in}{debug - \ttit{pid}}
\srb{1in}{core \ttit{file}                         }\srb{2in}{debug \ttit{a.out} \ttit{file}}
\srb{1in}{dir \ttit{name}                          }\srb{2in}{pathmap  \ttit{name}}
\srb{1in}{info \ud{li}ne \ttit{n}                  }\srb{2in}{listi \ttit{n}}
\srb{1in}{info source                              }\srb{2in}{file}
\srb{1in}{forw/rev \ttit{regex}                    }\srb{2in}{search/bsearch \ttit{regex}}
\eSecBox

\newpage

\sSecBox{GDB Parameters}
\blt set \ttit{param} \ttit{value}
\blt \ud{sho}w\ttit{param}
\blt Possible parameters (default listed first for on|off-type parameters):
\bsp \srb{80pt}{\ud{com}plaint \ttit{limit}                }\srb{2in}{number of messages on unusual symbols}
\bsp \srb{80pt}{\ud{con}firm \ttit{on|off}                 }\srb{2in}{enable or disable cautionary queries}
\bsp \srb{80pt}{\ud{he}ight \ttit{lpp}                     }\srb{2in}{number of lines before pause in display}
\bsp \srb{80pt}{\ud{li}stsize \ttit{n}                     }\srb{2in}{number of lines shown by {\tt list}}
\bsp \srb{80pt}{prompt \ttit{str}                          }\srb{2in}{use \ttit{str} as GDB prompt}
\bsp \srb{80pt}{\ud{ra}dix \ttit{base}                     }\srb{2in}{octal, decimal, or hex number representation}
\bsp \srb{80pt}{\ud{ve}rbose \ttit{on|off}                 }\srb{2in}{control messages when loading symbols}
\bsp \srb{80pt}{\ud{wi}dth \ttit{cpl}                      }\srb{2in}{number of characters before line folded}
\bsp \srb{80pt}{\ud{p}rint \ud{ad}dress \ttit{on|off}      }\srb{2in}{print memory addresses in stacks, values}
\bsp \srb{80pt}{\ud{p}rint \ud{ar}ray \ttit{off|on}        }\srb{2in}{compact or attractive format for arrays}
\bsp \srb{80pt}{\ud{p}rint \ud{d}emangl \ttit{on|off}      }\srb{2in}{C++ syms in source (demangled) or internal form}
\bsp \srb{80pt}{\ud{p}rint \ud{asm}-demangle \ttit{on|off} }\srb{2in}{demangle C++ symbols in machine-instruction output}
\bsp \srb{80pt}{\ud{p}rint \ud{el}ements \ttit{limit}      }\srb{2in}{number of array elements to display}
\bsp \srb{80pt}{\ud{p}rint \ud{o}bject \ttit{on|off}       }\srb{2in}{print C++ derived types for objects}
\bsp \srb{80pt}{\ud{p}rint \ud{pr}etty \ttit{off|on}       }\srb{2in}{struct display: compact or indented}
\bsp \srb{80pt}{\ud{p}rint \ud{u}nion \ttit{on|off}        }\srb{2in}{display of union members}
\bsp \srb{80pt}{\ud{p}rint \ud{v}tbl \ttit{off|on}         }\srb{2in}{display of C++ virtual function tables}
\eSecBox

\sSecBox{Extending \& Customizing}
\blt Controlled output commands
\srb{95pt}{\bsp \blt echo \ttit{text}                          }\srb{2in}{Print the given text. \\  C-style escape sequences are supported.}  
\srb{95pt}{\bsp \blt output \ttit{expression}                  }\srb{2in}{Print the given expression.}  
\srb{95pt}{\bsp \blt output/\ttit{fmt} \ttit{expression}       }\srb{2in}{Print the given expression using \\ the given print format.}  
\srb{95pt}{\bsp \blt printf \ttit{string} \ttit{expressions}   }\srb{2in}{Print the given expressions using \\ the given printf format string.}  
\srb{95pt}{\blt define \ttit{cmdName} \ldots end               }\srb{2in}{Define a new command. Arguments are \\ accessed through $arg0 \ldots $arg9.}  
\srb{95pt}{\bsp\blt If \ttit{cmdName} is ``hook-foo'' where ``foo'' is a GDB built-in command, \\\bsp\bsp then the command will be executed just before ``foo''.}
\srb{95pt}{\bsp\blt If \ttit{cmdName} is ``hookpost-foo'' where ``foo'' is a GDB built-in command, \\\bsp\bsp then the command will be executed just after ``foo''.}
\srb{95pt}{\bsp\blt If \ttit{cmdName} is ``stop-foo'', then run command at program stops.}
\blt Control structures allowed in user defined commands:
\srb{95pt}{\bsp \blt if \ttit{expr} \ldots [else \ldots] end  }\srb{2in}{Executes statements only if the \\ expression is true.  Otherwise executes \\ the else clause if it exists.}  
\srb{95pt}{\bsp \blt while \ttit{expression} \ldots end                }\srb{2in}{Executes body while expression is true}  
\srb{95pt}{\blt document \ttit{cmdName} \ldots end                  }\srb{2in}{Document user defined command and make \\ documentation available from online help. \\ The command must already be defined.}  
\srb{95pt}{\blt source \ttit{filename}                      }\srb{2in}{read and execute commands found in file}
\blt Startup sequence:  
\bsp \blt Read ~/.gdbinit
\bsp \blt Process command line arguments,
\bsp \blt Read init file in working directory
\bsp \blt Read command files given in -x arguments
\eSecBox

\sSecBox{C++ Stuff}
\blt Most containers (and strings)
\bsp \blt p aContainer.empty()
\bsp \blt p aContainer.size()
\blt Printing Container Contents
\bsp \blt C++ Strings: p aString.c_str()
\bsp \blt GCC Vectors (GCC): p (*aVector._M_impl._M_start)@(aVector.size())
\eSecBox


\end{document}