OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [gdb.1] - Blame information for rev 1768

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
.\" Copyright 1991, 1999 Free Software Foundation, Inc.
2
.\" See section COPYING for conditions for redistribution
3
.\" $Id: gdb.1,v 1.1.1.1 2002-01-16 10:23:32 markom Exp $
4
.TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools"
5
.SH NAME
6
gdb \- The GNU Debugger
7
.SH SYNOPSIS
8
.na
9
.TP
10
.B gdb
11
.RB "[\|" \-help "\|]"
12
.RB "[\|" \-nx "\|]"
13
.RB "[\|" \-q "\|]"
14
.RB "[\|" \-batch "\|]"
15
.RB "[\|" \-cd=\c
16
.I dir\c
17
\|]
18
.RB "[\|" \-f "\|]"
19
.RB "[\|" "\-b\ "\c
20
.IR bps "\|]"
21
.RB "[\|" "\-tty="\c
22
.IR dev "\|]"
23
.RB "[\|" "\-s "\c
24
.I symfile\c
25
\&\|]
26
.RB "[\|" "\-e "\c
27
.I prog\c
28
\&\|]
29
.RB "[\|" "\-se "\c
30
.I prog\c
31
\&\|]
32
.RB "[\|" "\-c "\c
33
.I core\c
34
\&\|]
35
.RB "[\|" "\-x "\c
36
.I cmds\c
37
\&\|]
38
.RB "[\|" "\-d "\c
39
.I dir\c
40
\&\|]
41
.RB "[\|" \c
42
.I prog\c
43
.RB "[\|" \c
44
.IR core \||\| procID\c
45
\&\|]\&\|]
46
.ad b
47
.SH DESCRIPTION
48
The purpose of a debugger such as GDB is to allow you to see what is
49
going on ``inside'' another program while it executes\(em\&or what another
50
program was doing at the moment it crashed.
51
 
52
GDB can do four main kinds of things (plus other things in support of
53
these) to help you catch bugs in the act:
54
 
55
.TP
56
\ \ \ \(bu
57
Start your program, specifying anything that might affect its behavior.
58
 
59
.TP
60
\ \ \ \(bu
61
Make your program stop on specified conditions.
62
 
63
.TP
64
\ \ \ \(bu
65
Examine what has happened, when your program has stopped.
66
 
67
.TP
68
\ \ \ \(bu
69
Change things in your program, so you can experiment with correcting the
70
effects of one bug and go on to learn about another.
71
.PP
72
 
73
You can use GDB to debug programs written in C, C++, and Modula-2.
74
Fortran support will be added when a GNU Fortran compiler is ready.
75
 
76
GDB is invoked with the shell command \c
77
.B gdb\c
78
\&.  Once started, it reads
79
commands from the terminal until you tell it to exit with the GDB
80
command \c
81
.B quit\c
82
\&.  You can get online help from \c
83
.B gdb\c
84
\& itself
85
by using the command \c
86
.B help\c
87
\&.
88
 
89
You can run \c
90
.B gdb\c
91
\& with no arguments or options; but the most
92
usual way to start GDB is with one argument or two, specifying an
93
executable program as the argument:
94
.sp
95
.br
96
gdb\ program
97
.br
98
.sp
99
 
100
You can also start with both an executable program and a core file specified:
101
.sp
102
.br
103
gdb\ program\ core
104
.br
105
.sp
106
 
107
You can, instead, specify a process ID as a second argument, if you want
108
to debug a running process:
109
.sp
110
.br
111
gdb\ program\ 1234
112
.br
113
.sp
114
 
115
would attach GDB to process \c
116
.B 1234\c
117
\& (unless you also have a file
118
named `\|\c
119
.B 1234\c
120
\&\|'; GDB does check for a core file first).
121
 
122
Here are some of the most frequently needed GDB commands:
123
.TP
124
.B break \fR[\|\fIfile\fB:\fR\|]\fIfunction
125
\&
126
Set a breakpoint at \c
127
.I function\c
128
\& (in \c
129
.I file\c
130
\&).
131
.TP
132
.B run \fR[\|\fIarglist\fR\|]
133
Start your program (with \c
134
.I arglist\c
135
\&, if specified).
136
.TP
137
.B bt
138
Backtrace: display the program stack.
139
.TP
140
.BI print " expr"\c
141
\&
142
Display the value of an expression.
143
.TP
144
.B c
145
Continue running your program (after stopping, e.g. at a breakpoint).
146
.TP
147
.B next
148
Execute next program line (after stopping); step \c
149
.I over\c
150
\& any
151
function calls in the line.
152
.TP
153
.B step
154
Execute next program line (after stopping); step \c
155
.I into\c
156
\& any
157
function calls in the line.
158
.TP
159
.B help \fR[\|\fIname\fR\|]
160
Show information about GDB command \c
161
.I name\c
162
\&, or general information
163
about using GDB.
164
.TP
165
.B quit
166
Exit from GDB.
167
.PP
168
For full details on GDB, see \c
169
.I
170
Using GDB: A Guide to the GNU Source-Level Debugger\c
171
\&, by Richard M. Stallman and Roland H. Pesch.  The same text is available online
172
as the \c
173
.B gdb\c
174
\& entry in the \c
175
.B info\c
176
\& program.
177
.SH OPTIONS
178
Any arguments other than options specify an executable
179
file and core file (or process ID); that is, the first argument
180
encountered with no
181
associated option flag is equivalent to a `\|\c
182
.B \-se\c
183
\&\|' option, and the
184
second, if any, is equivalent to a `\|\c
185
.B \-c\c
186
\&\|' option if it's the name of a file.  Many options have
187
both long and short forms; both are shown here.  The long forms are also
188
recognized if you truncate them, so long as enough of the option is
189
present to be unambiguous.  (If you prefer, you can flag option
190
arguments with `\|\c
191
.B +\c
192
\&\|' rather than `\|\c
193
.B \-\c
194
\&\|', though we illustrate the
195
more usual convention.)
196
 
197
All the options and command line arguments you give are processed
198
in sequential order.  The order makes a difference when the
199
`\|\c
200
.B \-x\c
201
\&\|' option is used.
202
 
203
.TP
204
.B \-help
205
.TP
206
.B \-h
207
List all options, with brief explanations.
208
 
209
.TP
210
.BI "\-symbols=" "file"\c
211
.TP
212
.BI "\-s " "file"\c
213
\&
214
Read symbol table from file \c
215
.I file\c
216
\&.
217
 
218
.TP
219
.B \-write
220
Enable writing into executable and core files.
221
 
222
.TP
223
.BI "\-exec=" "file"\c
224
.TP
225
.BI "\-e " "file"\c
226
\&
227
Use file \c
228
.I file\c
229
\& as the executable file to execute when
230
appropriate, and for examining pure data in conjunction with a core
231
dump.
232
 
233
.TP
234
.BI "\-se=" "file"\c
235
\&
236
Read symbol table from file \c
237
.I file\c
238
\& and use it as the executable
239
file.
240
 
241
.TP
242
.BI "\-core=" "file"\c
243
.TP
244
.BI "\-c " "file"\c
245
\&
246
Use file \c
247
.I file\c
248
\& as a core dump to examine.
249
 
250
.TP
251
.BI "\-command=" "file"\c
252
.TP
253
.BI "\-x " "file"\c
254
\&
255
Execute GDB commands from file \c
256
.I file\c
257
\&.
258
 
259
.TP
260
.BI "\-directory=" "directory"\c
261
.TP
262
.BI "\-d " "directory"\c
263
\&
264
Add \c
265
.I directory\c
266
\& to the path to search for source files.
267
.PP
268
 
269
.TP
270
.B \-nx
271
.TP
272
.B \-n
273
Do not execute commands from any `\|\c
274
.B .gdbinit\c
275
\&\|' initialization files.
276
Normally, the commands in these files are executed after all the
277
command options and arguments have been processed.
278
 
279
 
280
.TP
281
.B \-quiet
282
.TP
283
.B \-q
284
``Quiet''.  Do not print the introductory and copyright messages.  These
285
messages are also suppressed in batch mode.
286
 
287
.TP
288
.B \-batch
289
Run in batch mode.  Exit with status \c
290
.B 0\c
291
\& after processing all the command
292
files specified with `\|\c
293
.B \-x\c
294
\&\|' (and `\|\c
295
.B .gdbinit\c
296
\&\|', if not inhibited).
297
Exit with nonzero status if an error occurs in executing the GDB
298
commands in the command files.
299
 
300
Batch mode may be useful for running GDB as a filter, for example to
301
download and run a program on another computer; in order to make this
302
more useful, the message
303
.sp
304
.br
305
Program\ exited\ normally.
306
.br
307
.sp
308
 
309
(which is ordinarily issued whenever a program running under GDB control
310
terminates) is not issued when running in batch mode.
311
 
312
.TP
313
.BI "\-cd=" "directory"\c
314
\&
315
Run GDB using \c
316
.I directory\c
317
\& as its working directory,
318
instead of the current directory.
319
 
320
.TP
321
.B \-fullname
322
.TP
323
.B \-f
324
Emacs sets this option when it runs GDB as a subprocess.  It tells GDB
325
to output the full file name and line number in a standard,
326
recognizable fashion each time a stack frame is displayed (which
327
includes each time the program stops).  This recognizable format looks
328
like two `\|\c
329
.B \032\c
330
\&\|' characters, followed by the file name, line number
331
and character position separated by colons, and a newline.  The
332
Emacs-to-GDB interface program uses the two `\|\c
333
.B \032\c
334
\&\|' characters as
335
a signal to display the source code for the frame.
336
 
337
.TP
338
.BI "\-b " "bps"\c
339
\&
340
Set the line speed (baud rate or bits per second) of any serial
341
interface used by GDB for remote debugging.
342
 
343
.TP
344
.BI "\-tty=" "device"\c
345
\&
346
Run using \c
347
.I device\c
348
\& for your program's standard input and output.
349
.PP
350
 
351
.SH "SEE ALSO"
352
.RB "`\|" gdb "\|'"
353
entry in
354
.B info\c
355
\&;
356
.I
357
Using GDB: A Guide to the GNU Source-Level Debugger\c
358
, Richard M. Stallman and Roland H. Pesch, July 1991.
359
.SH COPYING
360
Copyright (c) 1991 Free Software Foundation, Inc.
361
.PP
362
Permission is granted to make and distribute verbatim copies of
363
this manual provided the copyright notice and this permission notice
364
are preserved on all copies.
365
.PP
366
Permission is granted to copy and distribute modified versions of this
367
manual under the conditions for verbatim copying, provided that the
368
entire resulting derived work is distributed under the terms of a
369
permission notice identical to this one.
370
.PP
371
Permission is granted to copy and distribute translations of this
372
manual into another language, under the above conditions for modified
373
versions, except that this permission notice may be included in
374
translations approved by the Free Software Foundation instead of in
375
the original English.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.