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