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