aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc/gdb.invoc-m4
blob: e954ae9805f67e1390b29dc606c2c06b614c0dea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
_dnl__								-*- Texinfo -*-
_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc.
_dnl__ This file is part of the source for the GDB manual.
_dnl__ $Id$
@node Invocation, Commands, Sample Session, Top
@chapter Getting In and Out of _GDBN__

@menu
* Starting _GDBN__::		Starting _GDBN__
* Leaving _GDBN__::		Leaving _GDBN__
* Shell Commands::		Shell Commands
@end menu

@node Starting _GDBN__, Leaving _GDBN__, Invocation, Invocation
@section Starting _GDBN__

_GDBN__ is invoked with the shell command @code{_GDBP__}.  Once started,
it reads commands from the terminal until you tell it to exit.

You can run @code{_GDBP__} with no arguments or options; but the most
usual way to start _GDBN__ is with one argument or two, specifying an
executable program as the argument:
@example
_GDBP__ program
@end example
@noindent
You can also start with both an executable program and a core file specified:
@example
_GDBP__ program core
@end example

@noindent
You can further control how _GDBN__ starts up by using command-line
options.  _GDBN__ itself can remind you of the options available:
@example
_GDBP__ -help
@end example
@noindent
will display all available options and briefly describe their use
(@samp{_GDBP__ -h} is a shorter equivalent).

All options and command line arguments you give are processed
in sequential order.  The order makes a difference when the
@samp{-x} option is used.  

@menu
* File Options::		Choosing Files
* Mode Options::		Choosing Modes
_if__(!_GENERIC__)
_include__(gdb.inv.m-m4)_dnl__
_fi__(!_GENERIC__)
@end menu

@node File Options, Mode Options, Starting _GDBN__, Starting _GDBN__
@subsection Choosing Files

As shown above, any arguments other than options specify an executable
file and core file; that is, the first argument encountered with no
associated option flag is equivalent to a @samp{-se} option, and the
second, if any, is equivalent to a @samp{-c} option.  Many options have
both long and short forms; both are shown here.  The long forms are also
recognized if you truncate them, so long as enough of the option is
present to be unambiguous.  (If you prefer, you can flag option
arguments with @samp{+} rather than @samp{-}, though we illustrate the
more usual convention.)

@table @code
@item -symbols=@var{file}
@itemx -s @var{file}
Read symbol table from file @var{file}.

@item -exec=@var{file}
@itemx -e @var{file}
Use file @var{file} as the executable file to execute when
appropriate, and for examining pure data in conjunction with a core
dump.

@item -se @var{file}
Read symbol table from file @var{file} and use it as the executable
file.

@item -core=@var{file}
@itemx -c @var{file}
Use file @var{file} as a core dump to examine.

@item -command=@var{file}
@itemx -x @var{file}
Execute _GDBN__ commands from file @var{file}.  @xref{Command Files}.

@item -directory=@var{directory}
@itemx -d @var{directory}
Add @var{directory} to the path to search for source files.
@end table

@node Mode Options, i960-Nindy Remote, File Options, Starting _GDBN__
@subsection Choosing Modes

@table @code
@item -nx
@itemx -n
Do not execute commands from any @file{_GDBINIT__} initialization files.
Normally, the commands in these files are executed after all the
command options and arguments have been processed.  @xref{Command
Files}.

@item -quiet
@itemx -q
``Quiet''.  Do not print the introductory and copyright messages.  These
messages are also suppressed in batch mode, or if an executable file name is
specified on the _GDBN__ command line.

@item -batch
Run in batch mode.  Exit with status @code{0} after processing all the command
files specified with @samp{-x} (and @file{_GDBINIT__}, if not inhibited).
Exit with nonzero status if an error occurs in executing the _GDBN__
commands in the command files.  

Batch mode may be useful for running _GDBN__ as a filter, for example to
download and run a program on another computer; in order to make this
more useful, the message 
@example
Program exited normally.
@end example
@noindent
(which is ordinarily issued whenever a program running under _GDBN__ control
terminates) is not issued when running in batch mode.

@item -cd @var{directory}
Run _GDBN__ using @var{directory} as its working directory,
instead of the current directory.

@item -fullname
@itemx -f
This option is used when Emacs runs _GDBN__ as a subprocess.  It tells _GDBN__
to output the full file name and line number in a standard,
recognizable fashion each time a stack frame is displayed (which
includes each time the program stops).  This recognizable format looks
like two @samp{\032} characters, followed by the file name, line number
and character position separated by colons, and a newline.  The
Emacs-to-_GDBN__ interface program uses the two @samp{\032} characters as
a signal to display the source code for the frame.

@item -b @var{bps}
Set the line speed (baud rate or bits per second) of any serial
interface used by _GDBN__ for remote debugging.

@item -tty @var{device}
Run using @var{device} for your program's standard input and output.
@c FIXME: kingdon thinks there's more to -tty.  Investigate.
@end table

_if__(!_GENERIC__)
_include__(gdb.inv.s-m4)
_fi__(!_GENERIC__)

@node Leaving _GDBN__, Shell Commands, Starting _GDBN__, Invocation
@section Leaving _GDBN__
@cindex exiting _GDBN__
@table @code
@item quit
@kindex quit
@kindex q
To exit _GDBN__, use the @code{quit} command (abbreviated @code{q}), or type
an end-of-file character (usually @kbd{C-d}).  
@end table

@cindex interrupt
An interrupt (often @kbd{C-c}) will not exit from _GDBN__, but rather
will terminate the action of any _GDBN__ command that is in progress and
return to _GDBN__ command level.  It is safe to type the interrupt
character at any time because _GDBN__ does not allow it to take effect
until a time when it is safe.

If you've been using _GDBN__ to control an attached process or device,
you can release it with the @code{detach} command; @pxref{Attach}.

@node Shell Commands,  , Leaving _GDBN__, Invocation
@section Shell Commands
If you just need to execute occasional shell commands during your
debugging session, there's no need to leave or suspend _GDBN__; you can
just use the @code{shell} command.

@table @code
@item shell @var{command string}
@kindex shell
@cindex shell escape
Directs _GDBN__ to invoke an inferior shell to execute @var{command
string}.  If it exists, the environment variable @code{SHELL} is used
for the name of the shell to run.  Otherwise _GDBN__ uses
@code{/bin/sh}.
@end table

The utility @code{make} is often needed in development environments.
You don't have to use the @code{shell} command for this purpose in _GDBN__:

@table @code
@item make @var{make-args}
@kindex make
@cindex calling make
Causes _GDBN__ to execute an inferior @code{make} program with the specified
arguments.  This is equivalent to @samp{shell make @var{make-args}}.
@end table