| 1 |
330 |
jeremybenn |
%%%%%%%%%%%%%%%% gdb-refcard.tex %%%%%%%%%%%%%%%%
|
| 2 |
|
|
|
| 3 |
|
|
%This file is TeX source for a reference card describing GDB, the GNU debugger.
|
| 4 |
|
|
%Copyright (C) 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2007, 2008,
|
| 5 |
|
|
%2009, 2010 Free Software Foundation, Inc.
|
| 6 |
|
|
%Permission is granted to make and distribute verbatim copies of
|
| 7 |
|
|
%this reference provided the copyright notices and permission notices
|
| 8 |
|
|
%are preserved on all copies.
|
| 9 |
|
|
%
|
| 10 |
|
|
%TeX markup is a programming language; accordingly this file is source
|
| 11 |
|
|
%for a program to generate a reference.
|
| 12 |
|
|
%
|
| 13 |
|
|
%This program is free software; you can redistribute it and/or modify
|
| 14 |
|
|
%it under the terms of the GNU General Public License as published by
|
| 15 |
|
|
%the Free Software Foundation; either version 2, or (at your option)
|
| 16 |
|
|
%any later version.
|
| 17 |
|
|
%
|
| 18 |
|
|
%This program is distributed in the hope that it will be useful, but
|
| 19 |
|
|
%WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 20 |
|
|
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 21 |
|
|
%General Public License for more details.
|
| 22 |
|
|
%
|
| 23 |
|
|
%You can find a copy of the GNU General Public License at the URL
|
| 24 |
|
|
%http://www.gnu.org/copyleft/gpl.html; or write to the Free Software
|
| 25 |
|
|
%Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
| 26 |
|
|
%Boston, MA 02110-1301, USA.
|
| 27 |
|
|
%You can contact the maintainer at: doc@cygnus.com
|
| 28 |
|
|
%
|
| 29 |
|
|
% Documentation Department
|
| 30 |
|
|
% Cygnus Solutions
|
| 31 |
|
|
% 1325 Chesapeake Terrace
|
| 32 |
|
|
% Sunnyvale, CA 94089 USA
|
| 33 |
|
|
%
|
| 34 |
|
|
% +1 800 CYGNUS-1
|
| 35 |
|
|
%
|
| 36 |
|
|
%
|
| 37 |
|
|
%
|
| 38 |
|
|
% 22-AUG-1993 Andreas Vogel
|
| 39 |
|
|
%
|
| 40 |
|
|
% Modifications made in order to handle different papersizes correctly.
|
| 41 |
|
|
% You only have to set the total width and height of the paper, the
|
| 42 |
|
|
% horizontal and vertical margin space measured from *paper edge*
|
| 43 |
|
|
% and the interline and interspec spacing.
|
| 44 |
|
|
% In order to support a new papersize, you have to fiddle with the
|
| 45 |
|
|
% latter four dimensions. Just try out a few values.
|
| 46 |
|
|
% All other values will be computed at process time so it should be
|
| 47 |
|
|
% quite easy to support different paper sizes - only four values to
|
| 48 |
|
|
% guess :-)
|
| 49 |
|
|
%
|
| 50 |
|
|
% To find the configuration places, just search for the string
|
| 51 |
|
|
% "CONFIGURATION".
|
| 52 |
|
|
%
|
| 53 |
|
|
% Andreas Vogel (av@ssw.de)
|
| 54 |
|
|
%
|
| 55 |
|
|
%
|
| 56 |
|
|
%
|
| 57 |
|
|
% Uncomment the following `magnification' command if you want to print
|
| 58 |
|
|
% out in a larger font. Caution! You may need larger paper. You had
|
| 59 |
|
|
% best avoid using 3-column output if you try this. See the ``Three
|
| 60 |
|
|
% column format'' section below if you want to print in three column
|
| 61 |
|
|
% format.
|
| 62 |
|
|
%
|
| 63 |
|
|
%\magnification=\magstep 1
|
| 64 |
|
|
%
|
| 65 |
|
|
% NOTE ON INTENTIONAL OMISSIONS: This reference card includes most GDB
|
| 66 |
|
|
% commands, but due to space constraints there are some things I chose
|
| 67 |
|
|
% to omit. In general, not all synonyms for commands are covered, nor
|
| 68 |
|
|
% all variations of a command.
|
| 69 |
|
|
% The GDB-under-Emacs section omits gdb-mode functions without default
|
| 70 |
|
|
% keybindings. GDB startup options are not described.
|
| 71 |
|
|
% set print sevenbit-strings, set symbol-reloading omitted.
|
| 72 |
|
|
% printsyms, printpsyms, omitted since they're for GDB maintenance primarily
|
| 73 |
|
|
% share omitted due to obsolescence
|
| 74 |
|
|
% set check range/type omitted at least til code is in GDB.
|
| 75 |
|
|
%
|
| 76 |
|
|
%-------------------- Three column format -----------------------
|
| 77 |
|
|
|
| 78 |
|
|
%%%% --- To disable three column format, comment out this entire section
|
| 79 |
|
|
|
| 80 |
|
|
% Three-column format for landscape printing
|
| 81 |
|
|
|
| 82 |
|
|
%-------- Papersize defs:
|
| 83 |
|
|
|
| 84 |
|
|
\newdimen\totalwidth \newdimen\totalheight
|
| 85 |
|
|
\newdimen\hmargin \newdimen\vmargin
|
| 86 |
|
|
\newdimen\secskip \newdimen\lskip
|
| 87 |
|
|
\newdimen\barwidth \newdimen\barheight
|
| 88 |
|
|
\newdimen\intersecwidth
|
| 89 |
|
|
|
| 90 |
|
|
%%
|
| 91 |
|
|
%% START CONFIGURATION - PAPERSIZE DEFINITIONS
|
| 92 |
|
|
%------- Papersize params:
|
| 93 |
|
|
%% US letter paper (8.5x11in)
|
| 94 |
|
|
%%
|
| 95 |
|
|
\totalwidth=11in % total width of paper
|
| 96 |
|
|
\totalheight=8.5in % total height of paper
|
| 97 |
|
|
\hmargin=.25in % horizontal margin width
|
| 98 |
|
|
\vmargin=.25in % vertical margin width
|
| 99 |
|
|
\secskip=1pc % space between refcard secs
|
| 100 |
|
|
\lskip=2pt % extra skip between \sec entries
|
| 101 |
|
|
\ifx\pdfoutput\undefined\else % check if we are using pdfTeX
|
| 102 |
|
|
\pdfpagewidth=\totalwidth % width of paper in pdf output
|
| 103 |
|
|
\pdfpageheight=\totalheight % height of paper in pdf output
|
| 104 |
|
|
\fi
|
| 105 |
|
|
%------- end papersize params
|
| 106 |
|
|
%%
|
| 107 |
|
|
%% change according to personal taste, not papersize dependent
|
| 108 |
|
|
%%
|
| 109 |
|
|
\barwidth=.1pt % width of the cropmark bar
|
| 110 |
|
|
\barheight=2pt % height of the cropmark bar
|
| 111 |
|
|
\intersecwidth=0.5em % width between \itmwid and \dfnwid
|
| 112 |
|
|
%%
|
| 113 |
|
|
%% END CONFIGURATION - PAPERSIZE DEFINITIONS
|
| 114 |
|
|
%%
|
| 115 |
|
|
|
| 116 |
|
|
%%
|
| 117 |
|
|
%% values to be computed - nothing to configure
|
| 118 |
|
|
%%
|
| 119 |
|
|
\newdimen\fullhsize % width of area without margins
|
| 120 |
|
|
\newdimen\itmwid % width of item column
|
| 121 |
|
|
\newdimen\dfnwid % width of definition column
|
| 122 |
|
|
\newdimen\temp % only for temporary use
|
| 123 |
|
|
|
| 124 |
|
|
%%
|
| 125 |
|
|
%% adjust the offsets so the margins are measured *from paper edge*
|
| 126 |
|
|
%%
|
| 127 |
|
|
\hoffset=-1in \advance \hoffset by \hmargin
|
| 128 |
|
|
\voffset=-1in \advance \voffset by \vmargin
|
| 129 |
|
|
|
| 130 |
|
|
%%
|
| 131 |
|
|
%% fullhsize = totalwidth - (2 * hmargin)
|
| 132 |
|
|
%%
|
| 133 |
|
|
\fullhsize=\totalwidth
|
| 134 |
|
|
\temp=\hmargin \multiply \temp by 2 \advance \fullhsize by -\temp
|
| 135 |
|
|
|
| 136 |
|
|
%%
|
| 137 |
|
|
%% hsize = (fullhsize - (4 * hmargin) - (2 * barwidth)) / 3
|
| 138 |
|
|
%%
|
| 139 |
|
|
\hsize=\fullhsize
|
| 140 |
|
|
\temp=\hmargin \multiply \temp by 4 \advance \hsize by -\temp
|
| 141 |
|
|
\temp=\barwidth \multiply \temp by 2 \advance \hsize by -\temp
|
| 142 |
|
|
\divide \hsize by 3
|
| 143 |
|
|
|
| 144 |
|
|
%%
|
| 145 |
|
|
%% vsize = totalheight - (2 * vmargin)
|
| 146 |
|
|
%%
|
| 147 |
|
|
\vsize=\totalheight
|
| 148 |
|
|
\temp=\vmargin \multiply \temp by 2 \advance \vsize by -\temp
|
| 149 |
|
|
|
| 150 |
|
|
%%
|
| 151 |
|
|
%% itmwid = (hsize - intersecwidth) * 1/3
|
| 152 |
|
|
%% dfnwid = (hsize - intersecwidth) * 2/3
|
| 153 |
|
|
%%
|
| 154 |
|
|
\temp=\hsize \advance \temp by -\intersecwidth \divide \temp by 3
|
| 155 |
|
|
\itmwid=\temp
|
| 156 |
|
|
\dfnwid=\hsize \advance \dfnwid by -\itmwid
|
| 157 |
|
|
|
| 158 |
|
|
%-------- end papersize defs
|
| 159 |
|
|
|
| 160 |
|
|
|
| 161 |
|
|
\def\fulline{\hbox to \fullhsize}
|
| 162 |
|
|
\let\lcr=L \newbox\leftcolumn\newbox\centercolumn
|
| 163 |
|
|
\output={\if L\lcr
|
| 164 |
|
|
\global\setbox\leftcolumn=\columnbox \global\let\lcr=C
|
| 165 |
|
|
\else
|
| 166 |
|
|
\if C\lcr
|
| 167 |
|
|
\global\setbox\centercolumn=\columnbox \global\let\lcr=R
|
| 168 |
|
|
\else \tripleformat \global\let\lcr=L
|
| 169 |
|
|
\fi
|
| 170 |
|
|
\fi
|
| 171 |
|
|
% \ifnum\outputpenalty>-20000 \else\dosupereject\fi
|
| 172 |
|
|
}
|
| 173 |
|
|
|
| 174 |
|
|
%%
|
| 175 |
|
|
%% START CONFIGURATION - ALTERNATIVE FOLDING GUIDES
|
| 176 |
|
|
%%
|
| 177 |
|
|
%% For NO printed folding guide,
|
| 178 |
|
|
%% comment out other \def\vdecor's and uncomment:
|
| 179 |
|
|
|
| 180 |
|
|
%\def\vdecor{\hskip\hmargin plus1fil\hskip\barwidth plus1fil\hskip\hmargin plus1fil}
|
| 181 |
|
|
|
| 182 |
|
|
%% For SOLID LINE folding guide,
|
| 183 |
|
|
%% comment out other \def\vdecor's and uncomment:
|
| 184 |
|
|
|
| 185 |
|
|
%\def\vdecor{\hskip\hmargin plus1fil \vrule width \barwidth \hskip\hmargin plus1fil}
|
| 186 |
|
|
|
| 187 |
|
|
%% For SMALL MARKS NEAR TOP AND BOTTOM as folding guide,
|
| 188 |
|
|
%% comment out other \def\vdecor's and uncomment:
|
| 189 |
|
|
|
| 190 |
|
|
\def\vdecor{\hskip\hmargin plus1fil
|
| 191 |
|
|
\vbox to \vsize{\hbox to \barwidth{\vrule height\barheight width\barwidth}\vfill
|
| 192 |
|
|
\hbox to \barwidth{\vrule height\barheight width\barwidth}}%THIS PERCENT SIGN IS ESSENTIAL
|
| 193 |
|
|
\hskip\hmargin plus1fil}
|
| 194 |
|
|
|
| 195 |
|
|
%%
|
| 196 |
|
|
%% END CONFIGURATION - ALTERNATIVES FOR FOLDING GUIDES
|
| 197 |
|
|
%%
|
| 198 |
|
|
|
| 199 |
|
|
\def\tripleformat{\shipout\vbox{\fulline{\box\leftcolumn\vdecor
|
| 200 |
|
|
\box\centercolumn\vdecor
|
| 201 |
|
|
\columnbox}
|
| 202 |
|
|
}
|
| 203 |
|
|
\advancepageno}
|
| 204 |
|
|
\def\columnbox{\leftline{\pagebody}}
|
| 205 |
|
|
\def\bye{\par\vfill
|
| 206 |
|
|
\supereject
|
| 207 |
|
|
\if R\lcr \null\vfill\eject\fi
|
| 208 |
|
|
\end}
|
| 209 |
|
|
|
| 210 |
|
|
%-------------------- end three column format -----------------------
|
| 211 |
|
|
|
| 212 |
|
|
%-------------------- Computer Modern font defs: --------------------
|
| 213 |
|
|
\font\bbf=cmbx10
|
| 214 |
|
|
\font\vbbf=cmbx12
|
| 215 |
|
|
\font\smrm=cmr6
|
| 216 |
|
|
\font\brm=cmr10
|
| 217 |
|
|
\font\rm=cmr7
|
| 218 |
|
|
\font\it=cmti7
|
| 219 |
|
|
\font\tt=cmtt8
|
| 220 |
|
|
%-------------------- end font defs ---------------------------------
|
| 221 |
|
|
|
| 222 |
|
|
%
|
| 223 |
|
|
\hyphenpenalty=5000\tolerance=2000\raggedright\raggedbottom
|
| 224 |
|
|
\normalbaselineskip=9pt\baselineskip=9pt
|
| 225 |
|
|
%
|
| 226 |
|
|
\parindent=0pt
|
| 227 |
|
|
\parskip=0pt
|
| 228 |
|
|
\footline={\vbox to0pt{\hss}}
|
| 229 |
|
|
%
|
| 230 |
|
|
\def\ctl#1{{\tt C-#1}}
|
| 231 |
|
|
\def\opt#1{{\brm[{\rm #1}]}}
|
| 232 |
|
|
\def\xtra#1{\noalign{\smallskip{\tt#1}}}
|
| 233 |
|
|
%
|
| 234 |
|
|
\long\def\sec#1;#2\endsec{\vskip \secskip
|
| 235 |
|
|
\halign{%
|
| 236 |
|
|
%COL 1 (of halign):
|
| 237 |
|
|
\vtop{\hsize=\itmwid\tt
|
| 238 |
|
|
##\par\vskip \lskip }\hfil
|
| 239 |
|
|
%COL 2 (of halign):
|
| 240 |
|
|
&\vtop{\hsize=\dfnwid\hangafter=1\hangindent=\intersecwidth
|
| 241 |
|
|
\rm ##\par\vskip \lskip}\cr
|
| 242 |
|
|
%Tail of \long\def fills in halign body with \sec args:
|
| 243 |
|
|
\noalign{{\bbf #1}\vskip \lskip}
|
| 244 |
|
|
#2
|
| 245 |
|
|
}
|
| 246 |
|
|
}
|
| 247 |
|
|
|
| 248 |
|
|
{\vbbf GDB QUICK REFERENCE}\hfil{\smrm GDB Version 5}\qquad
|
| 249 |
|
|
|
| 250 |
|
|
\sec Essential Commands;
|
| 251 |
|
|
gdb {\it program} \opt{{\it core}}&debug {\it program} \opt{using
|
| 252 |
|
|
coredump {\it core}}\cr
|
| 253 |
|
|
b \opt{\it file\tt:}{\it function}&set breakpoint at {\it function} \opt{in \it file}\cr
|
| 254 |
|
|
run \opt{{\it arglist}}&start your program \opt{with {\it arglist}}\cr
|
| 255 |
|
|
bt& backtrace: display program stack\cr
|
| 256 |
|
|
p {\it expr}&display the value of an expression\cr
|
| 257 |
|
|
c &continue running your program\cr
|
| 258 |
|
|
n &next line, stepping over function calls\cr
|
| 259 |
|
|
s &next line, stepping into function calls\cr
|
| 260 |
|
|
\endsec
|
| 261 |
|
|
|
| 262 |
|
|
\sec Starting GDB;
|
| 263 |
|
|
gdb&start GDB, with no debugging files\cr
|
| 264 |
|
|
gdb {\it program}&begin debugging {\it program}\cr
|
| 265 |
|
|
gdb {\it program core}&debug coredump {\it core} produced by {\it
|
| 266 |
|
|
program}\cr
|
| 267 |
|
|
gdb --help&describe command line options\cr
|
| 268 |
|
|
\endsec
|
| 269 |
|
|
|
| 270 |
|
|
\sec Stopping GDB;
|
| 271 |
|
|
quit&exit GDB; also {\tt q} or {\tt EOF} (eg \ctl{d})\cr
|
| 272 |
|
|
INTERRUPT&(eg \ctl{c}) terminate current command, or send to running process\cr
|
| 273 |
|
|
\endsec
|
| 274 |
|
|
|
| 275 |
|
|
\sec Getting Help;
|
| 276 |
|
|
help&list classes of commands\cr
|
| 277 |
|
|
help {\it class}&one-line descriptions for commands in {\it class}\cr
|
| 278 |
|
|
help {\it command}&describe {\it command}\cr
|
| 279 |
|
|
\endsec
|
| 280 |
|
|
|
| 281 |
|
|
\sec Executing your Program;
|
| 282 |
|
|
run {\it arglist}&start your program with {\it arglist}\cr
|
| 283 |
|
|
run&start your program with current argument list\cr
|
| 284 |
|
|
run $\ldots$ <{\it inf} >{\it outf}&start your program with input, output
|
| 285 |
|
|
redirected\cr
|
| 286 |
|
|
\cr
|
| 287 |
|
|
kill&kill running program\cr
|
| 288 |
|
|
\cr
|
| 289 |
|
|
tty {\it dev}&use {\it dev} as stdin and stdout for next {\tt run}\cr
|
| 290 |
|
|
set args {\it arglist}&specify {\it arglist} for next
|
| 291 |
|
|
{\tt run}\cr
|
| 292 |
|
|
set args&specify empty argument list\cr
|
| 293 |
|
|
show args&display argument list\cr
|
| 294 |
|
|
\cr
|
| 295 |
|
|
show env&show all environment variables\cr
|
| 296 |
|
|
show env {\it var}&show value of environment variable {\it var}\cr
|
| 297 |
|
|
set env {\it var} {\it string}&set environment variable {\it var}\cr
|
| 298 |
|
|
unset env {\it var}&remove {\it var} from environment\cr
|
| 299 |
|
|
\endsec
|
| 300 |
|
|
|
| 301 |
|
|
\sec Shell Commands;
|
| 302 |
|
|
cd {\it dir}&change working directory to {\it dir}\cr
|
| 303 |
|
|
pwd&Print working directory\cr
|
| 304 |
|
|
make $\ldots$&call ``{\tt make}''\cr
|
| 305 |
|
|
shell {\it cmd}&execute arbitrary shell command string\cr
|
| 306 |
|
|
\endsec
|
| 307 |
|
|
|
| 308 |
|
|
\vfill
|
| 309 |
|
|
\line{\smrm \opt{ } surround optional arguments \hfill $\ldots$ show
|
| 310 |
|
|
one or more arguments}
|
| 311 |
|
|
\vskip\baselineskip
|
| 312 |
|
|
\centerline{\smrm \copyright 1998, 2000, 2010 Free Software Foundation, Inc.\qquad Permissions on back}
|
| 313 |
|
|
\eject
|
| 314 |
|
|
\sec Breakpoints and Watchpoints;
|
| 315 |
|
|
break \opt{\it file\tt:}{\it line}\par
|
| 316 |
|
|
b \opt{\it file\tt:}{\it line}&set breakpoint at {\it line} number \opt{in \it file}\par
|
| 317 |
|
|
eg:\quad{\tt break main.c:37}\quad\cr
|
| 318 |
|
|
break \opt{\it file\tt:}{\it func}&set breakpoint at {\it
|
| 319 |
|
|
func} \opt{in \it file}\cr
|
| 320 |
|
|
break +{\it offset}\par
|
| 321 |
|
|
break -{\it offset}&set break at {\it offset} lines from current stop\cr
|
| 322 |
|
|
break *{\it addr}&set breakpoint at address {\it addr}\cr
|
| 323 |
|
|
break&set breakpoint at next instruction\cr
|
| 324 |
|
|
break $\ldots$ if {\it expr}&break conditionally on nonzero {\it expr}\cr
|
| 325 |
|
|
cond {\it n} \opt{\it expr}&new conditional expression on breakpoint
|
| 326 |
|
|
{\it n}; make unconditional if no {\it expr}\cr
|
| 327 |
|
|
tbreak $\ldots$&temporary break; disable when reached\cr
|
| 328 |
|
|
rbreak \opt{\it file\tt:}{\it regex}&break on all functions matching {\it
|
| 329 |
|
|
regex} \opt{in \it file}\cr
|
| 330 |
|
|
watch {\it expr}&set a watchpoint for expression {\it expr}\cr
|
| 331 |
|
|
catch {\it event}&break at {\it event}, which may be {\tt catch}, {\tt throw},
|
| 332 |
|
|
{\tt exec}, {\tt fork}, {\tt vfork}, {\tt load}, or {\tt unload}.\cr
|
| 333 |
|
|
\cr
|
| 334 |
|
|
info break&show defined breakpoints\cr
|
| 335 |
|
|
info watch&show defined watchpoints\cr
|
| 336 |
|
|
\cr
|
| 337 |
|
|
clear&delete breakpoints at next instruction\cr
|
| 338 |
|
|
clear \opt{\it file\tt:}{\it fun}&delete breakpoints at entry to {\it fun}()\cr
|
| 339 |
|
|
clear \opt{\it file\tt:}{\it line}&delete breakpoints on source line \cr
|
| 340 |
|
|
delete \opt{{\it n}}&delete breakpoints
|
| 341 |
|
|
\opt{or breakpoint {\it n}}\cr
|
| 342 |
|
|
\cr
|
| 343 |
|
|
disable \opt{{\it n}}&disable breakpoints
|
| 344 |
|
|
\opt{or breakpoint {\it n}}
|
| 345 |
|
|
\cr
|
| 346 |
|
|
enable \opt{{\it n}}&enable breakpoints
|
| 347 |
|
|
\opt{or breakpoint {\it n}}
|
| 348 |
|
|
\cr
|
| 349 |
|
|
enable once \opt{{\it n}}&enable breakpoints \opt{or breakpoint {\it n}};
|
| 350 |
|
|
disable again when reached
|
| 351 |
|
|
\cr
|
| 352 |
|
|
enable del \opt{{\it n}}&enable breakpoints \opt{or breakpoint {\it n}};
|
| 353 |
|
|
delete when reached
|
| 354 |
|
|
\cr
|
| 355 |
|
|
\cr
|
| 356 |
|
|
ignore {\it n} {\it count}&ignore breakpoint {\it n}, {\it count}
|
| 357 |
|
|
times\cr
|
| 358 |
|
|
\cr
|
| 359 |
|
|
commands {\it n}\par
|
| 360 |
|
|
\qquad \opt{\tt silent}\par
|
| 361 |
|
|
\qquad {\it command-list}&execute GDB {\it command-list} every time breakpoint {\it n} is reached. \opt{{\tt silent} suppresses default
|
| 362 |
|
|
display}\cr
|
| 363 |
|
|
end&end of {\it command-list}\cr
|
| 364 |
|
|
\endsec
|
| 365 |
|
|
|
| 366 |
|
|
\sec Program Stack;
|
| 367 |
|
|
backtrace \opt{\it n}\par
|
| 368 |
|
|
bt \opt{\it n}&print trace of all frames in stack; or of {\it n}
|
| 369 |
|
|
frames---innermost if {\it n}{\tt >0}, outermost if {\it n}{\tt <0}\cr
|
| 370 |
|
|
frame \opt{\it n}&select frame number {\it n} or frame at address {\it
|
| 371 |
|
|
n}; if no {\it n}, display current frame\cr
|
| 372 |
|
|
up {\it n}&select frame {\it n} frames up\cr
|
| 373 |
|
|
down {\it n}&select frame {\it n} frames down\cr
|
| 374 |
|
|
info frame \opt{\it addr}&describe selected frame, or frame at
|
| 375 |
|
|
{\it addr}\cr
|
| 376 |
|
|
info args&arguments of selected frame\cr
|
| 377 |
|
|
info locals&local variables of selected frame\cr
|
| 378 |
|
|
info reg \opt{\it rn}$\ldots$\par
|
| 379 |
|
|
info all-reg \opt{\it rn}®ister values \opt{for regs {\it rn\/}} in
|
| 380 |
|
|
selected frame; {\tt all-reg} includes floating point\cr
|
| 381 |
|
|
\endsec
|
| 382 |
|
|
|
| 383 |
|
|
\vfill\eject
|
| 384 |
|
|
\sec Execution Control;
|
| 385 |
|
|
continue \opt{\it count}\par
|
| 386 |
|
|
c \opt{\it count}&continue running; if {\it count} specified, ignore
|
| 387 |
|
|
this breakpoint next {\it count} times\cr
|
| 388 |
|
|
\cr
|
| 389 |
|
|
step \opt{\it count}\par
|
| 390 |
|
|
s \opt{\it count}&execute until another line reached; repeat {\it count} times if
|
| 391 |
|
|
specified\cr
|
| 392 |
|
|
stepi \opt{\it count}\par
|
| 393 |
|
|
si \opt{\it count}&step by machine instructions rather than source
|
| 394 |
|
|
lines\cr
|
| 395 |
|
|
\cr
|
| 396 |
|
|
next \opt{\it count}\par
|
| 397 |
|
|
n \opt{\it count}&execute next line, including any function calls\cr
|
| 398 |
|
|
nexti \opt{\it count}\par
|
| 399 |
|
|
ni \opt{\it count}&next machine instruction rather than source
|
| 400 |
|
|
line\cr
|
| 401 |
|
|
\cr
|
| 402 |
|
|
until \opt{\it location}&run until next instruction (or {\it
|
| 403 |
|
|
location})\cr
|
| 404 |
|
|
finish&run until selected stack frame returns\cr
|
| 405 |
|
|
return \opt{\it expr}&pop selected stack frame without executing
|
| 406 |
|
|
\opt{setting return value}\cr
|
| 407 |
|
|
signal {\it num}&resume execution with signal {\it s} (none if {\tt 0})\cr
|
| 408 |
|
|
jump {\it line}\par
|
| 409 |
|
|
jump *{\it address}&resume execution at specified {\it line} number or
|
| 410 |
|
|
{\it address}\cr
|
| 411 |
|
|
set var={\it expr}&evaluate {\it expr} without displaying it; use for
|
| 412 |
|
|
altering program variables\cr
|
| 413 |
|
|
\endsec
|
| 414 |
|
|
|
| 415 |
|
|
\sec Display;
|
| 416 |
|
|
print \opt{\tt/{\it f}\/} \opt{\it expr}\par
|
| 417 |
|
|
p \opt{\tt/{\it f}\/} \opt{\it expr}&show value of {\it expr} \opt{or
|
| 418 |
|
|
last value \tt \$} according to format {\it f}:\cr
|
| 419 |
|
|
\qquad x&hexadecimal\cr
|
| 420 |
|
|
\qquad d&signed decimal\cr
|
| 421 |
|
|
\qquad u&unsigned decimal\cr
|
| 422 |
|
|
\qquad o&octal\cr
|
| 423 |
|
|
\qquad t&binary\cr
|
| 424 |
|
|
\qquad a&address, absolute and relative\cr
|
| 425 |
|
|
\qquad c&character\cr
|
| 426 |
|
|
\qquad f&floating point\cr
|
| 427 |
|
|
call \opt{\tt /{\it f}\/} {\it expr}&like {\tt print} but does not display
|
| 428 |
|
|
{\tt void}\cr
|
| 429 |
|
|
x \opt{\tt/{\it Nuf}\/} {\it expr}&examine memory at address {\it expr};
|
| 430 |
|
|
optional format spec follows slash\cr
|
| 431 |
|
|
\quad {\it N}&count of how many units to display\cr
|
| 432 |
|
|
\quad {\it u}&unit size; one of\cr
|
| 433 |
|
|
&{\tt\qquad b}\ individual bytes\cr
|
| 434 |
|
|
&{\tt\qquad h}\ halfwords (two bytes)\cr
|
| 435 |
|
|
&{\tt\qquad w}\ words (four bytes)\cr
|
| 436 |
|
|
&{\tt\qquad g}\ giant words (eight bytes)\cr
|
| 437 |
|
|
\quad {\it f}&printing format. Any {\tt print} format, or\cr
|
| 438 |
|
|
&{\tt\qquad s}\ null-terminated string\cr
|
| 439 |
|
|
&{\tt\qquad i}\ machine instructions\cr
|
| 440 |
|
|
disassem \opt{\it addr}&display memory as machine instructions\cr
|
| 441 |
|
|
\endsec
|
| 442 |
|
|
|
| 443 |
|
|
\sec Automatic Display;
|
| 444 |
|
|
display \opt{\tt/\it f\/} {\it expr}&show value of {\it expr} each time
|
| 445 |
|
|
program stops \opt{according to format {\it f}\/}\cr
|
| 446 |
|
|
display&display all enabled expressions on list\cr
|
| 447 |
|
|
undisplay {\it n}&remove number(s) {\it n} from list of
|
| 448 |
|
|
automatically displayed expressions\cr
|
| 449 |
|
|
disable disp {\it n}&disable display for expression(s) number {\it
|
| 450 |
|
|
n}\cr
|
| 451 |
|
|
enable disp {\it n}&enable display for expression(s) number {\it
|
| 452 |
|
|
n}\cr
|
| 453 |
|
|
info display&numbered list of display expressions\cr
|
| 454 |
|
|
\endsec
|
| 455 |
|
|
|
| 456 |
|
|
\vfill\eject
|
| 457 |
|
|
|
| 458 |
|
|
\sec Expressions;
|
| 459 |
|
|
{\it expr}&an expression in C, C++, or Modula-2 (including function calls), or:\cr
|
| 460 |
|
|
{\it addr\/}@{\it len}&an array of {\it len} elements beginning at {\it
|
| 461 |
|
|
addr}\cr
|
| 462 |
|
|
{\it file}::{\it nm}&a variable or function {\it nm} defined in {\it
|
| 463 |
|
|
file}\cr
|
| 464 |
|
|
$\tt\{${\it type}$\tt\}${\it addr}&read memory at {\it addr} as specified
|
| 465 |
|
|
{\it type}\cr
|
| 466 |
|
|
\$&most recent displayed value\cr
|
| 467 |
|
|
\${\it n}&{\it n}th displayed value\cr
|
| 468 |
|
|
\$\$&displayed value previous to \$\cr
|
| 469 |
|
|
\$\${\it n}&{\it n}th displayed value back from \$\cr
|
| 470 |
|
|
\$\_&last address examined with {\tt x}\cr
|
| 471 |
|
|
\$\_\_&value at address \$\_\cr
|
| 472 |
|
|
\${\it var}&convenience variable; assign any value\cr
|
| 473 |
|
|
\cr
|
| 474 |
|
|
show values \opt{{\it n}}&show last 10 values \opt{or surrounding
|
| 475 |
|
|
\${\it n}}\cr
|
| 476 |
|
|
show conv&display all convenience variables\cr
|
| 477 |
|
|
\endsec
|
| 478 |
|
|
|
| 479 |
|
|
\sec Symbol Table;
|
| 480 |
|
|
info address {\it s}&show where symbol {\it s} is stored\cr
|
| 481 |
|
|
info func \opt{\it regex}&show names, types of defined functions
|
| 482 |
|
|
(all, or matching {\it regex})\cr
|
| 483 |
|
|
info var \opt{\it regex}&show names, types of global variables (all,
|
| 484 |
|
|
or matching {\it regex})\cr
|
| 485 |
|
|
whatis \opt{\it expr}\par
|
| 486 |
|
|
ptype \opt{\it expr}&show data type of {\it expr} \opt{or \tt \$}
|
| 487 |
|
|
without evaluating; {\tt ptype} gives more detail\cr
|
| 488 |
|
|
ptype {\it type}&describe type, struct, union, or enum\cr
|
| 489 |
|
|
\endsec
|
| 490 |
|
|
|
| 491 |
|
|
\sec GDB Scripts;
|
| 492 |
|
|
source {\it script}&read, execute GDB commands from file {\it
|
| 493 |
|
|
script}\cr
|
| 494 |
|
|
\cr
|
| 495 |
|
|
define {\it cmd}\par
|
| 496 |
|
|
\qquad {\it command-list}&create new GDB command {\it cmd};
|
| 497 |
|
|
execute script defined by {\it command-list}\cr
|
| 498 |
|
|
end&end of {\it command-list}\cr
|
| 499 |
|
|
document {\it cmd}\par
|
| 500 |
|
|
\qquad {\it help-text}&create online documentation
|
| 501 |
|
|
for new GDB command {\it cmd}\cr
|
| 502 |
|
|
end&end of {\it help-text}\cr
|
| 503 |
|
|
\endsec
|
| 504 |
|
|
|
| 505 |
|
|
\sec Signals;
|
| 506 |
|
|
handle {\it signal} {\it act}&specify GDB actions for {\it signal}:\cr
|
| 507 |
|
|
\quad print&announce signal\cr
|
| 508 |
|
|
\quad noprint&be silent for signal\cr
|
| 509 |
|
|
\quad stop&halt execution on signal\cr
|
| 510 |
|
|
\quad nostop&do not halt execution\cr
|
| 511 |
|
|
\quad pass&allow your program to handle signal\cr
|
| 512 |
|
|
\quad nopass&do not allow your program to see signal\cr
|
| 513 |
|
|
info signals&show table of signals, GDB action for each\cr
|
| 514 |
|
|
\endsec
|
| 515 |
|
|
|
| 516 |
|
|
\sec Debugging Targets;
|
| 517 |
|
|
target {\it type} {\it param}&connect to target machine, process, or file\cr
|
| 518 |
|
|
help target&display available targets\cr
|
| 519 |
|
|
attach {\it param}&connect to another process\cr
|
| 520 |
|
|
detach&release target from GDB control\cr
|
| 521 |
|
|
\endsec
|
| 522 |
|
|
|
| 523 |
|
|
\vfill\eject
|
| 524 |
|
|
\sec Controlling GDB;
|
| 525 |
|
|
set {\it param} {\it value}&set one of GDB's internal parameters\cr
|
| 526 |
|
|
show {\it param}&display current setting of parameter\cr
|
| 527 |
|
|
\xtra{\rm Parameters understood by {\tt set} and {\tt show}:}
|
| 528 |
|
|
\quad complaint {\it limit}&number of messages on unusual symbols\cr
|
| 529 |
|
|
\quad confirm {\it on/off}&enable or disable cautionary queries\cr
|
| 530 |
|
|
\quad editing {\it on/off}&control {\tt readline} command-line editing\cr
|
| 531 |
|
|
\quad height {\it lpp}&number of lines before pause in display\cr
|
| 532 |
|
|
\quad language {\it lang}&Language for GDB expressions ({\tt auto}, {\tt c} or
|
| 533 |
|
|
{\tt modula-2})\cr
|
| 534 |
|
|
\quad listsize {\it n}&number of lines shown by {\tt list}\cr
|
| 535 |
|
|
\quad prompt {\it str}&use {\it str} as GDB prompt\cr
|
| 536 |
|
|
\quad radix {\it base}&octal, decimal, or hex number representation\cr
|
| 537 |
|
|
\quad verbose {\it on/off}&control messages when loading
|
| 538 |
|
|
symbols\cr
|
| 539 |
|
|
\quad width {\it cpl}&number of characters before line folded\cr
|
| 540 |
|
|
\quad write {\it on/off}&Allow or forbid patching binary, core files
|
| 541 |
|
|
(when reopened with {\tt exec} or {\tt core})
|
| 542 |
|
|
\cr
|
| 543 |
|
|
\quad history $\ldots$\par
|
| 544 |
|
|
\quad h $\ldots$&groups with the following options:\cr
|
| 545 |
|
|
\quad h exp {\it off/on}&disable/enable {\tt readline} history expansion\cr
|
| 546 |
|
|
\quad h file {\it filename}&file for recording GDB command history\cr
|
| 547 |
|
|
\quad h size {\it size}&number of commands kept in history list\cr
|
| 548 |
|
|
\quad h save {\it off/on}&control use of external file for
|
| 549 |
|
|
command history\cr
|
| 550 |
|
|
\cr
|
| 551 |
|
|
\quad print $\ldots$\par
|
| 552 |
|
|
\quad p $\ldots$&groups with the following options:\cr
|
| 553 |
|
|
\quad p address {\it on/off}&print memory addresses in stacks,
|
| 554 |
|
|
values\cr
|
| 555 |
|
|
\quad p array {\it off/on}&compact or attractive format for
|
| 556 |
|
|
arrays\cr
|
| 557 |
|
|
\quad p demangl {\it on/off}&source (demangled) or internal form for C++
|
| 558 |
|
|
symbols\cr
|
| 559 |
|
|
\quad p asm-dem {\it on/off}&demangle C++ symbols in
|
| 560 |
|
|
machine-instruction output\cr
|
| 561 |
|
|
\quad p elements {\it limit}&number of array elements to display\cr
|
| 562 |
|
|
\quad p object {\it on/off}&print C++ derived types for objects\cr
|
| 563 |
|
|
\quad p pretty {\it off/on}&struct display: compact or indented\cr
|
| 564 |
|
|
\quad p union {\it on/off}&display of union members\cr
|
| 565 |
|
|
\quad p vtbl {\it off/on}&display of C++ virtual function
|
| 566 |
|
|
tables\cr
|
| 567 |
|
|
\cr
|
| 568 |
|
|
show commands&show last 10 commands\cr
|
| 569 |
|
|
show commands {\it n}&show 10 commands around number {\it n}\cr
|
| 570 |
|
|
show commands +&show next 10 commands\cr
|
| 571 |
|
|
\endsec
|
| 572 |
|
|
|
| 573 |
|
|
\sec Working Files;
|
| 574 |
|
|
file \opt{\it file}&use {\it file} for both symbols and executable;
|
| 575 |
|
|
with no arg, discard both\cr
|
| 576 |
|
|
core \opt{\it file}&read {\it file} as coredump; or discard\cr
|
| 577 |
|
|
exec \opt{\it file}&use {\it file} as executable only; or discard\cr
|
| 578 |
|
|
symbol \opt{\it file}&use symbol table from {\it file}; or discard\cr
|
| 579 |
|
|
load {\it file}&dynamically link {\it file\/} and add its symbols\cr
|
| 580 |
|
|
add-sym {\it file} {\it addr}&read additional symbols from {\it file},
|
| 581 |
|
|
dynamically loaded at {\it addr}\cr
|
| 582 |
|
|
info files&display working files and targets in use\cr
|
| 583 |
|
|
path {\it dirs}&add {\it dirs} to front of path searched for
|
| 584 |
|
|
executable and symbol files\cr
|
| 585 |
|
|
show path&display executable and symbol file path\cr
|
| 586 |
|
|
info share&list names of shared libraries currently loaded\cr
|
| 587 |
|
|
\endsec
|
| 588 |
|
|
|
| 589 |
|
|
\vfill\eject
|
| 590 |
|
|
\sec Source Files;
|
| 591 |
|
|
dir {\it names}&add directory {\it names} to front of source path\cr
|
| 592 |
|
|
dir&clear source path\cr
|
| 593 |
|
|
show dir&show current source path\cr
|
| 594 |
|
|
\cr
|
| 595 |
|
|
list&show next ten lines of source\cr
|
| 596 |
|
|
list -&show previous ten lines\cr
|
| 597 |
|
|
list {\it lines}&display source surrounding {\it lines},
|
| 598 |
|
|
specified as:\cr
|
| 599 |
|
|
\quad{\opt{\it file\tt:}\it num}&line number \opt{in named file}\cr
|
| 600 |
|
|
\quad{\opt{\it file\tt:}\it function}&beginning of function \opt{in
|
| 601 |
|
|
named file}\cr
|
| 602 |
|
|
\quad{\tt +\it off}&{\it off} lines after last printed\cr
|
| 603 |
|
|
\quad{\tt -\it off}&{\it off} lines previous to last printed\cr
|
| 604 |
|
|
\quad{\tt*\it address}&line containing {\it address}\cr
|
| 605 |
|
|
list {\it f},{\it l}&from line {\it f} to line {\it l}\cr
|
| 606 |
|
|
info line {\it num}&show starting, ending addresses of compiled code for
|
| 607 |
|
|
source line {\it num}\cr
|
| 608 |
|
|
info source&show name of current source file\cr
|
| 609 |
|
|
info sources&list all source files in use\cr
|
| 610 |
|
|
forw {\it regex}&search following source lines for {\it regex}\cr
|
| 611 |
|
|
rev {\it regex}&search preceding source lines for {\it regex}\cr
|
| 612 |
|
|
\endsec
|
| 613 |
|
|
|
| 614 |
|
|
\sec GDB under GNU Emacs;
|
| 615 |
|
|
M-x gdb&run GDB under Emacs\cr
|
| 616 |
|
|
\ctl{h} m&describe GDB mode\cr
|
| 617 |
|
|
M-s&step one line ({\tt step})\cr
|
| 618 |
|
|
M-n&next line ({\tt next})\cr
|
| 619 |
|
|
M-i&step one instruction ({\tt stepi})\cr
|
| 620 |
|
|
\ctl{c} \ctl{f}&finish current stack frame ({\tt finish})\cr
|
| 621 |
|
|
M-c&continue ({\tt cont})\cr
|
| 622 |
|
|
M-u&up {\it arg} frames ({\tt up})\cr
|
| 623 |
|
|
M-d&down {\it arg} frames ({\tt down})\cr
|
| 624 |
|
|
\ctl{x} \&© number from point, insert at end\cr
|
| 625 |
|
|
\ctl{x} SPC&(in source file) set break at point\cr
|
| 626 |
|
|
\endsec
|
| 627 |
|
|
|
| 628 |
|
|
\sec GDB License;
|
| 629 |
|
|
show copying&Display GNU General Public License\cr
|
| 630 |
|
|
show warranty&There is NO WARRANTY for GDB. Display full no-warranty
|
| 631 |
|
|
statement.\cr
|
| 632 |
|
|
\endsec
|
| 633 |
|
|
|
| 634 |
|
|
|
| 635 |
|
|
\vfill
|
| 636 |
|
|
{\smrm\parskip=6pt
|
| 637 |
|
|
Copyright \copyright 1991, 1992, 1993, 1998, 2000, 2010 Free Software Foundation, Inc.
|
| 638 |
|
|
Author: Roland H. Pesch
|
| 639 |
|
|
|
| 640 |
|
|
The author assumes no responsibility for any errors on this card.
|
| 641 |
|
|
|
| 642 |
|
|
This card may be freely distributed under the terms of the GNU
|
| 643 |
|
|
General Public License.
|
| 644 |
|
|
|
| 645 |
|
|
Please contribute to development of this card by
|
| 646 |
|
|
annotating it. Improvements can be sent to bug-gdb@gnu.org.
|
| 647 |
|
|
|
| 648 |
|
|
GDB itself is free software; you are welcome to distribute copies of
|
| 649 |
|
|
it under the terms of the GNU General Public License. There is
|
| 650 |
|
|
absolutely no warranty for GDB.
|
| 651 |
|
|
}
|
| 652 |
|
|
\end
|