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