Add texinfo wrappers
[deliverable/binutils-gdb.git] / gdb / doc / refcard.tex
CommitLineData
bca43169
RP
1%This file is TeX source for a reference card describing GDB, the GNU debugger.
2%Copyright (C) 1991 Free Software Foundation, Inc.
3%Permission is granted to make and distribute verbatim copies of
4%this reference provided the copyright notices and permission notices
5%are preserved on all copies.
6%
7%TeX markup is a programming language; accordingly this file is source
8%for a program to generate a reference.
9%
10%This program is free software; you can redistribute it and/or modify
11%it under the terms of the GNU General Public License as published by
12%the Free Software Foundation; either version 1, or (at your option)
13%any later version.
14%
15%This program is distributed in the hope that it will be useful, but
16%WITHOUT ANY WARRANTY; without even the implied warranty of
17%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18%General Public License for more details.
19%
20%You can find a copy of the GNU General Public License in the GDB
21%manual; or write to the Free Software Foundation, Inc.,
22%675 Mass Ave, Cambridge, MA 02139, USA.
23%
24%You can contact the author as: pesch@cygnus.com
25%
26% Roland Pesch
27% Cygnus Support
28% 814 University Ave.
29% Palo Alto, CA 94301 USA
30%
31% +1 415 322 3811
32%
33% Cygnus Support is an organization devoted to commercial
34% support of free software. For general information
35% contact ``info@cygnus.com''
36%
37%
38\input threecol
39{%
40\def\$#1${{#1}}% Kluge: collect RCS revision info without $...$
41\xdef\manvers{\$Revision$}%
42}
43\vsize=8in
44\hyphenpenalty=5000\tolerance=2000\raggedright
45%
46\font\bbf=cmbx10
47\font\vbbf=cmbx12
48\font\smrm=cmr6
49\font\brm=cmr10
50\font\rm=cmr8
51\font\it=cmti8
52\font\tt=cmtt8
53\normalbaselineskip=9pt\baselineskip=9pt
54%
55\parindent=0pt
56\parskip=0pt
57\footline={\vbox to0pt{\hss}}
58%
59\def\ctl#1{{\tt C-#1}}
60\def\opt#1{{\brm[{\rm #1}]}}
61\def\xtra#1{\noalign{\smallskip{\tt#1}}}
62%
63\long\def\sec#1;#2\endsec{\vskip 1pc
64\halign{%
65%COL 1 (of halign):
66\vtop{\hsize=1in\tt
67##\par\vskip 2pt
68}\quad
69%COL 2 (of halign):
70&\vtop{\hsize=2.1in\hangafter=1\hangindent=0.5em
71\rm ##\par\vskip 2pt}\cr
72%Tail of \long\def fills in halign body with \sec args:
73\noalign{{\bbf #1}\vskip 2pt}
74#2
75}
76}
77
78{\vbbf GDB QUICK REFERENCE}
79\vskip 5pt
80{\smrm GDB Version 4.00---Cygnus Support 1991}
81
82\sec Starting GDB;
83gdb&starts GDB, with no debugging files\cr
84gdb {\it program}&begin debugging {\it program}\cr
85gdb {\it program core}&debug coredump {\it core} produced by {\it program}\cr
86\endsec
87
88\sec Stopping GDB;
89quit&Exit GDB; abbreviate as {\tt q} or {\tt EOF}\par (eg \ctl{d})\cr
90INTERRUPT&(eg \ctl{c}) terminate current command\cr
91\endsec
92
93\sec Getting Help;
94help&List classes of commands\cr
95help {\it class}&One-line descriptions for commands in {\it class}\cr
96help {\it command}&Describe {\it command}\cr
97\endsec
98
99\sec Executing your Program;
100run {\it arglist}&start your program with {\it arglist}\cr
101run&start your program with current argument list\cr
102run $\ldots$ <{\it inf} >{\it outf}&start program with input, output
103redirected\cr
104\cr
105kill&Kill running program\cr
106\cr
107tty {\it dev}&Use {\it dev} as default i/o for next {\tt run}\cr
108set args {\it arglist}&specify {\it arglist} for next
109{\tt run}\cr
110set args&specify empty argument list\cr
111show args&display argument list\cr
112\cr
113show environment&show all environment variables\cr
114show env {\it var}&show value of environment variable {\it var}\cr
115set env {\it var} {\it expr}&set environment variable {\it var}\cr
116delete env {\it var}&Remove {\it var} from environment\cr
117\endsec
118
119\sec Shell Commands;
120cd {\it dir}&Change working directory to {\it dir}\cr
121pwd&Print working directory\cr
122make $\ldots$&Call ``{\tt make}''\cr
123shell {\it cmd}&Execute arbitrary shell command string\cr
124\endsec
125
126\vfill
127\centerline{\smrm \copyright 1991 Free Software Foundation, Inc.\qquad Permissions on back}
128\eject
129\sec Breakpoints and Watchpoints;
130break \opt{\it file\tt:}{\it line}&Set breakpoint at {\it line} number \opt{in \it file}\par
131eg:\quad{\tt break main.c:37}\quad\cr
132break \opt{\it file\tt:}{\it fun}&Set breakpoint at {\it
133fun}() \opt{in \it file}\cr
134break +{\it offset}\par
135break -{\it offset}&Set break at offset from current stop\cr
136break *{\it addr}&Set breakpoint at address {\it addr}\cr
137break&Set breakpoint at next instruction\cr
138break $\ldots$ if {\it expr}&Break conditionally on nonzero {\it expr}\cr
139cond {\it bno} \opt{\it expr}&New conditional expression on breakpoint
140number {\it bno}; make unconditional if no {\it expr}\cr
141tbreak $\ldots$&Temporary break; disable when reached\cr
142rbreak {\it regex}&Break on all functions matching {\it regex}\cr
143watch {\it expr}&Set a watchpoint for expression {\it expr}\cr
144catch {\it x}&Set breakpoint at C++ handler for exception {\it x}\cr
145\cr
146info break&Show defined breakpoints\cr
147info watch&Show defined watchpoints\cr
148\cr
149clear&Delete breakpoints at next instruction\cr
150clear \opt{\it file\tt:}{\it fun}&Delete breakpoints at entry to {\it fun}()\cr
151clear \opt{\it file\tt:}{\it line}&Delete breakpoints on source line \cr
152delete \opt{{\it bnos}}&Delete breakpoints numbered {\it bnos};
153\opt{or all breakpoints}\cr
154\cr
155disable \opt{{\it bnos}}&Disable breakpoints {\it bnos} \opt{or all}\cr
156enable {\it bnos}&Enable breakpoints {\it bnos} \opt{or all}\cr
157enable once {\it bnos}&Enable breakpoints; disable again when
158reached\cr
159enable del {\it bnos}&Enable breakpoints; delete when reached\cr
160\cr
161ignore {\it bno} {\it count}&Ignore breakpoint number {\it bno}, {\it count}
162times\cr
163\cr
164commands {\it bno}\par
165\qquad {\it command list}&Execute GDB {\it command list} every time breakpoint {\it bno} is reached\cr
166end&(use only with {\tt commands}) End of {\it command list}\cr
167\endsec
168
169\sec Signals;
170handle {\it signal} {\it act}&Specify GDB actions when {\it signal} occurs:\cr
171\quad print&Announce when signal occurs\cr
172\quad noprint&Be silent when signal occurs\cr
173\quad stop&Halt execution on signal\cr
174\quad nostop&Do not halt execution\cr
175\quad pass&Allow your program to handle signal\cr
176\quad nopass&Do not allow your program to see signal\cr
177info signal&Show table of signals and GDB action for each\cr
178\endsec
179
180\vfill\eject
181\sec Execution Control;
182continue \opt{\it count}\par
183c \opt{\it count}&Continue running; if {\it count} specified, ignore
184this breakpoint next {\it count} times\cr
185\cr
186step \opt{\it count}\par
187s \opt{\it count}&Execute until another line reached; repeat {\it count} times if
188specified\cr
189\cr
190stepi \opt{\it count}\par
191si \opt{\it count}&Step by machine instructions rather than source
192lines\cr
193\cr
194next \opt{\it count}\par
195n \opt{\it count}&Execute next line, including any function calls.\cr
196\cr
197nexti \opt{\it count}\par
198ni \opt{\it count}&Next machine instruction rather than source
199line\cr
200\cr
201until \opt{\it location}&Run until next instruction (or {\it
202location}) reached\cr
203\cr
204finish&Run until selected stack frame returns\cr
205return \opt{\it expr}&Pop selected stack frame without executing,
206optionally setting return value\cr
207\cr
208signal {\it num}&Resume execution with signal {\it num} (none if {\tt 0})\cr
209jump {\it line}\par
210jump *{\it address}&Resume execution at specified {\it line} number or
211{\it address}\cr
212set var {\it expr}&Evaluate {\it expr} without displaying it; use for
213altering program variables\cr
214\endsec
215
216\sec Debugging Targets;
217target {\it type} {\it param}&Connect to target machine, process, or file\cr
218info targets&Display available targets\cr
219attach {\it param}&Connect to another target of same type\cr
220detach&Release target from GDB control\cr
221\endsec
222
223\sec Expressions;
224{\it expr}&An expression in C or C++ (including function calls), or:\cr
225{\it addr\/}@{\it len}&An array of {\it len} elements beginning at {\it
226addr}\cr
227{\it file}::{\it nm}&A variable or function {\it nm} defined in {\it
228file}\cr
229$\tt\{${\it type}$\tt\}${\it addr}&Read memory at {\it addr} as specified
230{\it type}\cr
231print \opt{\tt/{\it f}\/} {\it expr}\par
232p \opt{\tt/{\it f}\/} {\it expr}&Display the value of an expression\par
233in format {\it f}:\cr
234\qquad x&hexadecimal\cr
235\qquad d&signed decimal\cr
236\qquad u&unsigned decimal\cr
237\qquad o&octal\cr
238\qquad a&address, absolute and relative\cr
239\qquad c&character constant\cr
240\qquad f&floating point\cr
241call \opt{\tt /{\it f}\/} {\it expr}&Like {\tt print} but does not display
242{\tt void}\cr
243\endsec
244
245\vfill\eject
246\sec Memory;
247x \opt{\tt/{\it Nuf}\/} {\it expr}&Examine memory at address {\it expr};
248optional format spec follows slash.\cr
249\quad {\it N}&Count of how many units to display;\cr
250\quad {\it u}&Unit size; one of\cr
251&{\tt\qquad b}\ individual bytes\cr
252&{\tt\qquad h}\ halfwords (two bytes)\cr
253&{\tt\qquad w}\ words (four bytes)\cr
254&{\tt\qquad g}\ giant words (eight bytes)\cr
255\quad {\it f}&Printing format. Any {\tt print} format, or\cr
256&{\tt\qquad s}\ Null-terminated string\cr
257&{\tt\qquad i}\ Machine instructions\cr
258disassem \opt{\it addr}&Display range of memory as machine
259instructions; function surrounding {\it addr} or program counter, or range between two arguments\cr
260\endsec
261
262\sec Automatic Display;
263display \opt{\tt/\it f\/} {\it expr}&Show value of {\it expr} each time
264program stops \opt{according to format {\it f}\/}\cr
265display&Display all enabled expressions on list\cr
266undisplay {\it dnos}&Remove number(s) {\it dnos} from list of
267automatically displayed expressions\cr
268disable dis {\it dnos}&Disable display for expression(s) number {\it
269dnos}\cr
270enable dis {\it dnos}&Enable display for expression(s) number {\it
271dnos}\cr
272info display&Show numbered list of expressions to display\cr
273\endsec
274
275\sec Program Stack;
276backtrace \opt{\it n}\par
277bt \opt{\it n}&Print trace of all frames in stack; or of {\it n}
278frames---innermost if {\it n}{\tt >0}, outermost if {\it n}{\tt <0}\cr
279frame \opt{\it n}&Select frame number {\it n} or frame at address {\it
280n}; if no {\it n}, display current frame\cr
281up {\it n}&Select frame {\it n} frames up\cr
282down {\it n}&Select frame {\it n} frames down\cr
283info frame \opt{\it addr}&Description of selected frame, or frame at
284{\it addr}\cr
285info args&Arguments of selected frame\cr
286info locals&Local variables of selected frame\cr
287info catch&Exception handlers active in selected frame\cr
288\endsec
289
290\sec Symbol Table;
291info address {\it s}&Show where symbol {\it s} is stored\cr
292info func \opt{\it regex}&Show names, types of defined functions
293(all, or matching {\it regex})\cr
294info var \opt{\it regex}&Show names, types of global variables (all,
295or matching {\it regex})\cr
296info sources&Show all sources having debugging information\cr
297whatis {\it expr}\par
298ptype {\it expr}&Show data type of {\it expr} without evaluating; {\tt
299ptype} gives more detail\cr
300ptype {\it type}&Describe type, struct, union, or enum\cr
301\endsec
302
303\vfill\eject
304\sec Controlling GDB;
305set {\it param} {\it expr}&Set one of GDB's internal parameters,
306controlling its interaction with you\cr
307show {\it param}&Display current setting of a GDB parameter\cr
308\xtra{\rm Parameters understood by {\tt set} and {\tt show}:}
309\quad addressp {\it on/off}&print memory addresses in stacks,
310structs\cr
311\quad array-max {\it limit}&Number of elements to display from an
312array\cr
313\quad arraypr {\it off/on}&Compact or attractive format for
314arrays\cr
315\quad caution {\it on/off}&Enable or disable cautionary queries\cr
316\quad editing {\it on/off}&Control {\tt readline} command-line editing\cr
317\quad history&({\tt h}) covers a number of options:\cr
318\quad h exp {\it off/on}&Disable or enable {\tt readline} history expansion\cr
319\quad h file {\it filename}&File for recording GDB command history\cr
320\quad h size {\it size}&Number of commands kept in history list\cr
321\quad h write {\it off/on}&Control use of external file for
322command history\cr
323\cr
324\quad pretty {\it off/on}&Compact or indented format for struct
325display\cr
326\quad prompt {\it str}&Use {\it str} as GDB prompt\cr
327\quad radix {\it base}&Octal, decimal, or hex number representation\cr
328\quad screen-h {\it lpp}&Number of lines before pause in
329display\cr
330\quad screen-w {\it cpl}&Number of characters before line folded\cr
331\quad unionpr {\it on/off}&Enable or disable display of unions in
332structs\cr
333\quad verbose {\it on/off}&Control messages when loading
334symbol table\cr
335\quad vtblpr {\it off/on}&Display of C++ virtual function tables\cr
336info editing&Show last 10 commands\cr
337info editing {\it n}&Show 10 commands around number {\it n}\cr
338info editing +&Show next 10 commands\cr
339\endsec
340
341\sec Working Files;
342file {\it name}&Use {\it file} for symbols and executable\cr
343core {\it name}&Read {\it file} as coredump\cr
344exec {\it name}&Use {\it file} as executable only\cr
345symbol {\it name}&Use only symbol table from {\it file}\cr
346load {\it file} {\it addr}&Read additional symbols from {\it file},
347dynamically loaded at {\it addr}\cr
348info files&Display working files and targets in use\cr
349\cr
350share \opt{\it regex}&Add symbol information for shared libraries
351matching {\it regex}, or all shared libraries\cr
352info share&List names of shared libraries currently loaded\cr
353\endsec
354
355\vfill\eject
356\sec Source Files;
357dir {\it name}&Add directory {\it name} to front of source path\cr
358dir&Clear source path\cr
359info dir&Show current source path\cr
360\cr
361list&Show next ten lines of source\cr
362list -&Show previous ten lines\cr
363list {\it lines}&Display source centered around {\it lines},
364specified as one of:\cr
365\quad{\opt{\it file\tt:}\it num}&Line number \opt{in named file}\cr
366\quad{\opt{\it file\tt:}\it function}&Beginning of function \opt{in
367named file}\cr
368\quad{\tt +\it off}&{\it off} lines after last printed\cr
369\quad{\tt -\it off}&{\it off} lines previous to last printed\cr
370\quad{\tt*\it address}&Line containing {\it address}\cr
371list {\it f},{\it l}&from line {\it f} to line {\it l}\cr
372info line {\it num}&Show starting, ending addresses of compiled code for
373source line {\it num}\cr
374forw {\it regex}&Search following source lines for {\it regex}\cr
375rev {\it regex}&Search preceding source lines for {\it regex}\cr
376\endsec
377
378\sec GDB under GNU Emacs;
379M-x gdb&Run GDB under Emacs\cr
380\ctl{h} m&Describe GDB mode\cr
381M-s&Step one line ({\tt step})\cr
382M-n&Next line ({\tt next})\cr
383M-i&Step one instruction ({\tt stepi})\cr
384\ctl{c} \ctl{f}&Finish current stack frame ({\tt finish})\cr
385M-c&Continue ({\tt cont})\cr
386M-u&Up {\it arg} frames ({\tt up})\cr
387M-d&Down {\it arg} frames ({\tt down})\cr
388\ctl{x} SPC&(in source file) set break at point\cr
389\endsec
390
391
392\vfill
393{\smrm\parskip=6pt
394\centerline{Copyright \copyright 1991 Free Software Foundation, Inc.}
395\centerline{Roland Pesch (pesch@cygnus.com), January 1991---\manvers}
396
397This card may be freely distributed under the terms of the GNU
398General Public License.
399
400Please contribute to development of this card by annotating it.
401
402No author assumes any responsibility for any errors on this card.}
403\end
This page took 0.037696 seconds and 4 git commands to generate.