* i386-linux-tdep.c (find_minsym_and_objfile): Replace usage of
[deliverable/binutils-gdb.git] / gdb / mi / gdbmi.texinfo
CommitLineData
7162c0ca
EZ
1@c \input texinfo @c -*-texinfo-*-
2@c @c %**start of header
3@c @setfilename gdbmi.info
4@c @settitle GDB/MI Machine Interface
5@c @setchapternewpage off
6@c @c %**end of header
7
8@c @ifinfo
9@c This file documents GDB/MI, a Machine Interface to GDB.
10
32c95e20 11@c Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
7162c0ca
EZ
12@c Contributed by Cygnus Solutions.
13
e9c75b65
EZ
14@c Permission is granted to copy, distribute and/or modify this document
15@c under the terms of the GNU Free Documentation License, Version 1.1 or
2a6585f0
EZ
16@c any later version published by the Free Software Foundation; with no
17@c Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
e9c75b65 18@c and with the Back-Cover Texts as in (a) below.
7162c0ca 19
e9c75b65
EZ
20@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
21@c this GNU Manual, like GNU software. Copies published by the Free
22@c Software Foundation raise funds for GNU development.''
7162c0ca
EZ
23@c @end ifinfo
24
25@c @c This title page illustrates only one of the
26@c @c two methods of forming a title page.
27
28@c @titlepage
29@c @title GDB/MI
e9c75b65
EZ
30@c @subtitle Version 0.3
31@c @subtitle Apr 2001
7162c0ca
EZ
32@c @author Andrew Cagney, Fernando Nasser and Elena Zannoni
33
34@c @c The following two commands
35@c @c start the copyright page.
36@c @page
37@c @vskip 0pt plus 1filll
7162c0ca 38
32c95e20 39@c Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc.
e9c75b65
EZ
40
41@c Permission is granted to copy, distribute and/or modify this document
42@c under the terms of the GNU Free Documentation License, Version 1.1 or
2a6585f0
EZ
43@c any later version published by the Free Software Foundation; with no
44@c Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
e9c75b65
EZ
45@c and with the Back-Cover Texts as in (a) below.
46
47@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
48@c this GNU Manual, like GNU software. Copies published by the Free
49@c Software Foundation raise funds for GNU development.''
7162c0ca 50@c @end titlepage
fb40c209 51
7162c0ca
EZ
52@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% CHAPTER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53@node GDB/MI
54@chapter The @sc{gdb/mi} Interface
fb40c209 55
7162c0ca 56@unnumberedsec Function and Purpose
fb40c209 57
7162c0ca 58@cindex @sc{gdb/mi}, its purpose
e7997b74 59@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is
7162c0ca
EZ
60specifically intended to support the development of systems which use
61the debugger as just one small component of a larger system.
fb40c209 62
7162c0ca
EZ
63This chapter is a specification of the @sc{gdb/mi} interface. It is written
64in the form of a reference manual.
fb40c209 65
7162c0ca
EZ
66Note that @sc{gdb/mi} is still under construction, so some of the
67features described below are incomplete and subject to change.
fb40c209 68
7162c0ca 69@unnumberedsec Notation and Terminology
fb40c209 70
7162c0ca
EZ
71@cindex notational conventions, for @sc{gdb/mi}
72This chapter uses the following notation:
fb40c209 73
7162c0ca
EZ
74@itemize @bullet
75@item
76@code{|} separates two alternatives.
77
78@item
79@code{[ @var{something} ]} indicates that @var{something} is optional:
80it may or may not be given.
fb40c209 81
7162c0ca
EZ
82@item
83@code{( @var{group} )*} means that @var{group} inside the parentheses
84may repeat zero or more times.
fb40c209 85
7162c0ca
EZ
86@item
87@code{( @var{group} )+} means that @var{group} inside the parentheses
88may repeat one or more times.
fb40c209 89
7162c0ca
EZ
90@item
91@code{"@var{string}"} means a literal @var{string}.
92@end itemize
fb40c209 93
7162c0ca 94@ignore
fb40c209 95@heading Dependencies
7162c0ca 96@end ignore
fb40c209
AC
97
98@heading Acknowledgments
99
7162c0ca
EZ
100In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
101Elena Zannoni.
102
103@menu
104* GDB/MI Command Syntax::
8b0ceefc 105* GDB/MI Compatibility with CLI::
7162c0ca
EZ
106* GDB/MI Output Records::
107* GDB/MI Command Description Format::
108* GDB/MI Breakpoint Table Commands::
109* GDB/MI Data Manipulation::
110* GDB/MI Program Control::
d68fc559 111* GDB/MI Miscellaneous Commands::
6c0e9fb3
AC
112@ignore
113* GDB/MI Kod Commands::
114* GDB/MI Memory Overlay Commands::
115* GDB/MI Signal Handling Commands::
116@end ignore
7162c0ca
EZ
117* GDB/MI Stack Manipulation::
118* GDB/MI Symbol Query::
119* GDB/MI Target Manipulation::
120* GDB/MI Thread Commands::
121* GDB/MI Tracepoint Commands::
122* GDB/MI Variable Objects::
123@end menu
124
7162c0ca
EZ
125@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126@node GDB/MI Command Syntax
127@section @sc{gdb/mi} Command Syntax
fb40c209 128
7162c0ca
EZ
129@menu
130* GDB/MI Input Syntax::
131* GDB/MI Output Syntax::
132* GDB/MI Simple Examples::
133@end menu
fb40c209 134
7162c0ca
EZ
135@node GDB/MI Input Syntax
136@subsection @sc{gdb/mi} Input Syntax
fb40c209 137
7162c0ca
EZ
138@cindex input syntax for @sc{gdb/mi}
139@cindex @sc{gdb/mi}, input syntax
140@table @code
141@item @var{command} @expansion{}
142@code{@var{cli-command} | @var{mi-command}}
fb40c209 143
7162c0ca
EZ
144@item @var{cli-command} @expansion{}
145@code{[ @var{token} ] @var{cli-command} @var{nl}}, where
e7997b74 146@var{cli-command} is any existing @value{GDBN} CLI command.
fb40c209 147
7162c0ca
EZ
148@item @var{mi-command} @expansion{}
149@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
150@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
fb40c209 151
7162c0ca 152@item @var{token} @expansion{}
1c85fbd9 153"any sequence of digits"
fb40c209 154
7162c0ca
EZ
155@item @var{option} @expansion{}
156@code{"-" @var{parameter} [ " " @var{parameter} ]}
fb40c209 157
7162c0ca
EZ
158@item @var{parameter} @expansion{}
159@code{@var{non-blank-sequence} | @var{c-string}}
fb40c209 160
7162c0ca 161@item @var{operation} @expansion{}
1c85fbd9 162@emph{any of the operations described in this chapter}
fb40c209 163
7162c0ca
EZ
164@item @var{non-blank-sequence} @expansion{}
165@emph{anything, provided it doesn't contain special characters such as
166"-", @var{nl}, """ and of course " "}
fb40c209 167
7162c0ca
EZ
168@item @var{c-string} @expansion{}
169@code{""" @var{seven-bit-iso-c-string-content} """}
fb40c209 170
7162c0ca
EZ
171@item @var{nl} @expansion{}
172@code{CR | CR-LF}
fb40c209
AC
173@end table
174
1c85fbd9 175@noindent
fb40c209
AC
176Notes:
177
178@itemize @bullet
fb40c209 179@item
7162c0ca
EZ
180The CLI commands are still handled by the @sc{mi} interpreter; their
181output is described below.
fb40c209
AC
182
183@item
7162c0ca 184The @code{@var{token}}, when present, is passed back when the command
fb40c209
AC
185finishes.
186
187@item
7162c0ca 188Some @sc{mi} commands accept optional arguments as part of the parameter
1c85fbd9 189list. Each option is identified by a leading @samp{-} (dash) and may be
7162c0ca
EZ
190followed by an optional argument parameter. Options occur first in the
191parameter list and can be delimited from normal parameters using
192@samp{--} (this is useful when some parameters begin with a dash).
fb40c209
AC
193@end itemize
194
195Pragmatics:
196
197@itemize @bullet
fb40c209
AC
198@item
199We want easy access to the existing CLI syntax (for debugging).
200
201@item
7162c0ca 202We want it to be easy to spot a @sc{mi} operation.
fb40c209
AC
203@end itemize
204
7162c0ca
EZ
205@node GDB/MI Output Syntax
206@subsection @sc{gdb/mi} Output Syntax
fb40c209 207
7162c0ca
EZ
208@cindex output syntax of @sc{gdb/mi}
209@cindex @sc{gdb/mi}, output syntax
210The output from @sc{gdb/mi} consists of zero or more out-of-band records
d68fc559
EZ
211followed, optionally, by a single result record. This result record
212is for the most recent command. The sequence of output records is
1c85fbd9 213terminated by @samp{(@value{GDBP})}.
fb40c209 214
7162c0ca 215If an input command was prefixed with a @code{@var{token}} then the
fb40c209 216corresponding output for that command will also be prefixed by that same
7162c0ca 217@var{token}.
fb40c209
AC
218
219@table @code
7162c0ca
EZ
220@item @var{output} @expansion{}
221@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}}
fb40c209 222
7162c0ca
EZ
223@item @var{result-record} @expansion{}
224@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}}
fb40c209 225
7162c0ca
EZ
226@item @var{out-of-band-record} @expansion{}
227@code{@var{async-record} | @var{stream-record}}
fb40c209 228
7162c0ca
EZ
229@item @var{async-record} @expansion{}
230@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}}
fb40c209 231
7162c0ca
EZ
232@item @var{exec-async-output} @expansion{}
233@code{[ @var{token} ] "*" @var{async-output}}
fb40c209 234
7162c0ca
EZ
235@item @var{status-async-output} @expansion{}
236@code{[ @var{token} ] "+" @var{async-output}}
fb40c209 237
7162c0ca
EZ
238@item @var{notify-async-output} @expansion{}
239@code{[ @var{token} ] "=" @var{async-output}}
fb40c209 240
7162c0ca
EZ
241@item @var{async-output} @expansion{}
242@code{@var{async-class} ( "," @var{result} )* @var{nl}}
fb40c209 243
7162c0ca
EZ
244@item @var{result-class} @expansion{}
245@code{"done" | "running" | "connected" | "error" | "exit"}
fb40c209 246
7162c0ca
EZ
247@item @var{async-class} @expansion{}
248@code{"stopped" | @var{others}} (where @var{others} will be added
249depending on the needs---this is still in development).
fb40c209 250
7162c0ca 251@item @var{result} @expansion{}
163e6d2d
AC
252@code{ @var{variable} "=" @var{value}}
253
254@item @var{variable} @expansion{}
255@code{ @var{string} }
fb40c209 256
7162c0ca 257@item @var{value} @expansion{}
163e6d2d 258@code{ @var{const} | @var{tuple} | @var{list} }
fb40c209 259
7162c0ca
EZ
260@item @var{const} @expansion{}
261@code{@var{c-string}}
fb40c209 262
163e6d2d
AC
263@item @var{tuple} @expansion{}
264@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" }
265
266@item @var{list} @expansion{}
267@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "["
268@var{result} ( "," @var{result} )* "]" }
269
7162c0ca
EZ
270@item @var{stream-record} @expansion{}
271@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}}
fb40c209 272
7162c0ca
EZ
273@item @var{console-stream-output} @expansion{}
274@code{"~" @var{c-string}}
fb40c209 275
7162c0ca
EZ
276@item @var{target-stream-output} @expansion{}
277@code{"@@" @var{c-string}}
fb40c209 278
7162c0ca
EZ
279@item @var{log-stream-output} @expansion{}
280@code{"&" @var{c-string}}
fb40c209 281
7162c0ca
EZ
282@item @var{nl} @expansion{}
283@code{CR | CR-LF}
fb40c209 284
7162c0ca
EZ
285@item @var{token} @expansion{}
286@emph{any sequence of digits}.
fb40c209
AC
287@end table
288
1c85fbd9 289@noindent
fb40c209
AC
290Notes:
291
292@itemize @bullet
fb40c209
AC
293@item
294All output sequences end in a single line containing a period.
295
296@item
7162c0ca
EZ
297The @code{@var{token}} is from the corresponding request. If an execution
298command is interrupted by the @samp{-exec-interrupt} command, the
1c85fbd9
EZ
299@var{token} associated with the @samp{*stopped} message is the one of the
300original execution command, not the one of the interrupt command.
fb40c209
AC
301
302@item
7162c0ca
EZ
303@cindex status output in @sc{gdb/mi}
304@var{status-async-output} contains on-going status information about the
305progress of a slow operation. It can be discarded. All status output is
306prefixed by @samp{+}.
fb40c209
AC
307
308@item
7162c0ca
EZ
309@cindex async output in @sc{gdb/mi}
310@var{exec-async-output} contains asynchronous state change on the target
311(stopped, started, disappeared). All async output is prefixed by
312@samp{*}.
fb40c209
AC
313
314@item
7162c0ca
EZ
315@cindex notify output in @sc{gdb/mi}
316@var{notify-async-output} contains supplementary information that the
317client should handle (e.g., a new breakpoint information). All notify
318output is prefixed by @samp{=}.
fb40c209
AC
319
320@item
7162c0ca
EZ
321@cindex console output in @sc{gdb/mi}
322@var{console-stream-output} is output that should be displayed as is in the
323console. It is the textual response to a CLI command. All the console
324output is prefixed by @samp{~}.
fb40c209
AC
325
326@item
7162c0ca
EZ
327@cindex target output in @sc{gdb/mi}
328@var{target-stream-output} is the output produced by the target program.
329All the target output is prefixed by @samp{@@}.
fb40c209
AC
330
331@item
7162c0ca 332@cindex log output in @sc{gdb/mi}
e7997b74 333@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for
fb40c209 334instance messages that should be displayed as part of an error log. All
7162c0ca 335the log output is prefixed by @samp{&}.
163e6d2d
AC
336
337@item
338@cindex list output in @sc{gdb/mi}
339New @sc{gdb/mi} commands should only output @var{lists} containing
340@var{values}.
341
342
fb40c209
AC
343@end itemize
344
7162c0ca
EZ
345@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more
346details about the various output records.
347
348@node GDB/MI Simple Examples
349@subsection Simple Examples of @sc{gdb/mi} Interaction
350@cindex @sc{gdb/mi}, simple examples
351
352This subsection presents several simple examples of interaction using
353the @sc{gdb/mi} interface. In these examples, @samp{->} means that the
354following line is passed to @sc{gdb/mi} as input, while @samp{<-} means
355the output received from @sc{gdb/mi}.
356
357@subsubheading Target Stop
32c95e20 358@c Ummm... There is no "-stop" command. This assumes async, no?
7162c0ca 359Here's an example of stopping the inferior process:
fb40c209
AC
360
361@example
362-> -stop
1c85fbd9 363<- (@value{GDBP})
fb40c209
AC
364@end example
365
7162c0ca
EZ
366@noindent
367and later:
fb40c209
AC
368
369@example
370<- *stop,reason="stop",address="0x123",source="a.c:123"
1c85fbd9 371<- (@value{GDBP})
fb40c209
AC
372@end example
373
7162c0ca 374@subsubheading Simple CLI Command
fb40c209 375
7162c0ca
EZ
376Here's an example of a simple CLI command being passed through
377@sc{gdb/mi} and on to the CLI.
fb40c209
AC
378
379@example
380-> print 1+2
32c95e20
KS
381<- &"print 1+2\n"
382<- ~"$1 = 3\n"
383<- ^done
1c85fbd9 384<- (@value{GDBP})
fb40c209
AC
385@end example
386
7162c0ca 387@subsubheading Command With Side Effects
fb40c209
AC
388
389@example
390-> -symbol-file xyz.exe
391<- *breakpoint,nr="3",address="0x123",source="a.c:123"
1c85fbd9 392<- (@value{GDBP})
fb40c209
AC
393@end example
394
7162c0ca 395@subsubheading A Bad Command
fb40c209 396
7162c0ca 397Here's what happens if you pass a non-existent command:
fb40c209
AC
398
399@example
400-> -rubbish
32c95e20 401<- ^error,msg="Undefined MI command: rubbish"
1c85fbd9 402<- (@value{GDBP})
fb40c209
AC
403@end example
404
7162c0ca 405@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8b0ceefc 406@node GDB/MI Compatibility with CLI
7162c0ca 407@section @sc{gdb/mi} Compatibility with CLI
fb40c209 408
7162c0ca
EZ
409@cindex compatibility, @sc{gdb/mi} and CLI
410@cindex @sc{gdb/mi}, compatibility with CLI
e7997b74 411To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi}
7162c0ca 412accepts existing CLI commands. As specified by the syntax, such
e7997b74 413commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will
fb40c209
AC
414respond.
415
7162c0ca
EZ
416This mechanism is provided as an aid to developers of @sc{gdb/mi}
417clients and not as a reliable interface into the CLI. Since the command
418is being interpreteted in an environment that assumes @sc{gdb/mi}
419behaviour, the exact output of such commands is likely to end up being
420an un-supported hybrid of @sc{gdb/mi} and CLI output.
fb40c209 421
7162c0ca
EZ
422@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
423@node GDB/MI Output Records
424@section @sc{gdb/mi} Output Records
fb40c209 425
7162c0ca
EZ
426@menu
427* GDB/MI Result Records::
428* GDB/MI Stream Records::
429* GDB/MI Out-of-band Records::
430@end menu
fb40c209 431
7162c0ca
EZ
432@node GDB/MI Result Records
433@subsection @sc{gdb/mi} Result Records
fb40c209 434
7162c0ca
EZ
435@cindex result records in @sc{gdb/mi}
436@cindex @sc{gdb/mi}, result records
437In addition to a number of out-of-band notifications, the response to a
438@sc{gdb/mi} command includes one of the following result indications:
fb40c209
AC
439
440@table @code
7162c0ca
EZ
441@findex ^done
442@item "^done" [ "," @var{results} ]
1c85fbd9
EZ
443The synchronous operation was successful, @code{@var{results}} are the return
444values.
fb40c209 445
7162c0ca
EZ
446@item "^running"
447@findex ^running
448@c Is this one correct? Should it be an out-of-band notification?
fb40c209 449The asynchronous operation was successfully started. The target is
7162c0ca 450running.
fb40c209 451
7162c0ca 452@item "^error" "," @var{c-string}
e7997b74 453@findex ^error
7162c0ca 454The operation failed. The @code{@var{c-string}} contains the corresponding
fb40c209 455error message.
fb40c209
AC
456@end table
457
7162c0ca
EZ
458@node GDB/MI Stream Records
459@subsection @sc{gdb/mi} Stream Records
fb40c209 460
7162c0ca
EZ
461@cindex @sc{gdb/mi}, stream records
462@cindex stream records in @sc{gdb/mi}
e7997b74 463@value{GDBN} internally maintains a number of output streams: the console, the
fb40c209 464target, and the log. The output intended for each of these streams is
7162c0ca 465funneled through the @sc{gdb/mi} interface using @dfn{stream records}.
fb40c209 466
7162c0ca
EZ
467Each stream record begins with a unique @dfn{prefix character} which
468identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output
e7997b74 469Syntax}). In addition to the prefix, each stream record contains a
7162c0ca 470@code{@var{string-output}}. This is either raw text (with an implicit new
fb40c209
AC
471line) or a quoted C string (which does not contain an implicit newline).
472
473@table @code
7162c0ca 474@item "~" @var{string-output}
fb40c209
AC
475The console output stream contains text that should be displayed in the
476CLI console window. It contains the textual responses to CLI commands.
477
7162c0ca 478@item "@@" @var{string-output}
fb40c209
AC
479The target output stream contains any textual output from the running
480target.
481
7162c0ca 482@item "&" @var{string-output}
e7997b74 483The log stream contains debugging messages being produced by @value{GDBN}'s
fb40c209 484internals.
fb40c209
AC
485@end table
486
7162c0ca
EZ
487@node GDB/MI Out-of-band Records
488@subsection @sc{gdb/mi} Out-of-band Records
fb40c209 489
7162c0ca
EZ
490@cindex out-of-band records in @sc{gdb/mi}
491@cindex @sc{gdb/mi}, out-of-band records
492@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of
493additional changes that have occurred. Those changes can either be a
494consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of
495target activity (e.g., target stopped).
fb40c209
AC
496
497The following is a preliminary list of possible out-of-band records.
498
499@table @code
7162c0ca 500@item "*" "stop"
fb40c209
AC
501@end table
502
503
7162c0ca
EZ
504@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
505@node GDB/MI Command Description Format
506@section @sc{gdb/mi} Command Description Format
fb40c209 507
7162c0ca 508The remaining sections describe blocks of commands. Each block of
1c85fbd9 509commands is laid out in a fashion similar to this section.
fb40c209
AC
510
511Note the the line breaks shown in the examples are here only for
1c85fbd9 512readability. They don't appear in the real output.
7162c0ca
EZ
513Also note that the commands with a non-available example (N.A.@:) are
514not yet implemented.
515
516@subheading Motivation
517
e7997b74 518The motivation for this collection of commands.
fb40c209 519
7162c0ca 520@subheading Introduction
fb40c209 521
7162c0ca 522A brief introduction to this collection of commands as a whole.
fb40c209 523
7162c0ca 524@subheading Commands
fb40c209 525
7162c0ca 526For each command in the block, the following is described:
fb40c209 527
7162c0ca 528@subsubheading Synopsis
fb40c209 529
7162c0ca 530@example
e7997b74 531 -command @var{args}@dots{}
7162c0ca 532@end example
fb40c209 533
e7997b74 534@subsubheading @value{GDBN} Command
fb40c209 535
e7997b74 536The corresponding @value{GDBN} CLI command.
fb40c209 537
7162c0ca 538@subsubheading Result
fb40c209 539
7162c0ca 540@subsubheading Out-of-band
fb40c209 541
7162c0ca
EZ
542@subsubheading Notes
543
544@subsubheading Example
fb40c209 545
fb40c209 546
7162c0ca
EZ
547@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
548@node GDB/MI Breakpoint Table Commands
549@section @sc{gdb/mi} Breakpoint table commands
fb40c209 550
7162c0ca
EZ
551@cindex breakpoint commands for @sc{gdb/mi}
552@cindex @sc{gdb/mi}, breakpoint commands
553This section documents @sc{gdb/mi} commands for manipulating
554breakpoints.
555
556@subheading The @code{-break-after} Command
557@findex -break-after
558
559@subsubheading Synopsis
fb40c209 560
fb40c209 561@example
7162c0ca
EZ
562 -break-after @var{number} @var{count}
563@end example
564
565The breakpoint number @var{number} is not in effect until it has been
566hit @var{count} times. To see how this is reflected in the output of
567the @samp{-break-list} command, see the description of the
568@samp{-break-list} command below.
569
e7997b74 570@subsubheading @value{GDBN} Command
7162c0ca 571
e7997b74 572The corresponding @value{GDBN} command is @samp{ignore}.
7162c0ca
EZ
573
574@subsubheading Example
575
576@smallexample
e7997b74 577(@value{GDBP})
fb40c209
AC
578-break-insert main
579^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@}
e7997b74 580(@value{GDBP})
fb40c209
AC
581-break-after 1 3
582~
583^done
e7997b74 584(@value{GDBP})
fb40c209 585-break-list
cff22675
AC
586^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
587hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
588@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
589@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
590@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
591@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
592@{width="40",alignment="2",col_name="what",colhdr="What"@}],
593body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
7162c0ca 594addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
cff22675 595ignore="3"@}]@}
e7997b74 596(@value{GDBP})
7162c0ca
EZ
597@end smallexample
598
599@ignore
600@subheading The @code{-break-catch} Command
601@findex -break-catch
602
603@subheading The @code{-break-commands} Command
604@findex -break-commands
605@end ignore
606
fb40c209 607
1c85fbd9 608@subheading The @code{-break-condition} Command
7162c0ca 609@findex -break-condition
fb40c209 610
7162c0ca 611@subsubheading Synopsis
fb40c209 612
fb40c209 613@example
7162c0ca
EZ
614 -break-condition @var{number} @var{expr}
615@end example
616
617Breakpoint @var{number} will stop the program only if the condition in
618@var{expr} is true. The condition becomes part of the
619@samp{-break-list} output (see the description of the @samp{-break-list}
620command below).
621
e7997b74 622@subsubheading @value{GDBN} Command
7162c0ca 623
e7997b74 624The corresponding @value{GDBN} command is @samp{condition}.
7162c0ca
EZ
625
626@subsubheading Example
627
628@smallexample
e7997b74 629(@value{GDBP})
fb40c209
AC
630-break-condition 1 1
631^done
e7997b74 632(@value{GDBP})
fb40c209 633-break-list
cff22675
AC
634^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
635hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
636@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
637@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
638@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
639@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
640@{width="40",alignment="2",col_name="what",colhdr="What"@}],
641body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
7162c0ca 642addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
cff22675 643times="0",ignore="3"@}]@}
e7997b74 644(@value{GDBP})
7162c0ca
EZ
645@end smallexample
646
647@subheading The @code{-break-delete} Command
648@findex -break-delete
649
650@subsubheading Synopsis
651
652@example
653 -break-delete ( @var{breakpoint} )+
fb40c209
AC
654@end example
655
7162c0ca 656Delete the breakpoint(s) whose number(s) are specified in the argument
e7997b74 657list. This is obviously reflected in the breakpoint list.
7162c0ca 658
e7997b74 659@subsubheading @value{GDBN} command
7162c0ca 660
e7997b74 661The corresponding @value{GDBN} command is @samp{delete}.
7162c0ca
EZ
662
663@subsubheading Example
664
fb40c209 665@example
e7997b74 666(@value{GDBP})
7162c0ca 667-break-delete 1
fb40c209 668^done
e7997b74 669(@value{GDBP})
fb40c209 670-break-list
cff22675
AC
671^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
672hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
673@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
674@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
675@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
676@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
677@{width="40",alignment="2",col_name="what",colhdr="What"@}],
678body=[]@}
e7997b74 679(@value{GDBP})
fb40c209
AC
680@end example
681
7162c0ca
EZ
682@subheading The @code{-break-disable} Command
683@findex -break-disable
684
685@subsubheading Synopsis
686
fb40c209 687@example
7162c0ca
EZ
688 -break-disable ( @var{breakpoint} )+
689@end example
690
691Disable the named @var{breakpoint}(s). The field @samp{enabled} in the
692break list is now set to @samp{n} for the named @var{breakpoint}(s).
693
e7997b74 694@subsubheading @value{GDBN} Command
7162c0ca 695
e7997b74 696The corresponding @value{GDBN} command is @samp{disable}.
7162c0ca
EZ
697
698@subsubheading Example
699
700@smallexample
e7997b74 701(@value{GDBP})
fb40c209
AC
702-break-disable 2
703^done
e7997b74 704(@value{GDBP})
fb40c209 705-break-list
cff22675
AC
706^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
707hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
708@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
709@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
710@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
711@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
712@{width="40",alignment="2",col_name="what",colhdr="What"@}],
713body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
714addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
e7997b74 715(@value{GDBP})
7162c0ca
EZ
716@end smallexample
717
718@subheading The @code{-break-enable} Command
719@findex -break-enable
720
721@subsubheading Synopsis
fb40c209 722
fb40c209 723@example
7162c0ca
EZ
724 -break-enable ( @var{breakpoint} )+
725@end example
726
727Enable (previously disabled) @var{breakpoint}(s).
728
e7997b74 729@subsubheading @value{GDBN} Command
7162c0ca 730
e7997b74 731The corresponding @value{GDBN} command is @samp{enable}.
7162c0ca
EZ
732
733@subsubheading Example
734
735@smallexample
e7997b74 736(@value{GDBP})
7162c0ca 737-break-enable 2
fb40c209 738^done
e7997b74 739(@value{GDBP})
fb40c209 740-break-list
cff22675
AC
741^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
742hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
743@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
744@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
745@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
746@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
747@{width="40",alignment="2",col_name="what",colhdr="What"@}],
748body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
749addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
e7997b74 750(@value{GDBP})
7162c0ca
EZ
751@end smallexample
752
753@subheading The @code{-break-info} Command
754@findex -break-info
755
756@subsubheading Synopsis
757
758@example
759 -break-info @var{breakpoint}
fb40c209
AC
760@end example
761
7162c0ca
EZ
762@c REDUNDANT???
763Get information about a single breakpoint.
764
e7997b74 765@subsubheading @value{GDBN} command
7162c0ca 766
e7997b74 767The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}.
7162c0ca
EZ
768
769@subsubheading Example
fb40c209
AC
770N.A.
771
7162c0ca
EZ
772@subheading The @code{-break-insert} Command
773@findex -break-insert
774
775@subsubheading Synopsis
776
777@example
778 -break-insert [ -t ] [ -h ] [ -r ]
779 [ -c @var{condition} ] [ -i @var{ignore-count} ]
780 [ -p @var{thread} ] [ @var{line} | @var{addr} ]
781@end example
782
783@noindent
784If specified, @var{line}, can be one of:
fb40c209 785
fb40c209
AC
786@itemize @bullet
787@item function
788@c @item +offset
789@c @item -offset
790@c @item linenum
791@item filename:linenum
792@item filename:function
793@item *address
794@end itemize
795
7162c0ca 796The possible optional parameters of this command are:
fb40c209
AC
797
798@table @samp
799@item -t
800Insert a tempoary breakpoint.
801@item -h
802Insert a hardware breakpoint.
7162c0ca
EZ
803@item -c @var{condition}
804Make the breakpoint conditional on @var{condition}.
805@item -i @var{ignore-count}
806Initialize the @var{ignore-count}.
fb40c209
AC
807@item -r
808Insert a regular breakpoint in all the functions whose names match the
809given regular expression. Other flags are not applicable to regular
810expresson.
811@end table
812
7162c0ca 813@subsubheading Result
fb40c209
AC
814
815The result is in the form:
816
fb40c209 817@example
7162c0ca
EZ
818 ^done,bkptno="@var{number}",func="@var{funcname}",
819 file="@var{filename}",line="@var{lineno}"
820@end example
821
822@noindent
e7997b74 823where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname}
7162c0ca
EZ
824is the name of the function where the breakpoint was inserted,
825@var{filename} is the name of the source file which contains this
826function, and @var{lineno} is the source line number within that file.
827
828Note: this format is open to change.
829@c An out-of-band breakpoint instead of part of the result?
830
e7997b74 831@subsubheading @value{GDBN} Command
7162c0ca 832
e7997b74 833The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak},
7162c0ca
EZ
834@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}.
835
836@subsubheading Example
837
838@smallexample
e7997b74 839(@value{GDBP})
fb40c209
AC
840-break-insert main
841^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
e7997b74 842(@value{GDBP})
fb40c209
AC
843-break-insert -t foo
844^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@}
e7997b74 845(@value{GDBP})
fb40c209 846-break-list
cff22675
AC
847^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
848hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
849@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
850@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
851@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
852@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
853@{width="40",alignment="2",col_name="what",colhdr="What"@}],
854body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
7162c0ca
EZ
855addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
856bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
cff22675 857addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@}
e7997b74 858(@value{GDBP})
fb40c209
AC
859-break-insert -r foo.*
860~int foo(int, int);
861^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@}
e7997b74 862(@value{GDBP})
7162c0ca
EZ
863@end smallexample
864
865@subheading The @code{-break-list} Command
866@findex -break-list
867
868@subsubheading Synopsis
869
870@example
871 -break-list
fb40c209
AC
872@end example
873
fb40c209 874Displays the list of inserted breakpoints, showing the following fields:
7162c0ca 875
fb40c209
AC
876@table @samp
877@item Number
7162c0ca 878number of the breakpoint
fb40c209 879@item Type
7162c0ca 880type of the breakpoint: @samp{breakpoint} or @samp{watchpoint}
fb40c209 881@item Disposition
7162c0ca
EZ
882should the breakpoint be deleted or disabled when it is hit: @samp{keep}
883or @samp{nokeep}
fb40c209 884@item Enabled
7162c0ca 885is the breakpoint enabled or no: @samp{y} or @samp{n}
fb40c209 886@item Address
7162c0ca 887memory location at which the breakpoint is set
fb40c209 888@item What
7162c0ca
EZ
889logical location of the breakpoint, expressed by function name, file
890name, line number
e7997b74 891@item Times
7162c0ca 892number of times the breakpoint has been hit
fb40c209
AC
893@end table
894
1c85fbd9 895If there are no breakpoints or watchpoints, the @code{BreakpointTable}
cff22675 896@code{body} field is an empty list.
fb40c209 897
e7997b74 898@subsubheading @value{GDBN} Command
7162c0ca 899
e7997b74 900The corresponding @value{GDBN} command is @samp{info break}.
7162c0ca
EZ
901
902@subsubheading Example
903
904@smallexample
e7997b74 905(@value{GDBP})
fb40c209 906-break-list
cff22675
AC
907^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
908hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
909@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
910@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
911@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
912@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
913@{width="40",alignment="2",col_name="what",colhdr="What"@}],
914body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
fb40c209
AC
915addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
916bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
cff22675 917addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@}
e7997b74 918(@value{GDBP})
7162c0ca
EZ
919@end smallexample
920
921Here's an example of the result when there are no breakpoints:
922
923@smallexample
e7997b74 924(@value{GDBP})
fb40c209 925-break-list
cff22675
AC
926^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
927hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
928@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
929@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
930@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
931@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
932@{width="40",alignment="2",col_name="what",colhdr="What"@}],
933body=[]@}
e7997b74 934(@value{GDBP})
7162c0ca
EZ
935@end smallexample
936
937@subheading The @code{-break-watch} Command
938@findex -break-watch
939
940@subsubheading Synopsis
941
942@example
943 -break-watch [ -a | -r ]
fb40c209
AC
944@end example
945
7162c0ca 946Create a watchpoint. With the @samp{-a} option it will create an
d68fc559 947@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a
7162c0ca
EZ
948read from or on a write to the memory location. With the @samp{-r}
949option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will
950trigger only when the memory location is accessed for reading. Without
951either of the options, the watchpoint created is a regular watchpoint,
952i.e. it will trigger when the memory location is accessed for writing.
953@xref{Set Watchpoints, , Setting watchpoints}.
fb40c209 954
7162c0ca 955Note that @samp{-break-list} will report a single list of watchpoints and
fb40c209
AC
956breakpoints inserted.
957
e7997b74 958@subsubheading @value{GDBN} Command
fb40c209 959
e7997b74 960The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and
7162c0ca
EZ
961@samp{rwatch}.
962
963@subsubheading Example
964
965Setting a watchpoint on a variable in the @code{main} function:
966
967@smallexample
e7997b74 968(@value{GDBP})
fb40c209
AC
969-break-watch x
970^done,wpt=@{number="2",exp="x"@}
e7997b74 971(@value{GDBP})
7162c0ca 972-exec-continue
fb40c209
AC
973^running
974^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
975value=@{old="-268439212",new="55"@},
68c81b54 976frame=@{func="main",args=[],file="recursive2.c",line="5"@}
e7997b74 977(@value{GDBP})
7162c0ca
EZ
978@end smallexample
979
e7997b74 980Setting a watchpoint on a variable local to a function. @value{GDBN} will stop
7162c0ca
EZ
981the program execution twice: first for the variable changing value, then
982for the watchpoint going out of scope.
983
984@smallexample
e7997b74 985(@value{GDBP})
fb40c209
AC
986-break-watch C
987^done,wpt=@{number="5",exp="C"@}
e7997b74 988(@value{GDBP})
fb40c209
AC
989-exec-continue
990^running
991^done,reason="watchpoint-trigger",
992wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
68c81b54 993frame=@{func="callee4",args=[],
7162c0ca 994file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
e7997b74 995(@value{GDBP})
fb40c209
AC
996-exec-continue
997^running
998^done,reason="watchpoint-scope",wpnum="5",
68c81b54
AC
999frame=@{func="callee3",args=[@{name="strarg",
1000value="0x11940 \"A string argument.\""@}],
fb40c209 1001file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
e7997b74 1002(@value{GDBP})
7162c0ca 1003@end smallexample
fb40c209 1004
7162c0ca
EZ
1005Listing breakpoints and watchpoints, at different points in the program
1006execution. Note that once the watchpoint goes out of scope, it is
1007deleted.
1008
1009@smallexample
e7997b74 1010(@value{GDBP})
fb40c209
AC
1011-break-watch C
1012^done,wpt=@{number="2",exp="C"@}
e7997b74 1013(@value{GDBP})
7162c0ca 1014-break-list
cff22675
AC
1015^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
1016hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
1017@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
1018@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
1019@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
1020@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
1021@{width="40",alignment="2",col_name="what",colhdr="What"@}],
1022body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
7162c0ca 1023addr="0x00010734",func="callee4",
fb40c209
AC
1024file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
1025bkpt=@{number="2",type="watchpoint",disp="keep",
cff22675 1026enabled="y",addr="",what="C",times="0"@}]@}
e7997b74 1027(@value{GDBP})
fb40c209
AC
1028-exec-continue
1029^running
1030^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@},
1031value=@{old="-276895068",new="3"@},
68c81b54 1032frame=@{func="callee4",args=[],
fb40c209 1033file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
e7997b74 1034(@value{GDBP})
fb40c209 1035-break-list
cff22675
AC
1036^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
1037hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
1038@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
1039@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
1040@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
1041@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
1042@{width="40",alignment="2",col_name="what",colhdr="What"@}],
1043body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
7162c0ca 1044addr="0x00010734",func="callee4",
fb40c209
AC
1045file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
1046bkpt=@{number="2",type="watchpoint",disp="keep",
cff22675 1047enabled="y",addr="",what="C",times="-5"@}]@}
e7997b74 1048(@value{GDBP})
fb40c209
AC
1049-exec-continue
1050^running
1051^done,reason="watchpoint-scope",wpnum="2",
68c81b54
AC
1052frame=@{func="callee3",args=[@{name="strarg",
1053value="0x11940 \"A string argument.\""@}],
fb40c209 1054file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
e7997b74 1055(@value{GDBP})
fb40c209 1056-break-list
cff22675
AC
1057^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
1058hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
1059@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
1060@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
1061@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
1062@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
1063@{width="40",alignment="2",col_name="what",colhdr="What"@}],
1064body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
7162c0ca 1065addr="0x00010734",func="callee4",
cff22675 1066file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
e7997b74 1067(@value{GDBP})
7162c0ca
EZ
1068@end smallexample
1069
1070@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1071@node GDB/MI Data Manipulation
1072@section @sc{gdb/mi} Data Manipulation
fb40c209 1073
7162c0ca
EZ
1074@cindex data manipulation, in @sc{gdb/mi}
1075@cindex @sc{gdb/mi}, data manipulation
1076This section describes the @sc{gdb/mi} commands that manipulate data:
1077examine memory and registers, evaluate expressions, etc.
1078
1079@c REMOVED FROM THE INTERFACE.
1080@c @subheading -data-assign
fb40c209 1081@c Change the value of a program variable. Plenty of side effects.
7162c0ca 1082@c @subsubheading GDB command
fb40c209 1083@c set variable
7162c0ca 1084@c @subsubheading Example
fb40c209
AC
1085@c N.A.
1086
7162c0ca
EZ
1087@subheading The @code{-data-disassemble} Command
1088@findex -data-disassemble
1089
1090@subsubheading Synopsis
1091
1092@example
1093 -data-disassemble
1094 [ -s @var{start-addr} -e @var{end-addr} ]
1095 | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
1096 -- @var{mode}
1097@end example
1098
1099@noindent
1100Where:
1101
fb40c209 1102@table @samp
7162c0ca
EZ
1103@item @var{start-addr}
1104is the beginning address (or @code{$pc})
1105@item @var{end-addr}
1106is the end address
1107@item @var{filename}
1108is the name of the file to disassemble
1109@item @var{linenum}
1110is the line number to disassemble around
1111@item @var{lines}
1112is the the number of disassembly lines to be produced. If it is -1,
d68fc559 1113the whole function will be disassembled, in case no @var{end-addr} is
7162c0ca 1114specified. If @var{end-addr} is specified as a non-zero value, and
d68fc559 1115@var{lines} is lower than the number of disassembly lines between
7162c0ca
EZ
1116@var{start-addr} and @var{end-addr}, only @var{lines} lines are
1117displayed; if @var{lines} is higher than the number of lines between
1118@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr}
1119are displayed.
1120@item @var{mode}
1121is either 0 (meaning only disassembly) or 1 (meaning mixed source and
e7997b74 1122disassembly).
fb40c209
AC
1123@end table
1124
7162c0ca
EZ
1125@subsubheading Result
1126
1c85fbd9 1127The output for each instruction is composed of four fields:
7162c0ca 1128
fb40c209
AC
1129@itemize @bullet
1130@item Address
cdffbaa2
EZ
1131@item Func-name
1132@item Offset
fb40c209
AC
1133@item Instruction
1134@end itemize
7162c0ca 1135
cdffbaa2 1136Note that whatever included in the instruction field, is not manipulated
1c85fbd9 1137directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format.
fb40c209 1138
e7997b74 1139@subsubheading @value{GDBN} Command
cdffbaa2 1140
7162c0ca
EZ
1141There's no direct mapping from this command to the CLI.
1142
1143@subsubheading Example
1144
1145Disassemble from the current value of @code{$pc} to @code{$pc + 20}:
1146
1147@smallexample
e7997b74 1148(@value{GDBP})
7162c0ca 1149-data-disassemble -s $pc -e "$pc + 20" -- 0
cdffbaa2 1150^done,
70242e8d 1151asm_insns=[
7162c0ca
EZ
1152@{address="0x000107c0",func-name="main",offset="4",
1153inst="mov 2, %o0"@},
1154@{address="0x000107c4",func-name="main",offset="8",
1155inst="sethi %hi(0x11800), %o2"@},
1156@{address="0x000107c8",func-name="main",offset="12",
1157inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@},
1158@{address="0x000107cc",func-name="main",offset="16",
1159inst="sethi %hi(0x11800), %o2"@},
1160@{address="0x000107d0",func-name="main",offset="20",
70242e8d 1161inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}]
e7997b74 1162(@value{GDBP})
7162c0ca 1163@end smallexample
fb40c209 1164
7162c0ca
EZ
1165Disassemble the whole @code{main} function. Line 32 is part of
1166@code{main}.
1167
1168@smallexample
cdffbaa2 1169-data-disassemble -f basics.c -l 32 -- 0
70242e8d 1170^done,asm_insns=[
7162c0ca
EZ
1171@{address="0x000107bc",func-name="main",offset="0",
1172inst="save %sp, -112, %sp"@},
1173@{address="0x000107c0",func-name="main",offset="4",
1174inst="mov 2, %o0"@},
1175@{address="0x000107c4",func-name="main",offset="8",
1176inst="sethi %hi(0x11800), %o2"@},
e7997b74 1177[@dots{}]
7162c0ca 1178@{address="0x0001081c",func-name="main",offset="96",inst="ret "@},
70242e8d 1179@{address="0x00010820",func-name="main",offset="100",inst="restore "@}]
e7997b74 1180(@value{GDBP})
7162c0ca 1181@end smallexample
fb40c209 1182
d68fc559 1183Disassemble 3 instructions from the start of @code{main}:
7162c0ca
EZ
1184
1185@smallexample
e7997b74 1186(@value{GDBP})
cdffbaa2 1187-data-disassemble -f basics.c -l 32 -n 3 -- 0
70242e8d 1188^done,asm_insns=[
7162c0ca
EZ
1189@{address="0x000107bc",func-name="main",offset="0",
1190inst="save %sp, -112, %sp"@},
1191@{address="0x000107c0",func-name="main",offset="4",
1192inst="mov 2, %o0"@},
1193@{address="0x000107c4",func-name="main",offset="8",
70242e8d 1194inst="sethi %hi(0x11800), %o2"@}]
e7997b74 1195(@value{GDBP})
7162c0ca 1196@end smallexample
cdffbaa2 1197
d68fc559 1198Disassemble 3 instructions from the start of @code{main} in mixed mode:
7162c0ca
EZ
1199
1200@smallexample
e7997b74 1201(@value{GDBP})
cdffbaa2 1202-data-disassemble -f basics.c -l 32 -n 3 -- 1
70242e8d 1203^done,asm_insns=[
7162c0ca
EZ
1204src_and_asm_line=@{line="31",
1205file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
70242e8d 1206 testsuite/gdb.mi/basics.c",line_asm_insn=[
7162c0ca 1207@{address="0x000107bc",func-name="main",offset="0",
70242e8d 1208inst="save %sp, -112, %sp"@}]@},
7162c0ca
EZ
1209src_and_asm_line=@{line="32",
1210file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
70242e8d 1211 testsuite/gdb.mi/basics.c",line_asm_insn=[
7162c0ca
EZ
1212@{address="0x000107c0",func-name="main",offset="4",
1213inst="mov 2, %o0"@},
1214@{address="0x000107c4",func-name="main",offset="8",
70242e8d 1215inst="sethi %hi(0x11800), %o2"@}]@}]
e7997b74 1216(@value{GDBP})
7162c0ca
EZ
1217@end smallexample
1218
1219
1220@subheading The @code{-data-evaluate-expression} Command
1221@findex -data-evaluate-expression
1222
1223@subsubheading Synopsis
1224
fb40c209 1225@example
7162c0ca
EZ
1226 -data-evaluate-expression @var{expr}
1227@end example
1228
1229Evaluate @var{expr} as an expression. The expression could contain an
1230inferior function call. The function call will execute synchronously.
1231If the expression contains spaces, it must be enclosed in double quotes.
1232
e7997b74 1233@subsubheading @value{GDBN} Command
7162c0ca 1234
e7997b74 1235The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and
d68fc559 1236@samp{call}. In @code{gdbtk} only, there's a corresponding
7162c0ca
EZ
1237@samp{gdb_eval} command.
1238
1239@subsubheading Example
1240
1241In the following example, the numbers that precede the commands are the
e7997b74 1242@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi}
7162c0ca
EZ
1243Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its
1244output.
1245
1246@smallexample
fb40c209
AC
1247211-data-evaluate-expression A
1248211^done,value="1"
e7997b74 1249(@value{GDBP})
fb40c209
AC
1250311-data-evaluate-expression &A
1251311^done,value="0xefffeb7c"
e7997b74 1252(@value{GDBP})
fb40c209
AC
1253411-data-evaluate-expression A+3
1254411^done,value="4"
e7997b74 1255(@value{GDBP})
fb40c209
AC
1256511-data-evaluate-expression "A + 3"
1257511^done,value="4"
e7997b74 1258(@value{GDBP})
7162c0ca 1259@end smallexample
fb40c209 1260
7162c0ca
EZ
1261
1262@subheading The @code{-data-list-changed-registers} Command
1263@findex -data-list-changed-registers
1264
1265@subsubheading Synopsis
1266
1267@example
1268 -data-list-changed-registers
1269@end example
1270
1271Display a list of the registers that have changed.
1272
e7997b74 1273@subsubheading @value{GDBN} Command
7162c0ca 1274
e7997b74
EZ
1275@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk}
1276has the corresponding command @samp{gdb_changed_register_list}.
7162c0ca
EZ
1277
1278@subsubheading Example
1279
1280On a PPC MBX board:
1281
1282@smallexample
e7997b74 1283(@value{GDBP})
7162c0ca 1284-exec-continue
fb40c209
AC
1285^running
1286
e7997b74 1287(@value{GDBP})
fb40c209 1288*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main",
68c81b54 1289args=[],file="try.c",line="5"@}
e7997b74 1290(@value{GDBP})
fb40c209 1291-data-list-changed-registers
40d5d7e9 1292^done,changed-registers=["0","1","2","4","5","6","7","8","9",
fb40c209 1293"10","11","13","14","15","16","17","18","19","20","21","22","23",
40d5d7e9 1294"24","25","26","27","28","30","31","64","65","66","67","69"]
e7997b74 1295(@value{GDBP})
7162c0ca
EZ
1296@end smallexample
1297
1298
1299@subheading The @code{-data-list-register-names} Command
1300@findex -data-list-register-names
1301
1302@subsubheading Synopsis
1303
1304@example
1305 -data-list-register-names [ ( @var{regno} )+ ]
fb40c209
AC
1306@end example
1307
fb40c209
AC
1308Show a list of register names for the current target. If no arguments
1309are given, it shows a list of the names of all the registers. If
1310integer numbers are given as arguments, it will print a list of the
173d6894
AC
1311names of the registers corresponding to the arguments. To ensure
1312consistency between a register name and its number, the output list may
1313include empty register names.
7162c0ca 1314
e7997b74 1315@subsubheading @value{GDBN} Command
7162c0ca 1316
e7997b74 1317@value{GDBN} does not have a command which corresponds to
7162c0ca
EZ
1318@samp{-data-list-register-names}. In @code{gdbtk} there is a
1319corresponding command @samp{gdb_regnames}.
1320
1321@subsubheading Example
1322
fb40c209 1323For the PPC MBX board:
7162c0ca 1324@smallexample
e7997b74 1325(@value{GDBP})
fb40c209 1326-data-list-register-names
173d6894 1327^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
fb40c209
AC
1328"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
1329"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
1330"r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
1331"f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
1332"f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
173d6894 1333"", "pc","ps","cr","lr","ctr","xer"]
e7997b74 1334(@value{GDBP})
fb40c209 1335-data-list-register-names 1 2 3
173d6894 1336^done,register-names=["r1","r2","r3"]
e7997b74 1337(@value{GDBP})
7162c0ca 1338@end smallexample
fb40c209 1339
7162c0ca
EZ
1340@subheading The @code{-data-list-register-values} Command
1341@findex -data-list-register-values
1342
1343@subsubheading Synopsis
fb40c209 1344
fb40c209 1345@example
7162c0ca
EZ
1346 -data-list-register-values @var{fmt} [ ( @var{regno} )*]
1347@end example
1348
d68fc559
EZ
1349Display the registers' contents. @var{fmt} is the format according to
1350which the registers' contents are to be returned, followed by an optional
7162c0ca
EZ
1351list of numbers specifying the registers to display. A missing list of
1352numbers indicates that the contents of all the registers must be returned.
1353
1354Allowed formats for @var{fmt} are:
1355
1356@table @code
1357@item x
1358Hexadecimal
1359@item o
1360Octal
1361@item t
1362Binary
1363@item d
1364Decimal
1365@item r
1366Raw
1367@item N
1368Natural
1369@end table
1370
e7997b74 1371@subsubheading @value{GDBN} Command
7162c0ca 1372
e7997b74
EZ
1373The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info
1374all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
7162c0ca
EZ
1375
1376@subsubheading Example
1377
1378For a PPC MBX board (note: line breaks are for readability only, they
1379don't appear in the actual output):
1380
1381@smallexample
e7997b74 1382(@value{GDBP})
fb40c209 1383-data-list-register-values r 64 65
80f43b40
AC
1384^done,register-values=[@{number="64",value="0xfe00a300"@},
1385@{number="65",value="0x00029002"@}]
e7997b74 1386(@value{GDBP})
fb40c209 1387-data-list-register-values x
80f43b40 1388^done,register-values=[@{number="0",value="0xfe0043c8"@},
fb40c209
AC
1389@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@},
1390@{number="3",value="0x0"@},@{number="4",value="0xa"@},
1391@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@},
1392@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@},
1393@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@},
1394@{number="11",value="0x1"@},@{number="12",value="0x0"@},
1395@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@},
1396@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@},
1397@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@},
1398@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@},
1399@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@},
1400@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@},
1401@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@},
1402@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@},
1403@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@},
1404@{number="31",value="0x0"@},@{number="32",value="0x0"@},
1405@{number="33",value="0x0"@},@{number="34",value="0x0"@},
1406@{number="35",value="0x0"@},@{number="36",value="0x0"@},
1407@{number="37",value="0x0"@},@{number="38",value="0x0"@},
1408@{number="39",value="0x0"@},@{number="40",value="0x0"@},
1409@{number="41",value="0x0"@},@{number="42",value="0x0"@},
1410@{number="43",value="0x0"@},@{number="44",value="0x0"@},
1411@{number="45",value="0x0"@},@{number="46",value="0x0"@},
1412@{number="47",value="0x0"@},@{number="48",value="0x0"@},
1413@{number="49",value="0x0"@},@{number="50",value="0x0"@},
1414@{number="51",value="0x0"@},@{number="52",value="0x0"@},
1415@{number="53",value="0x0"@},@{number="54",value="0x0"@},
1416@{number="55",value="0x0"@},@{number="56",value="0x0"@},
1417@{number="57",value="0x0"@},@{number="58",value="0x0"@},
1418@{number="59",value="0x0"@},@{number="60",value="0x0"@},
1419@{number="61",value="0x0"@},@{number="62",value="0x0"@},
1420@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@},
1421@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@},
1422@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@},
80f43b40 1423@{number="69",value="0x20002b03"@}]
e7997b74 1424(@value{GDBP})
7162c0ca
EZ
1425@end smallexample
1426
1427
1428@subheading The @code{-data-read-memory} Command
1429@findex -data-read-memory
1430
1431@subsubheading Synopsis
1432
1433@example
1434 -data-read-memory [ -o @var{byte-offset} ]
1435 @var{address} @var{word-format} @var{word-size}
1436 @var{nr-rows} @var{nr-cols} [ @var{aschar} ]
fb40c209
AC
1437@end example
1438
7162c0ca
EZ
1439@noindent
1440where:
1441
fb40c209 1442@table @samp
7162c0ca 1443@item @var{address}
fb40c209
AC
1444An expression specifying the address of the first memory word to be
1445read. Complex expressions containing embedded white space should be
1446quoted using the C convention.
7162c0ca
EZ
1447
1448@item @var{word-format}
fb40c209 1449The format to be used to print the memory words. The notation is the
e7997b74
EZ
1450same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats,
1451,Output formats}).
7162c0ca
EZ
1452
1453@item @var{word-size}
fb40c209 1454The size of each memory word in bytes.
7162c0ca
EZ
1455
1456@item @var{nr-rows}
fb40c209 1457The number of rows in the output table.
7162c0ca
EZ
1458
1459@item @var{nr-cols}
fb40c209 1460The number of columns in the output table.
7162c0ca
EZ
1461
1462@item @var{aschar}
1463If present, indicates that each row should include an @sc{ascii} dump. The
1464value of @var{aschar} is used as a padding character when a byte is not a
1465member of the printable @sc{ascii} character set (printable @sc{ascii}
1466characters are those whose code is between 32 and 126, inclusively).
1467
1468@item @var{byte-offset}
1469An offset to add to the @var{address} before fetching memory.
fb40c209 1470@end table
7162c0ca
EZ
1471
1472This command displays memory contents as a table of @var{nr-rows} by
1473@var{nr-cols} words, each word being @var{word-size} bytes. In total,
1474@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read
080fe24b 1475(returned as @samp{total-bytes}). Should less than the requested number
7162c0ca 1476of bytes be returned by the target, the missing words are identified
d68fc559 1477using @samp{N/A}. The number of bytes read from the target is returned
7162c0ca
EZ
1478in @samp{nr-bytes} and the starting address used to read memory in
1479@samp{addr}.
fb40c209 1480
1c85fbd9 1481The address of the next/previous row or page is available in
7162c0ca
EZ
1482@samp{next-row} and @samp{prev-row}, @samp{next-page} and
1483@samp{prev-page}.
1484
e7997b74 1485@subsubheading @value{GDBN} Command
7162c0ca 1486
e7997b74
EZ
1487The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has
1488@samp{gdb_get_mem} memory read command.
7162c0ca
EZ
1489
1490@subsubheading Example
1491
fb40c209 1492Read six bytes of memory starting at @code{bytes+6} but then offset by
e7997b74 1493@code{-6} bytes. Format as three rows of two columns. One byte per
fb40c209 1494word. Display each word in hex.
7162c0ca
EZ
1495
1496@smallexample
e7997b74 1497(@value{GDBP})
fb40c209
AC
14989-data-read-memory -o -6 -- bytes+6 x 1 3 2
14999^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
1500next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
42a74a59
AC
1501prev-page="0x0000138a",memory=[
1502@{addr="0x00001390",data=["0x00","0x01"]@},
1503@{addr="0x00001392",data=["0x02","0x03"]@},
1504@{addr="0x00001394",data=["0x04","0x05"]@}]
e7997b74 1505(@value{GDBP})
7162c0ca
EZ
1506@end smallexample
1507
fb40c209
AC
1508Read two bytes of memory starting at address @code{shorts + 64} and
1509display as a single word formatted in decimal.
7162c0ca
EZ
1510
1511@smallexample
e7997b74 1512(@value{GDBP})
fb40c209
AC
15135-data-read-memory shorts+64 d 2 1 1
15145^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
1515next-row="0x00001512",prev-row="0x0000150e",
42a74a59
AC
1516next-page="0x00001512",prev-page="0x0000150e",memory=[
1517@{addr="0x00001510",data=["128"]@}]
e7997b74 1518(@value{GDBP})
7162c0ca
EZ
1519@end smallexample
1520
fb40c209 1521Read thirty two bytes of memory starting at @code{bytes+16} and format
1c85fbd9 1522as eight rows of four columns. Include a string encoding with @samp{x}
fb40c209 1523used as the non-printable character.
7162c0ca
EZ
1524
1525@smallexample
e7997b74 1526(@value{GDBP})
fb40c209
AC
15274-data-read-memory bytes+16 x 1 8 4 x
15284^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
1529next-row="0x000013c0",prev-row="0x0000139c",
42a74a59
AC
1530next-page="0x000013c0",prev-page="0x00001380",memory=[
1531@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@},
1532@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@},
1533@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@},
1534@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@},
1535@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@},
1536@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@},
1537@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@},
1538@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}]
e7997b74 1539(@value{GDBP})
7162c0ca
EZ
1540@end smallexample
1541
1542@subheading The @code{-display-delete} Command
1543@findex -display-delete
1544
1545@subsubheading Synopsis
1546
1547@example
1548 -display-delete @var{number}
fb40c209
AC
1549@end example
1550
7162c0ca
EZ
1551Delete the display @var{number}.
1552
e7997b74 1553@subsubheading @value{GDBN} Command
7162c0ca 1554
e7997b74 1555The corresponding @value{GDBN} command is @samp{delete display}.
7162c0ca
EZ
1556
1557@subsubheading Example
fb40c209
AC
1558N.A.
1559
7162c0ca
EZ
1560
1561@subheading The @code{-display-disable} Command
1562@findex -display-disable
1563
1564@subsubheading Synopsis
1565
1566@example
1567 -display-disable @var{number}
1568@end example
1569
1570Disable display @var{number}.
1571
e7997b74 1572@subsubheading @value{GDBN} Command
7162c0ca 1573
e7997b74 1574The corresponding @value{GDBN} command is @samp{disable display}.
7162c0ca
EZ
1575
1576@subsubheading Example
fb40c209
AC
1577N.A.
1578
7162c0ca
EZ
1579
1580@subheading The @code{-display-enable} Command
1581@findex -display-enable
1582
1583@subsubheading Synopsis
1584
1585@example
1586 -display-enable @var{number}
1587@end example
1588
1589Enable display @var{number}.
1590
e7997b74 1591@subsubheading @value{GDBN} Command
7162c0ca 1592
e7997b74 1593The corresponding @value{GDBN} command is @samp{enable display}.
7162c0ca
EZ
1594
1595@subsubheading Example
fb40c209
AC
1596N.A.
1597
7162c0ca
EZ
1598
1599@subheading The @code{-display-insert} Command
1600@findex -display-insert
1601
1602@subsubheading Synopsis
1603
1604@example
1605 -display-insert @var{expression}
1606@end example
1607
1608Display @var{expression} every time the program stops.
1609
e7997b74 1610@subsubheading @value{GDBN} Command
7162c0ca 1611
e7997b74 1612The corresponding @value{GDBN} command is @samp{display}.
7162c0ca
EZ
1613
1614@subsubheading Example
fb40c209
AC
1615N.A.
1616
7162c0ca
EZ
1617
1618@subheading The @code{-display-list} Command
1619@findex -display-list
1620
1621@subsubheading Synopsis
1622
1623@example
1624 -display-list
1625@end example
1626
1627List the displays. Do not show the current values.
1628
e7997b74 1629@subsubheading @value{GDBN} Command
7162c0ca 1630
e7997b74 1631The corresponding @value{GDBN} command is @samp{info display}.
7162c0ca
EZ
1632
1633@subsubheading Example
fb40c209
AC
1634N.A.
1635
7162c0ca
EZ
1636
1637@subheading The @code{-environment-cd} Command
1638@findex -environment-cd
1639
1640@subsubheading Synopsis
1641
fb40c209 1642@example
7162c0ca
EZ
1643 -environment-cd @var{pathdir}
1644@end example
1645
e7997b74 1646Set @value{GDBN}'s working directory.
7162c0ca 1647
e7997b74 1648@subsubheading @value{GDBN} Command
7162c0ca 1649
e7997b74 1650The corresponding @value{GDBN} command is @samp{cd}.
7162c0ca
EZ
1651
1652@subsubheading Example
1653
1654@smallexample
e7997b74 1655(@value{GDBP})
fb40c209
AC
1656-environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
1657^done
e7997b74 1658(@value{GDBP})
7162c0ca
EZ
1659@end smallexample
1660
1661
1662@subheading The @code{-environment-directory} Command
1663@findex -environment-directory
1664
1665@subsubheading Synopsis
fb40c209 1666
fb40c209 1667@example
068890be 1668 -environment-directory [ -r ] [ @var{pathdir} ]+
7162c0ca
EZ
1669@end example
1670
068890be
JJ
1671Add directories @var{pathdir} to beginning of search path for source files.
1672If the @samp{-r} option is used, the search path is reset to the default
1673search path. If directories @var{pathdir} are supplied in addition to the
1674@samp{-r} option, the search path is first reset and then addition
1675occurs as normal.
1676Multiple directories may be specified, separated by blanks. Specifying
1677multiple directories in a single command
1678results in the directories added to the beginning of the
1679search path in the same order they were presented in the command.
1680If blanks are needed as
1681part of a directory name, double-quotes should be used around
1682the name. In the command output, the path will show up separated
1683by the system directory-separator character. The directory-seperator
1684character must not be used
1685in any directory name.
1686If no directories are specified, the current search path is displayed.
7162c0ca 1687
e7997b74 1688@subsubheading @value{GDBN} Command
7162c0ca 1689
e7997b74 1690The corresponding @value{GDBN} command is @samp{dir}.
7162c0ca
EZ
1691
1692@subsubheading Example
1693
1694@smallexample
e7997b74 1695(@value{GDBP})
fb40c209 1696-environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
068890be
JJ
1697^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
1698(@value{GDBP})
1699-environment-directory ""
1700^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
1701(@value{GDBP})
1702-environment-directory -r /home/jjohnstn/src/gdb /usr/src
1703^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
1704(@value{GDBP})
1705-environment-directory -r
1706^done,source-path="$cdir:$cwd"
e7997b74 1707(@value{GDBP})
7162c0ca
EZ
1708@end smallexample
1709
1710
1711@subheading The @code{-environment-path} Command
1712@findex -environment-path
1713
1714@subsubheading Synopsis
fb40c209 1715
fb40c209 1716@example
068890be 1717 -environment-path [ -r ] [ @var{pathdir} ]+
7162c0ca
EZ
1718@end example
1719
1c85fbd9 1720Add directories @var{pathdir} to beginning of search path for object files.
068890be
JJ
1721If the @samp{-r} option is used, the search path is reset to the original
1722search path that existed at gdb start-up. If directories @var{pathdir} are
1723supplied in addition to the
1724@samp{-r} option, the search path is first reset and then addition
1725occurs as normal.
1726Multiple directories may be specified, separated by blanks. Specifying
1727multiple directories in a single command
1728results in the directories added to the beginning of the
1729search path in the same order they were presented in the command.
1730If blanks are needed as
1731part of a directory name, double-quotes should be used around
1732the name. In the command output, the path will show up separated
1733by the system directory-separator character. The directory-seperator
1734character must not be used
1735in any directory name.
1736If no directories are specified, the current path is displayed.
1737
7162c0ca 1738
e7997b74 1739@subsubheading @value{GDBN} Command
7162c0ca 1740
e7997b74 1741The corresponding @value{GDBN} command is @samp{path}.
7162c0ca
EZ
1742
1743@subsubheading Example
1744
1745@smallexample
e7997b74 1746(@value{GDBP})
068890be
JJ
1747-environment-path
1748^done,path="/usr/bin"
1749(@value{GDBP})
1750-environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
1751^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
1752(@value{GDBP})
1753-environment-path -r /usr/local/bin
1754^done,path="/usr/local/bin:/usr/bin"
e7997b74 1755(@value{GDBP})
7162c0ca
EZ
1756@end smallexample
1757
1758
1759@subheading The @code{-environment-pwd} Command
1760@findex -environment-pwd
1761
1762@subsubheading Synopsis
fb40c209 1763
fb40c209 1764@example
7162c0ca
EZ
1765 -environment-pwd
1766@end example
1767
1768Show the current working directory.
1769
e7997b74 1770@subsubheading @value{GDBN} command
7162c0ca 1771
e7997b74 1772The corresponding @value{GDBN} command is @samp{pwd}.
7162c0ca
EZ
1773
1774@subsubheading Example
1775
1776@smallexample
e7997b74 1777(@value{GDBP})
fb40c209 1778-environment-pwd
068890be 1779^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
e7997b74 1780(@value{GDBP})
7162c0ca 1781@end smallexample
fb40c209 1782
7162c0ca
EZ
1783@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1784@node GDB/MI Program Control
1785@section @sc{gdb/mi} Program control
1786
1787@subsubheading Program termination
fb40c209 1788
fb40c209 1789As a result of execution, the inferior program can run to completion, if
e7997b74 1790it doesn't encounter any breakpoints. In this case the output will
fb40c209 1791include an exit code, if the program has exited exceptionally.
7162c0ca 1792
1c85fbd9 1793@subsubheading Examples
7162c0ca
EZ
1794
1795@noindent
fb40c209 1796Program exited normally:
7162c0ca
EZ
1797
1798@smallexample
e7997b74 1799(@value{GDBP})
fb40c209
AC
1800-exec-run
1801^running
e7997b74 1802(@value{GDBP})
fb40c209
AC
1803x = 55
1804*stopped,reason="exited-normally"
e7997b74 1805(@value{GDBP})
7162c0ca 1806@end smallexample
fb40c209 1807
7162c0ca 1808@noindent
fb40c209 1809Program exited exceptionally:
7162c0ca
EZ
1810
1811@smallexample
e7997b74 1812(@value{GDBP})
fb40c209
AC
1813-exec-run
1814^running
e7997b74 1815(@value{GDBP})
fb40c209
AC
1816x = 55
1817*stopped,reason="exited",exit-code="01"
e7997b74 1818(@value{GDBP})
7162c0ca
EZ
1819@end smallexample
1820
1821Another way the program can terminate is if it receives a signal such as
1822@code{SIGINT}. In this case, @sc{gdb/mi} displays this:
1823
1824@smallexample
e7997b74 1825(@value{GDBP})
7162c0ca
EZ
1826*stopped,reason="exited-signalled",signal-name="SIGINT",
1827signal-meaning="Interrupt"
1828@end smallexample
1829
1830
1831@subheading The @code{-exec-abort} Command
1832@findex -exec-abort
1833
1834@subsubheading Synopsis
fb40c209 1835
fb40c209 1836@example
7162c0ca 1837 -exec-abort
fb40c209
AC
1838@end example
1839
fb40c209
AC
1840Kill the inferior running program.
1841
e7997b74 1842@subsubheading @value{GDBN} Command
7162c0ca 1843
e7997b74 1844The corresponding @value{GDBN} command is @samp{kill}.
fb40c209 1845
7162c0ca 1846@subsubheading Example
fb40c209
AC
1847N.A.
1848
fb40c209 1849
7162c0ca
EZ
1850@subheading The @code{-exec-arguments} Command
1851@findex -exec-arguments
fb40c209 1852
7162c0ca
EZ
1853@subsubheading Synopsis
1854
1855@example
1856 -exec-arguments @var{args}
1857@end example
1858
1859Set the inferior program arguments, to be used in the next
1860@samp{-exec-run}.
1861
e7997b74 1862@subsubheading @value{GDBN} Command
7162c0ca 1863
e7997b74 1864The corresponding @value{GDBN} command is @samp{set args}.
7162c0ca
EZ
1865
1866@subsubheading Example
1867
1868@c FIXME!
1869Don't have one around.
fb40c209 1870
fb40c209 1871
7162c0ca
EZ
1872@subheading The @code{-exec-continue} Command
1873@findex -exec-continue
1874
1875@subsubheading Synopsis
fb40c209 1876
fb40c209 1877@example
7162c0ca
EZ
1878 -exec-continue
1879@end example
1880
1881Asynchronous command. Resumes the execution of the inferior program
1882until a breakpoint is encountered, or until the inferior exits.
1883
e7997b74 1884@subsubheading @value{GDBN} Command
7162c0ca 1885
e7997b74 1886The corresponding @value{GDBN} corresponding is @samp{continue}.
7162c0ca
EZ
1887
1888@subsubheading Example
1889
1890@smallexample
fb40c209
AC
1891-exec-continue
1892^running
e7997b74 1893(@value{GDBP})
fb40c209 1894@@Hello world
68c81b54 1895*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[],
fb40c209 1896file="hello.c",line="13"@}
e7997b74 1897(@value{GDBP})
7162c0ca
EZ
1898@end smallexample
1899
fb40c209 1900
7162c0ca
EZ
1901@subheading The @code{-exec-finish} Command
1902@findex -exec-finish
fb40c209 1903
7162c0ca 1904@subsubheading Synopsis
fb40c209 1905
fb40c209 1906@example
7162c0ca
EZ
1907 -exec-finish
1908@end example
1909
1910Asynchronous command. Resumes the execution of the inferior program
1911until the current function is exited. Displays the results returned by
1912the function.
1913
e7997b74 1914@subsubheading @value{GDBN} Command
7162c0ca 1915
e7997b74 1916The corresponding @value{GDBN} command is @samp{finish}.
7162c0ca
EZ
1917
1918@subsubheading Example
1919
1920Function returning @code{void}.
1921
1922@smallexample
fb40c209
AC
1923-exec-finish
1924^running
e7997b74 1925(@value{GDBP})
fb40c209 1926@@hello from foo
68c81b54 1927*stopped,reason="function-finished",frame=@{func="main",args=[],
fb40c209 1928file="hello.c",line="7"@}
e7997b74 1929(@value{GDBP})
7162c0ca
EZ
1930@end smallexample
1931
e7997b74
EZ
1932Function returning other than @code{void}. The name of the internal
1933@value{GDBN} variable storing the result is printed, together with the
1934value itself.
7162c0ca
EZ
1935
1936@smallexample
fb40c209
AC
1937-exec-finish
1938^running
e7997b74 1939(@value{GDBP})
fb40c209 1940*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
68c81b54 1941args=[@{name="a",value="1"],@{name="b",value="9"@}@},
7162c0ca 1942file="recursive2.c",line="14"@},
fb40c209 1943gdb-result-var="$1",return-value="0"
e7997b74 1944(@value{GDBP})
7162c0ca
EZ
1945@end smallexample
1946
1947
1948@subheading The @code{-exec-interrupt} Command
1949@findex -exec-interrupt
1950
1951@subsubheading Synopsis
fb40c209 1952
7162c0ca
EZ
1953@example
1954 -exec-interrupt
fb40c209 1955@end example
7162c0ca 1956
e7997b74 1957Asynchronous command. Interrupts the background execution of the target.
fb40c209 1958Note how the token associated with the stop message is the one for the
7162c0ca 1959execution command that has been interrupted. The token for the interrupt
e7997b74 1960itself only appears in the @samp{^done} output. If the user is trying to
7162c0ca 1961interrupt a non-running program, an error message will be printed.
fb40c209 1962
e7997b74 1963@subsubheading @value{GDBN} Command
7162c0ca 1964
e7997b74 1965The corresponding @value{GDBN} command is @samp{interrupt}.
7162c0ca
EZ
1966
1967@subsubheading Example
1968
1969@smallexample
e7997b74 1970(@value{GDBP})
fb40c209
AC
1971111-exec-continue
1972111^running
1973
e7997b74 1974(@value{GDBP})
fb40c209
AC
1975222-exec-interrupt
1976222^done
e7997b74 1977(@value{GDBP})
fb40c209 1978111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
dc61bc6d 1979frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@}
e7997b74 1980(@value{GDBP})
fb40c209 1981
e7997b74 1982(@value{GDBP})
fb40c209
AC
1983-exec-interrupt
1984^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
e7997b74 1985(@value{GDBP})
7162c0ca 1986@end smallexample
fb40c209 1987
7162c0ca
EZ
1988
1989@subheading The @code{-exec-next} Command
1990@findex -exec-next
1991
1992@subsubheading Synopsis
1993
1994@example
1995 -exec-next
fb40c209
AC
1996@end example
1997
7162c0ca 1998Asynchronous command. Resumes execution of the inferior program, stopping
fb40c209
AC
1999when the beginning of the next source line is reached.
2000
e7997b74 2001@subsubheading @value{GDBN} Command
fb40c209 2002
e7997b74 2003The corresponding @value{GDBN} command is @samp{next}.
7162c0ca
EZ
2004
2005@subsubheading Example
2006
2007@smallexample
fb40c209
AC
2008-exec-next
2009^running
e7997b74 2010(@value{GDBP})
fb40c209 2011*stopped,reason="end-stepping-range",line="8",file="hello.c"
e7997b74 2012(@value{GDBP})
7162c0ca
EZ
2013@end smallexample
2014
2015
2016@subheading The @code{-exec-next-instruction} Command
2017@findex -exec-next-instruction
2018
2019@subsubheading Synopsis
2020
2021@example
2022 -exec-next-instruction
fb40c209
AC
2023@end example
2024
7162c0ca 2025Asynchronous command. Executes one machine instruction. If the
fb40c209
AC
2026instruction is a function call continues until the function returns. If
2027the program stops at an instruction in the middle of a source line, the
2028address will be printed as well.
fb40c209 2029
e7997b74 2030@subsubheading @value{GDBN} Command
7162c0ca 2031
e7997b74 2032The corresponding @value{GDBN} command is @samp{nexti}.
7162c0ca
EZ
2033
2034@subsubheading Example
2035
2036@smallexample
e7997b74 2037(@value{GDBP})
7162c0ca 2038-exec-next-instruction
fb40c209
AC
2039^running
2040
e7997b74 2041(@value{GDBP})
fb40c209
AC
2042*stopped,reason="end-stepping-range",
2043addr="0x000100d4",line="5",file="hello.c"
e7997b74 2044(@value{GDBP})
7162c0ca
EZ
2045@end smallexample
2046
fb40c209 2047
7162c0ca
EZ
2048@subheading The @code{-exec-return} Command
2049@findex -exec-return
fb40c209 2050
7162c0ca 2051@subsubheading Synopsis
fb40c209 2052
fb40c209 2053@example
7162c0ca
EZ
2054 -exec-return
2055@end example
2056
2057Makes current function return immediately. Doesn't execute the inferior.
2058Displays the new current frame.
2059
e7997b74 2060@subsubheading @value{GDBN} Command
7162c0ca 2061
e7997b74 2062The corresponding @value{GDBN} command is @samp{return}.
7162c0ca
EZ
2063
2064@subsubheading Example
2065
2066@smallexample
e7997b74 2067(@value{GDBP})
fb40c209
AC
2068200-break-insert callee4
2069200^done,bkpt=@{number="1",addr="0x00010734",
2070file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
e7997b74 2071(@value{GDBP})
7162c0ca 2072000-exec-run
fb40c209 2073000^running
e7997b74 2074(@value{GDBP})
fb40c209 2075000*stopped,reason="breakpoint-hit",bkptno="1",
68c81b54 2076frame=@{func="callee4",args=[],
fb40c209 2077file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
e7997b74 2078(@value{GDBP})
fb40c209
AC
2079205-break-delete
2080205^done
e7997b74 2081(@value{GDBP})
fb40c209 2082111-exec-return
9f2aab2d 2083111^done,frame=@{level="0",func="callee3",
68c81b54
AC
2084args=[@{name="strarg",
2085value="0x11940 \"A string argument.\""@}],
fb40c209 2086file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
e7997b74 2087(@value{GDBP})
7162c0ca
EZ
2088@end smallexample
2089
2090
2091@subheading The @code{-exec-run} Command
2092@findex -exec-run
2093
2094@subsubheading Synopsis
2095
2096@example
2097 -exec-run
fb40c209
AC
2098@end example
2099
7162c0ca
EZ
2100Asynchronous command. Starts execution of the inferior from the
2101beginning. The inferior executes until either a breakpoint is
fb40c209
AC
2102encountered or the program exits.
2103
e7997b74 2104@subsubheading @value{GDBN} Command
fb40c209 2105
e7997b74 2106The corresponding @value{GDBN} command is @samp{run}.
7162c0ca
EZ
2107
2108@subsubheading Example
2109
2110@smallexample
e7997b74 2111(@value{GDBP})
fb40c209
AC
2112-break-insert main
2113^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
e7997b74 2114(@value{GDBP})
fb40c209
AC
2115-exec-run
2116^running
e7997b74 2117(@value{GDBP})
fb40c209 2118*stopped,reason="breakpoint-hit",bkptno="1",
68c81b54 2119frame=@{func="main",args=[],file="recursive2.c",line="4"@}
e7997b74 2120(@value{GDBP})
7162c0ca
EZ
2121@end smallexample
2122
fb40c209 2123
7162c0ca
EZ
2124@subheading The @code{-exec-show-arguments} Command
2125@findex -exec-show-arguments
2126
2127@subsubheading Synopsis
2128
2129@example
2130 -exec-show-arguments
2131@end example
fb40c209 2132
fb40c209 2133Print the arguments of the program.
7162c0ca 2134
e7997b74 2135@subsubheading @value{GDBN} Command
7162c0ca 2136
e7997b74 2137The corresponding @value{GDBN} command is @samp{show args}.
7162c0ca
EZ
2138
2139@subsubheading Example
fb40c209
AC
2140N.A.
2141
7162c0ca
EZ
2142@c @subheading -exec-signal
2143
2144@subheading The @code{-exec-step} Command
2145@findex -exec-step
2146
2147@subsubheading Synopsis
fb40c209 2148
7162c0ca
EZ
2149@example
2150 -exec-step
2151@end example
2152
2153Asynchronous command. Resumes execution of the inferior program, stopping
fb40c209 2154when the beginning of the next source line is reached, if the next
7162c0ca 2155source line is not a function call. If it is, stop at the first
fb40c209
AC
2156instruction of the called function.
2157
e7997b74 2158@subsubheading @value{GDBN} Command
7162c0ca 2159
e7997b74 2160The corresponding @value{GDBN} command is @samp{step}.
7162c0ca
EZ
2161
2162@subsubheading Example
fb40c209 2163
fb40c209 2164Stepping into a function:
7162c0ca
EZ
2165
2166@smallexample
fb40c209
AC
2167-exec-step
2168^running
e7997b74 2169(@value{GDBP})
7162c0ca 2170*stopped,reason="end-stepping-range",
68c81b54
AC
2171frame=@{func="foo",args=[@{name="a",value="10"@},
2172@{name="b",value="0"@}],file="recursive2.c",line="11"@}
e7997b74 2173(@value{GDBP})
7162c0ca
EZ
2174@end smallexample
2175
2176Regular stepping:
2177
2178@smallexample
fb40c209
AC
2179-exec-step
2180^running
e7997b74 2181(@value{GDBP})
fb40c209 2182*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
e7997b74 2183(@value{GDBP})
7162c0ca
EZ
2184@end smallexample
2185
2186
2187@subheading The @code{-exec-step-instruction} Command
2188@findex -exec-step-instruction
2189
2190@subsubheading Synopsis
2191
2192@example
2193 -exec-step-instruction
fb40c209
AC
2194@end example
2195
7162c0ca 2196Asynchronous command. Resumes the inferior which executes one machine
e7997b74 2197instruction. The output, once @value{GDBN} has stopped, will vary depending on
502d24d4
EZ
2198whether we have stopped in the middle of a source line or not. In the
2199former case, the address at which the program stopped will be printed as
2200well.
fb40c209 2201
e7997b74 2202@subsubheading @value{GDBN} Command
fb40c209 2203
e7997b74 2204The corresponding @value{GDBN} command is @samp{stepi}.
7162c0ca
EZ
2205
2206@subsubheading Example
2207
2208@smallexample
e7997b74 2209(@value{GDBP})
fb40c209
AC
2210-exec-step-instruction
2211^running
2212
e7997b74 2213(@value{GDBP})
fb40c209 2214*stopped,reason="end-stepping-range",
68c81b54 2215frame=@{func="foo",args=[],file="try.c",line="10"@}
e7997b74 2216(@value{GDBP})
fb40c209
AC
2217-exec-step-instruction
2218^running
2219
e7997b74 2220(@value{GDBP})
fb40c209 2221*stopped,reason="end-stepping-range",
68c81b54 2222frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@}
e7997b74 2223(@value{GDBP})
7162c0ca
EZ
2224@end smallexample
2225
2226
2227@subheading The @code{-exec-until} Command
2228@findex -exec-until
2229
2230@subsubheading Synopsis
2231
2232@example
2233 -exec-until [ @var{location} ]
fb40c209
AC
2234@end example
2235
7162c0ca
EZ
2236Asynchronous command. Executes the inferior until the @var{location}
2237specified in the argument is reached. If there is no argument, the inferior
fb40c209 2238executes until a source line greater than the current one is reached.
1c85fbd9 2239The reason for stopping in this case will be @samp{location-reached}.
fb40c209 2240
e7997b74 2241@subsubheading @value{GDBN} Command
7162c0ca 2242
e7997b74 2243The corresponding @value{GDBN} command is @samp{until}.
7162c0ca
EZ
2244
2245@subsubheading Example
2246
2247@smallexample
e7997b74 2248(@value{GDBP})
fb40c209
AC
2249-exec-until recursive2.c:6
2250^running
e7997b74 2251(@value{GDBP})
fb40c209 2252x = 55
68c81b54 2253*stopped,reason="location-reached",frame=@{func="main",args=[],
fb40c209 2254file="recursive2.c",line="6"@}
e7997b74 2255(@value{GDBP})
7162c0ca 2256@end smallexample
fb40c209 2257
7162c0ca
EZ
2258@ignore
2259@subheading -file-clear
fb40c209 2260Is this going away????
7162c0ca
EZ
2261@end ignore
2262
fb40c209 2263
7162c0ca
EZ
2264@subheading The @code{-file-exec-and-symbols} Command
2265@findex -file-exec-and-symbols
2266
2267@subsubheading Synopsis
fb40c209 2268
fb40c209 2269@example
7162c0ca
EZ
2270 -file-exec-and-symbols @var{file}
2271@end example
2272
2273Specify the executable file to be debugged. This file is the one from
2274which the symbol table is also read. If no file is specified, the
2275command clears the executable and symbol information. If breakpoints
e7997b74 2276are set when using this command with no arguments, @value{GDBN} will produce
d68fc559 2277error messages. Otherwise, no output is produced, except a completion
7162c0ca
EZ
2278notification.
2279
e7997b74 2280@subsubheading @value{GDBN} Command
7162c0ca 2281
e7997b74 2282The corresponding @value{GDBN} command is @samp{file}.
7162c0ca
EZ
2283
2284@subsubheading Example
2285
2286@smallexample
e7997b74 2287(@value{GDBP})
fb40c209
AC
2288-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2289^done
e7997b74 2290(@value{GDBP})
7162c0ca
EZ
2291@end smallexample
2292
2293
2294@subheading The @code{-file-exec-file} Command
2295@findex -file-exec-file
2296
2297@subsubheading Synopsis
2298
2299@example
2300 -file-exec-file @var{file}
fb40c209
AC
2301@end example
2302
7162c0ca
EZ
2303Specify the executable file to be debugged. Unlike
2304@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
e7997b74 2305from this file. If used without argument, @value{GDBN} clears the information
fb40c209
AC
2306about the executable file. No output is produced, except a completion
2307notification.
fb40c209 2308
e7997b74 2309@subsubheading @value{GDBN} Command
7162c0ca 2310
e7997b74 2311The corresponding @value{GDBN} command is @samp{exec-file}.
7162c0ca
EZ
2312
2313@subsubheading Example
2314
2315@smallexample
e7997b74 2316(@value{GDBP})
fb40c209
AC
2317-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2318^done
e7997b74 2319(@value{GDBP})
7162c0ca
EZ
2320@end smallexample
2321
2322
2323@subheading The @code{-file-list-exec-sections} Command
2324@findex -file-list-exec-sections
2325
2326@subsubheading Synopsis
2327
2328@example
2329 -file-list-exec-sections
fb40c209
AC
2330@end example
2331
fb40c209 2332List the sections of the current executable file.
7162c0ca 2333
e7997b74 2334@subsubheading @value{GDBN} Command
7162c0ca 2335
e7997b74 2336The @value{GDBN} command @samp{info file} shows, among the rest, the same
7162c0ca
EZ
2337information as this command. @code{gdbtk} has a corresponding command
2338@samp{gdb_load_info}.
2339
2340@subsubheading Example
fb40c209
AC
2341N.A.
2342
7162c0ca
EZ
2343
2344@subheading The @code{-file-list-exec-source-files} Command
2345@findex -file-list-exec-source-files
2346
2347@subsubheading Synopsis
2348
2349@example
2350 -file-list-exec-source-files
2351@end example
2352
fb40c209 2353List the source files for the current executable.
7162c0ca 2354
e7997b74 2355@subsubheading @value{GDBN} Command
7162c0ca 2356
e7997b74 2357There's no @value{GDBN} command which directly corresponds to this one.
7162c0ca
EZ
2358@code{gdbtk} has an analogous command @samp{gdb_listfiles}.
2359
2360@subsubheading Example
fb40c209
AC
2361N.A.
2362
7162c0ca
EZ
2363
2364@subheading The @code{-file-list-shared-libraries} Command
2365@findex -file-list-shared-libraries
2366
2367@subsubheading Synopsis
2368
2369@example
2370 -file-list-shared-libraries
2371@end example
2372
fb40c209 2373List the shared libraries in the program.
7162c0ca 2374
e7997b74 2375@subsubheading @value{GDBN} Command
7162c0ca 2376
e7997b74 2377The corresponding @value{GDBN} command is @samp{info shared}.
7162c0ca
EZ
2378
2379@subsubheading Example
fb40c209
AC
2380N.A.
2381
7162c0ca
EZ
2382
2383@subheading The @code{-file-list-symbol-files} Command
2384@findex -file-list-symbol-files
2385
2386@subsubheading Synopsis
2387
2388@example
2389 -file-list-symbol-files
2390@end example
2391
fb40c209 2392List symbol files.
7162c0ca 2393
e7997b74 2394@subsubheading @value{GDBN} Command
7162c0ca 2395
e7997b74 2396The corresponding @value{GDBN} command is @samp{info file} (part of it).
7162c0ca
EZ
2397
2398@subsubheading Example
fb40c209
AC
2399N.A.
2400
fb40c209 2401
7162c0ca
EZ
2402@subheading The @code{-file-symbol-file} Command
2403@findex -file-symbol-file
2404
2405@subsubheading Synopsis
2406
fb40c209 2407@example
7162c0ca
EZ
2408 -file-symbol-file @var{file}
2409@end example
2410
2411Read symbol table info from the specified @var{file} argument. When
e7997b74 2412used without arguments, clears @value{GDBN}'s symbol table info. No output is
7162c0ca
EZ
2413produced, except for a completion notification.
2414
e7997b74 2415@subsubheading @value{GDBN} Command
7162c0ca 2416
e7997b74 2417The corresponding @value{GDBN} command is @samp{symbol-file}.
7162c0ca
EZ
2418
2419@subsubheading Example
2420
2421@smallexample
e7997b74 2422(@value{GDBP})
fb40c209
AC
2423-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2424^done
e7997b74 2425(@value{GDBP})
7162c0ca 2426@end smallexample
fb40c209 2427
7162c0ca 2428@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d68fc559 2429@node GDB/MI Miscellaneous Commands
e7997b74 2430@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
fb40c209 2431
7162c0ca 2432@c @subheading -gdb-complete
fb40c209 2433
7162c0ca
EZ
2434@subheading The @code{-gdb-exit} Command
2435@findex -gdb-exit
fb40c209 2436
7162c0ca 2437@subsubheading Synopsis
fb40c209 2438
fb40c209 2439@example
7162c0ca
EZ
2440 -gdb-exit
2441@end example
2442
e7997b74 2443Exit @value{GDBN} immediately.
7162c0ca 2444
e7997b74 2445@subsubheading @value{GDBN} Command
7162c0ca
EZ
2446
2447Approximately corresponds to @samp{quit}.
2448
2449@subsubheading Example
2450
2451@smallexample
e7997b74 2452(@value{GDBP})
fb40c209 2453-gdb-exit
7162c0ca
EZ
2454@end smallexample
2455
2456@subheading The @code{-gdb-set} Command
2457@findex -gdb-set
2458
2459@subsubheading Synopsis
2460
2461@example
2462 -gdb-set
fb40c209
AC
2463@end example
2464
e7997b74 2465Set an internal @value{GDBN} variable.
7162c0ca 2466@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
fb40c209 2467
e7997b74 2468@subsubheading @value{GDBN} Command
fb40c209 2469
e7997b74 2470The corresponding @value{GDBN} command is @samp{set}.
7162c0ca
EZ
2471
2472@subsubheading Example
2473
2474@smallexample
e7997b74 2475(@value{GDBP})
fb40c209
AC
2476-gdb-set $foo=3
2477^done
e7997b74 2478(@value{GDBP})
7162c0ca
EZ
2479@end smallexample
2480
2481
2482@subheading The @code{-gdb-show} Command
2483@findex -gdb-show
2484
2485@subsubheading Synopsis
2486
2487@example
2488 -gdb-show
fb40c209
AC
2489@end example
2490
e7997b74 2491Show the current value of a @value{GDBN} variable.
fb40c209 2492
e7997b74 2493@subsubheading @value{GDBN} command
fb40c209 2494
e7997b74 2495The corresponding @value{GDBN} command is @samp{show}.
7162c0ca
EZ
2496
2497@subsubheading Example
2498
2499@smallexample
e7997b74 2500(@value{GDBP})
fb40c209
AC
2501-gdb-show annotate
2502^done,value="0"
e7997b74 2503(@value{GDBP})
7162c0ca 2504@end smallexample
fb40c209 2505
7162c0ca 2506@c @subheading -gdb-source
fb40c209 2507
fb40c209 2508
7162c0ca
EZ
2509@subheading The @code{-gdb-version} Command
2510@findex -gdb-version
2511
2512@subsubheading Synopsis
fb40c209 2513
fb40c209 2514@example
7162c0ca
EZ
2515 -gdb-version
2516@end example
2517
e7997b74 2518Show version information for @value{GDBN}. Used mostly in testing.
7162c0ca 2519
e7997b74 2520@subsubheading @value{GDBN} Command
7162c0ca 2521
e7997b74 2522There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this
7162c0ca
EZ
2523information when you start an interactive session.
2524
2525@subsubheading Example
2526
2527@c This example modifies the actual output from GDB to avoid overfull
2528@c box in TeX.
2529@smallexample
e7997b74 2530(@value{GDBP})
fb40c209 2531-gdb-version
7162c0ca
EZ
2532~GNU gdb 5.2.1
2533~Copyright 2000 Free Software Foundation, Inc.
2534~GDB is free software, covered by the GNU General Public License, and
2535~you are welcome to change it and/or distribute copies of it under
2536~ certain conditions.
fb40c209 2537~Type "show copying" to see the conditions.
7162c0ca
EZ
2538~There is absolutely no warranty for GDB. Type "show warranty" for
2539~ details.
2540~This GDB was configured as
2541 "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
fb40c209 2542^done
e7997b74 2543(@value{GDBP})
7162c0ca 2544@end smallexample
fb40c209 2545
eca48b00
AC
2546@subheading The @code{-interpreter-exec} Command
2547@findex -interpreter-exec
2548
2549@subheading Synopsis
2550
2551@smallexample
2552-interpreter-exec @var{interpreter} @var{command}
2553@end smallexample
2554
2555Execute the specified @var{command} in the given @var{interpreter}.
2556
2557@subheading @value{GDBN} Command
2558
2559The corresponding @value{GDBN} command is @samp{interpreter-exec}.
2560
2561@subheading Example
2562
2563@smallexample
2564(@value{GDBP})
2565-interpreter-exec console "break main"
2566&"During symbol reading, couldn't parse type; debugger out of date?.\n"
2567&"During symbol reading, bad structure-type format.\n"
2568~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
2569^done
2570(@value{GDBP})
2571@end smallexample
2572
7162c0ca
EZ
2573@ignore
2574@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2575@node GDB/MI Kod Commands
2576@section @sc{gdb/mi} Kod Commands
fb40c209
AC
2577
2578The Kod commands are not implemented.
2579
7162c0ca 2580@c @subheading -kod-info
fb40c209 2581
7162c0ca 2582@c @subheading -kod-list
fb40c209 2583
7162c0ca 2584@c @subheading -kod-list-object-types
fb40c209 2585
7162c0ca 2586@c @subheading -kod-show
fb40c209 2587
7162c0ca
EZ
2588@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2589@node GDB/MI Memory Overlay Commands
2590@section @sc{gdb/mi} Memory Overlay Commands
fb40c209 2591
7162c0ca 2592The memory overlay commands are not implemented.
fb40c209 2593
7162c0ca 2594@c @subheading -overlay-auto
fb40c209 2595
7162c0ca 2596@c @subheading -overlay-list-mapping-state
fb40c209 2597
7162c0ca 2598@c @subheading -overlay-list-overlays
fb40c209 2599
7162c0ca 2600@c @subheading -overlay-map
fb40c209 2601
7162c0ca 2602@c @subheading -overlay-off
fb40c209 2603
7162c0ca 2604@c @subheading -overlay-on
fb40c209 2605
7162c0ca 2606@c @subheading -overlay-unmap
fb40c209 2607
7162c0ca
EZ
2608@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2609@node GDB/MI Signal Handling Commands
2610@section @sc{gdb/mi} Signal Handling Commands
fb40c209
AC
2611
2612Signal handling commands are not implemented.
2613
7162c0ca 2614@c @subheading -signal-handle
fb40c209 2615
7162c0ca 2616@c @subheading -signal-list-handle-actions
fb40c209 2617
7162c0ca
EZ
2618@c @subheading -signal-list-signal-types
2619@end ignore
fb40c209 2620
fb40c209 2621
7162c0ca
EZ
2622@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2623@node GDB/MI Stack Manipulation
d5e5643b 2624@section @sc{gdb/mi} Stack Manipulation Commands
7162c0ca
EZ
2625
2626
2627@subheading The @code{-stack-info-frame} Command
2628@findex -stack-info-frame
2629
2630@subsubheading Synopsis
2631
2632@example
2633 -stack-info-frame
2634@end example
2635
fb40c209 2636Get info on the current frame.
7162c0ca 2637
e7997b74 2638@subsubheading @value{GDBN} Command
7162c0ca 2639
e7997b74 2640The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
7162c0ca
EZ
2641(without arguments).
2642
2643@subsubheading Example
fb40c209
AC
2644N.A.
2645
7162c0ca
EZ
2646@subheading The @code{-stack-info-depth} Command
2647@findex -stack-info-depth
2648
2649@subsubheading Synopsis
2650
fb40c209 2651@example
7162c0ca
EZ
2652 -stack-info-depth [ @var{max-depth} ]
2653@end example
2654
2655Return the depth of the stack. If the integer argument @var{max-depth}
2656is specified, do not count beyond @var{max-depth} frames.
2657
e7997b74 2658@subsubheading @value{GDBN} Command
7162c0ca 2659
e7997b74 2660There's no equivalent @value{GDBN} command.
7162c0ca
EZ
2661
2662@subsubheading Example
2663
2664For a stack with frame levels 0 through 11:
2665
2666@smallexample
e7997b74 2667(@value{GDBP})
fb40c209
AC
2668-stack-info-depth
2669^done,depth="12"
e7997b74 2670(@value{GDBP})
fb40c209
AC
2671-stack-info-depth 4
2672^done,depth="4"
e7997b74 2673(@value{GDBP})
fb40c209
AC
2674-stack-info-depth 12
2675^done,depth="12"
e7997b74 2676(@value{GDBP})
fb40c209
AC
2677-stack-info-depth 11
2678^done,depth="11"
e7997b74 2679(@value{GDBP})
fb40c209
AC
2680-stack-info-depth 13
2681^done,depth="12"
e7997b74 2682(@value{GDBP})
7162c0ca
EZ
2683@end smallexample
2684
2685@subheading The @code{-stack-list-arguments} Command
2686@findex -stack-list-arguments
2687
2688@subsubheading Synopsis
fb40c209 2689
fb40c209 2690@example
7162c0ca
EZ
2691 -stack-list-arguments @var{show-values}
2692 [ @var{low-frame} @var{high-frame} ]
2693@end example
2694
2695Display a list of the arguments for the frames between @var{low-frame}
2696and @var{high-frame} (inclusive). If @var{low-frame} and
2697@var{high-frame} are not provided, list the arguments for the whole call
2698stack.
2699
2700The @var{show-values} argument must have a value of 0 or 1. A value of
27010 means that only the names of the arguments are listed, a value of 1
d68fc559 2702means that both names and values of the arguments are printed.
7162c0ca 2703
e7997b74 2704@subsubheading @value{GDBN} Command
7162c0ca 2705
e7997b74 2706@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
7162c0ca
EZ
2707@samp{gdb_get_args} command which partially overlaps with the
2708functionality of @samp{-stack-list-arguments}.
2709
2710@subsubheading Example
2711
2712@smallexample
e7997b74 2713(@value{GDBP})
fb40c209
AC
2714-stack-list-frames
2715^done,
d5e5643b 2716stack=[
9f2aab2d 2717frame=@{level="0",addr="0x00010734",func="callee4",
fb40c209 2718file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
9f2aab2d 2719frame=@{level="1",addr="0x0001076c",func="callee3",
fb40c209 2720file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
9f2aab2d 2721frame=@{level="2",addr="0x0001078c",func="callee2",
fb40c209 2722file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
9f2aab2d 2723frame=@{level="3",addr="0x000107b4",func="callee1",
fb40c209 2724file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
9f2aab2d 2725frame=@{level="4",addr="0x000107e0",func="main",
d5e5643b 2726file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
e7997b74 2727(@value{GDBP})
fb40c209
AC
2728-stack-list-arguments 0
2729^done,
d5e5643b 2730stack-args=[
dc61bc6d
AC
2731frame=@{level="0",args=[]@},
2732frame=@{level="1",args=[name="strarg"]@},
2733frame=@{level="2",args=[name="intarg",name="strarg"]@},
2734frame=@{level="3",args=[name="intarg",name="strarg",name="fltarg"]@},
2735frame=@{level="4",args=[]@}]
e7997b74 2736(@value{GDBP})
fb40c209
AC
2737-stack-list-arguments 1
2738^done,
d5e5643b 2739stack-args=[
dc61bc6d 2740frame=@{level="0",args=[]@},
7162c0ca 2741frame=@{level="1",
dc61bc6d
AC
2742 args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
2743frame=@{level="2",args=[
fb40c209 2744@{name="intarg",value="2"@},
dc61bc6d
AC
2745@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
2746@{frame=@{level="3",args=[
fb40c209
AC
2747@{name="intarg",value="2"@},
2748@{name="strarg",value="0x11940 \"A string argument.\""@},
dc61bc6d
AC
2749@{name="fltarg",value="3.5"@}]@},
2750frame=@{level="4",args=[]@}]
e7997b74 2751(@value{GDBP})
fb40c209 2752-stack-list-arguments 0 2 2
dc61bc6d 2753^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}]
e7997b74 2754(@value{GDBP})
fb40c209 2755-stack-list-arguments 1 2 2
d5e5643b 2756^done,stack-args=[frame=@{level="2",
dc61bc6d
AC
2757args=[@{name="intarg",value="2"@},
2758@{name="strarg",value="0x11940 \"A string argument.\""@}]@}]
e7997b74 2759(@value{GDBP})
7162c0ca
EZ
2760@end smallexample
2761
2762@c @subheading -stack-list-exception-handlers
2763
2764
2765@subheading The @code{-stack-list-frames} Command
2766@findex -stack-list-frames
2767
2768@subsubheading Synopsis
2769
2770@example
2771 -stack-list-frames [ @var{low-frame} @var{high-frame} ]
fb40c209
AC
2772@end example
2773
7162c0ca
EZ
2774List the frames currently on the stack. For each frame it displays the
2775following info:
fb40c209 2776
fb40c209 2777@table @samp
7162c0ca 2778@item @var{level}
fb40c209 2779The frame number, 0 being the topmost frame, i.e. the innermost function.
7162c0ca
EZ
2780@item @var{addr}
2781The @code{$pc} value for that frame.
2782@item @var{func}
2783Function name.
2784@item @var{file}
2785File name of the source file where the function lives.
2786@item @var{line}
2787Line number corresponding to the @code{$pc}.
fb40c209
AC
2788@end table
2789
7162c0ca
EZ
2790If invoked without arguments, this command prints a backtrace for the
2791whole stack. If given two integer arguments, it shows the frames whose
2792levels are between the two arguments (inclusive). If the two arguments
2793are equal, it shows the single frame at the corresponding level.
fb40c209 2794
e7997b74 2795@subsubheading @value{GDBN} Command
fb40c209 2796
e7997b74 2797The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
fb40c209 2798
7162c0ca
EZ
2799@subsubheading Example
2800
2801Full stack backtrace:
2802
2803@smallexample
e7997b74 2804(@value{GDBP})
fb40c209
AC
2805-stack-list-frames
2806^done,stack=
9f2aab2d 2807[frame=@{level="0",addr="0x0001076c",func="foo",
7162c0ca 2808 file="recursive2.c",line="11"@},
9f2aab2d 2809frame=@{level="1",addr="0x000107a4",func="foo",
7162c0ca 2810 file="recursive2.c",line="14"@},
9f2aab2d 2811frame=@{level="2",addr="0x000107a4",func="foo",
7162c0ca 2812 file="recursive2.c",line="14"@},
9f2aab2d 2813frame=@{level="3",addr="0x000107a4",func="foo",
7162c0ca 2814 file="recursive2.c",line="14"@},
9f2aab2d 2815frame=@{level="4",addr="0x000107a4",func="foo",
7162c0ca 2816 file="recursive2.c",line="14"@},
9f2aab2d 2817frame=@{level="5",addr="0x000107a4",func="foo",
7162c0ca 2818 file="recursive2.c",line="14"@},
9f2aab2d 2819frame=@{level="6",addr="0x000107a4",func="foo",
7162c0ca 2820 file="recursive2.c",line="14"@},
9f2aab2d 2821frame=@{level="7",addr="0x000107a4",func="foo",
7162c0ca 2822 file="recursive2.c",line="14"@},
9f2aab2d 2823frame=@{level="8",addr="0x000107a4",func="foo",
7162c0ca 2824 file="recursive2.c",line="14"@},
9f2aab2d 2825frame=@{level="9",addr="0x000107a4",func="foo",
7162c0ca
EZ
2826 file="recursive2.c",line="14"@},
2827frame=@{level="10",addr="0x000107a4",func="foo",
2828 file="recursive2.c",line="14"@},
2829frame=@{level="11",addr="0x00010738",func="main",
d5e5643b 2830 file="recursive2.c",line="4"@}]
e7997b74 2831(@value{GDBP})
7162c0ca
EZ
2832@end smallexample
2833
e7997b74 2834Show frames between @var{low_frame} and @var{high_frame}:
7162c0ca
EZ
2835
2836@smallexample
e7997b74 2837(@value{GDBP})
fb40c209
AC
2838-stack-list-frames 3 5
2839^done,stack=
9f2aab2d 2840[frame=@{level="3",addr="0x000107a4",func="foo",
7162c0ca 2841 file="recursive2.c",line="14"@},
9f2aab2d 2842frame=@{level="4",addr="0x000107a4",func="foo",
7162c0ca 2843 file="recursive2.c",line="14"@},
9f2aab2d 2844frame=@{level="5",addr="0x000107a4",func="foo",
d5e5643b 2845 file="recursive2.c",line="14"@}]
e7997b74 2846(@value{GDBP})
7162c0ca
EZ
2847@end smallexample
2848
2849Show a single frame:
2850
2851@smallexample
e7997b74 2852(@value{GDBP})
fb40c209
AC
2853-stack-list-frames 3 3
2854^done,stack=
9f2aab2d 2855[frame=@{level="3",addr="0x000107a4",func="foo",
d5e5643b 2856 file="recursive2.c",line="14"@}]
e7997b74 2857(@value{GDBP})
7162c0ca
EZ
2858@end smallexample
2859
2860
2861@subheading The @code{-stack-list-locals} Command
2862@findex -stack-list-locals
2863
2864@subsubheading Synopsis
2865
2866@example
2867 -stack-list-locals @var{print-values}
2868@end example
2869
d68fc559 2870Display the local variable names for the current frame. With an
7162c0ca
EZ
2871argument of 0 prints only the names of the variables, with argument of 1
2872prints also their values.
2873
e7997b74 2874@subsubheading @value{GDBN} Command
7162c0ca 2875
e7997b74 2876@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
7162c0ca
EZ
2877
2878@subsubheading Example
2879
2880@smallexample
e7997b74 2881(@value{GDBP})
7162c0ca 2882-stack-list-locals 0
dc61bc6d 2883^done,locals=[name="A",name="B",name="C"]
e7997b74 2884(@value{GDBP})
7162c0ca 2885-stack-list-locals 1
dc61bc6d
AC
2886^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
2887 @{name="C",value="3"@}]
e7997b74 2888(@value{GDBP})
7162c0ca
EZ
2889@end smallexample
2890
2891
2892@subheading The @code{-stack-select-frame} Command
2893@findex -stack-select-frame
2894
2895@subsubheading Synopsis
2896
2897@example
2898 -stack-select-frame @var{framenum}
2899@end example
2900
2901Change the current frame. Select a different frame @var{framenum} on
2902the stack.
2903
e7997b74 2904@subsubheading @value{GDBN} Command
7162c0ca 2905
e7997b74
EZ
2906The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
2907@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
7162c0ca
EZ
2908
2909@subsubheading Example
2910
2911@smallexample
e7997b74 2912(@value{GDBP})
7162c0ca
EZ
2913-stack-select-frame 2
2914^done
e7997b74 2915(@value{GDBP})
7162c0ca
EZ
2916@end smallexample
2917
2918@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2919@node GDB/MI Symbol Query
2920@section @sc{gdb/mi} Symbol Query Commands
2921
2922
2923@subheading The @code{-symbol-info-address} Command
2924@findex -symbol-info-address
2925
2926@subsubheading Synopsis
2927
2928@example
2929 -symbol-info-address @var{symbol}
2930@end example
2931
2932Describe where @var{symbol} is stored.
2933
e7997b74 2934@subsubheading @value{GDBN} Command
7162c0ca 2935
e7997b74 2936The corresponding @value{GDBN} command is @samp{info address}.
7162c0ca
EZ
2937
2938@subsubheading Example
2939N.A.
2940
2941
2942@subheading The @code{-symbol-info-file} Command
2943@findex -symbol-info-file
2944
2945@subsubheading Synopsis
2946
2947@example
2948 -symbol-info-file
2949@end example
2950
2951Show the file for the symbol.
2952
e7997b74 2953@subsubheading @value{GDBN} Command
7162c0ca 2954
e7997b74
EZ
2955There's no equivalent @value{GDBN} command. @code{gdbtk} has
2956@samp{gdb_find_file}.
7162c0ca
EZ
2957
2958@subsubheading Example
2959N.A.
2960
2961
2962@subheading The @code{-symbol-info-function} Command
2963@findex -symbol-info-function
2964
2965@subsubheading Synopsis
2966
2967@example
2968 -symbol-info-function
fb40c209
AC
2969@end example
2970
7162c0ca
EZ
2971Show which function the symbol lives in.
2972
e7997b74 2973@subsubheading @value{GDBN} Command
7162c0ca
EZ
2974
2975@samp{gdb_get_function} in @code{gdbtk}.
2976
2977@subsubheading Example
2978N.A.
2979
2980
2981@subheading The @code{-symbol-info-line} Command
2982@findex -symbol-info-line
2983
2984@subsubheading Synopsis
2985
2986@example
2987 -symbol-info-line
2988@end example
2989
2990Show the core addresses of the code for a source line.
2991
e7997b74 2992@subsubheading @value{GDBN} Command
7162c0ca 2993
e7997b74
EZ
2994The corresponding @value{GDBN} comamnd is @samp{info line}.
2995@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
7162c0ca
EZ
2996
2997@subsubheading Example
2998N.A.
2999
3000
3001@subheading The @code{-symbol-info-symbol} Command
3002@findex -symbol-info-symbol
3003
3004@subsubheading Synopsis
3005
3006@example
3007 -symbol-info-symbol @var{addr}
3008@end example
3009
3010Describe what symbol is at location @var{addr}.
3011
e7997b74 3012@subsubheading @value{GDBN} Command
7162c0ca 3013
e7997b74 3014The corresponding @value{GDBN} command is @samp{info symbol}.
7162c0ca
EZ
3015
3016@subsubheading Example
3017N.A.
3018
3019
3020@subheading The @code{-symbol-list-functions} Command
3021@findex -symbol-list-functions
3022
3023@subsubheading Synopsis
3024
3025@example
3026 -symbol-list-functions
3027@end example
3028
3029List the functions in the executable.
3030
e7997b74 3031@subsubheading @value{GDBN} Command
7162c0ca 3032
e7997b74
EZ
3033@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
3034@samp{gdb_search} in @code{gdbtk}.
7162c0ca
EZ
3035
3036@subsubheading Example
3037N.A.
3038
3039
3040@subheading The @code{-symbol-list-types} Command
3041@findex -symbol-list-types
3042
3043@subsubheading Synopsis
3044
3045@example
3046 -symbol-list-types
3047@end example
3048
3049List all the type names.
3050
e7997b74 3051@subsubheading @value{GDBN} Command
7162c0ca 3052
e7997b74 3053The corresponding commands are @samp{info types} in @value{GDBN},
7162c0ca
EZ
3054@samp{gdb_search} in @code{gdbtk}.
3055
3056@subsubheading Example
3057N.A.
3058
3059
3060@subheading The @code{-symbol-list-variables} Command
3061@findex -symbol-list-variables
3062
3063@subsubheading Synopsis
3064
3065@example
3066 -symbol-list-variables
3067@end example
3068
3069List all the global and static variable names.
3070
e7997b74 3071@subsubheading @value{GDBN} Command
7162c0ca 3072
e7997b74 3073@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
7162c0ca
EZ
3074
3075@subsubheading Example
3076N.A.
3077
3078
3079@subheading The @code{-symbol-locate} Command
3080@findex -symbol-locate
3081
3082@subsubheading Synopsis
3083
3084@example
3085 -symbol-locate
3086@end example
3087
e7997b74 3088@subsubheading @value{GDBN} Command
7162c0ca
EZ
3089
3090@samp{gdb_loc} in @code{gdbtk}.
3091
3092@subsubheading Example
3093N.A.
3094
3095
3096@subheading The @code{-symbol-type} Command
3097@findex -symbol-type
3098
3099@subsubheading Synopsis
3100
3101@example
3102 -symbol-type @var{variable}
3103@end example
3104
3105Show type of @var{variable}.
3106
e7997b74 3107@subsubheading @value{GDBN} Command
7162c0ca 3108
e7997b74 3109The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
7162c0ca
EZ
3110@samp{gdb_obj_variable}.
3111
3112@subsubheading Example
3113N.A.
3114
3115
3116@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3117@node GDB/MI Target Manipulation
3118@section @sc{gdb/mi} Target Manipulation Commands
3119
fb40c209 3120
7162c0ca
EZ
3121@subheading The @code{-target-attach} Command
3122@findex -target-attach
3123
3124@subsubheading Synopsis
fb40c209 3125
fb40c209 3126@example
7162c0ca 3127 -target-attach @var{pid} | @var{file}
fb40c209
AC
3128@end example
3129
e7997b74 3130Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
fb40c209 3131
e7997b74 3132@subsubheading @value{GDBN} command
fb40c209 3133
e7997b74 3134The corresponding @value{GDBN} command is @samp{attach}.
fb40c209 3135
7162c0ca 3136@subsubheading Example
fb40c209
AC
3137N.A.
3138
fb40c209 3139
7162c0ca
EZ
3140@subheading The @code{-target-compare-sections} Command
3141@findex -target-compare-sections
fb40c209 3142
7162c0ca 3143@subsubheading Synopsis
fb40c209 3144
7162c0ca
EZ
3145@example
3146 -target-compare-sections [ @var{section} ]
3147@end example
fb40c209 3148
7162c0ca
EZ
3149Compare data of section @var{section} on target to the exec file.
3150Without the argument, all sections are compared.
fb40c209 3151
e7997b74 3152@subsubheading @value{GDBN} Command
fb40c209 3153
e7997b74 3154The @value{GDBN} equivalent is @samp{compare-sections}.
fb40c209 3155
7162c0ca 3156@subsubheading Example
fb40c209
AC
3157N.A.
3158
fb40c209 3159
7162c0ca
EZ
3160@subheading The @code{-target-detach} Command
3161@findex -target-detach
fb40c209 3162
7162c0ca 3163@subsubheading Synopsis
fb40c209 3164
fb40c209 3165@example
7162c0ca
EZ
3166 -target-detach
3167@end example
3168
3169Disconnect from the remote target. There's no output.
3170
e7997b74 3171@subsubheading @value{GDBN} command
7162c0ca 3172
e7997b74 3173The corresponding @value{GDBN} command is @samp{detach}.
7162c0ca
EZ
3174
3175@subsubheading Example
3176
3177@smallexample
e7997b74 3178(@value{GDBP})
fb40c209
AC
3179-target-detach
3180^done
e7997b74 3181(@value{GDBP})
7162c0ca
EZ
3182@end smallexample
3183
3184
3185@subheading The @code{-target-download} Command
3186@findex -target-download
3187
3188@subsubheading Synopsis
3189
3190@example
3191 -target-download
fb40c209
AC
3192@end example
3193
fb40c209
AC
3194Loads the executable onto the remote target.
3195It prints out an update message every half second, which includes the fields:
fb40c209 3196
7162c0ca
EZ
3197@table @samp
3198@item section
3199The name of the section.
3200@item section-sent
3201The size of what has been sent so far for that section.
3202@item section-size
3203The size of the section.
3204@item total-sent
3205The total size of what was sent so far (the current and the previous sections).
3206@item total-size
3207The size of the overall executable to download.
3208@end table
3209
3210@noindent
3211Each message is sent as status record (@pxref{GDB/MI Output Syntax, ,
3212@sc{gdb/mi} Output Syntax}).
3213
3214In addition, it prints the name and size of the sections, as they are
3215downloaded. These messages include the following fields:
fb40c209 3216
7162c0ca
EZ
3217@table @samp
3218@item section
3219The name of the section.
3220@item section-size
3221The size of the section.
3222@item total-size
3223The size of the overall executable to download.
3224@end table
3225
3226@noindent
e7997b74 3227At the end, a summary is printed.
7162c0ca 3228
e7997b74 3229@subsubheading @value{GDBN} Command
7162c0ca 3230
e7997b74 3231The corresponding @value{GDBN} command is @samp{load}.
7162c0ca
EZ
3232
3233@subsubheading Example
3234
3235Note: each status message appears on a single line. Here the messages
d68fc559 3236have been broken down so that they can fit onto a page.
7162c0ca
EZ
3237
3238@smallexample
e7997b74 3239(@value{GDBP})
fb40c209
AC
3240-target-download
3241+download,@{section=".text",section-size="6668",total-size="9880"@}
3242+download,@{section=".text",section-sent="512",section-size="6668",
3243total-sent="512",total-size="9880"@}
3244+download,@{section=".text",section-sent="1024",section-size="6668",
3245total-sent="1024",total-size="9880"@}
3246+download,@{section=".text",section-sent="1536",section-size="6668",
3247total-sent="1536",total-size="9880"@}
3248+download,@{section=".text",section-sent="2048",section-size="6668",
3249total-sent="2048",total-size="9880"@}
3250+download,@{section=".text",section-sent="2560",section-size="6668",
3251total-sent="2560",total-size="9880"@}
3252+download,@{section=".text",section-sent="3072",section-size="6668",
3253total-sent="3072",total-size="9880"@}
3254+download,@{section=".text",section-sent="3584",section-size="6668",
3255total-sent="3584",total-size="9880"@}
3256+download,@{section=".text",section-sent="4096",section-size="6668",
3257total-sent="4096",total-size="9880"@}
3258+download,@{section=".text",section-sent="4608",section-size="6668",
3259total-sent="4608",total-size="9880"@}
3260+download,@{section=".text",section-sent="5120",section-size="6668",
3261total-sent="5120",total-size="9880"@}
3262+download,@{section=".text",section-sent="5632",section-size="6668",
3263total-sent="5632",total-size="9880"@}
3264+download,@{section=".text",section-sent="6144",section-size="6668",
3265total-sent="6144",total-size="9880"@}
3266+download,@{section=".text",section-sent="6656",section-size="6668",
3267total-sent="6656",total-size="9880"@}
3268+download,@{section=".init",section-size="28",total-size="9880"@}
3269+download,@{section=".fini",section-size="28",total-size="9880"@}
3270+download,@{section=".data",section-size="3156",total-size="9880"@}
3271+download,@{section=".data",section-sent="512",section-size="3156",
3272total-sent="7236",total-size="9880"@}
3273+download,@{section=".data",section-sent="1024",section-size="3156",
3274total-sent="7748",total-size="9880"@}
3275+download,@{section=".data",section-sent="1536",section-size="3156",
3276total-sent="8260",total-size="9880"@}
3277+download,@{section=".data",section-sent="2048",section-size="3156",
3278total-sent="8772",total-size="9880"@}
3279+download,@{section=".data",section-sent="2560",section-size="3156",
3280total-sent="9284",total-size="9880"@}
3281+download,@{section=".data",section-sent="3072",section-size="3156",
3282total-sent="9796",total-size="9880"@}
7162c0ca
EZ
3283^done,address="0x10004",load-size="9880",transfer-rate="6586",
3284write-rate="429"
e7997b74 3285(@value{GDBP})
7162c0ca
EZ
3286@end smallexample
3287
3288
3289@subheading The @code{-target-exec-status} Command
3290@findex -target-exec-status
3291
3292@subsubheading Synopsis
3293
3294@example
3295 -target-exec-status
fb40c209
AC
3296@end example
3297
7162c0ca
EZ
3298Provide information on the state of the target (whether it is running or
3299not, for instance).
3300
e7997b74 3301@subsubheading @value{GDBN} Command
7162c0ca 3302
e7997b74 3303There's no equivalent @value{GDBN} command.
7162c0ca
EZ
3304
3305@subsubheading Example
fb40c209
AC
3306N.A.
3307
7162c0ca
EZ
3308
3309@subheading The @code{-target-list-available-targets} Command
3310@findex -target-list-available-targets
3311
3312@subsubheading Synopsis
3313
3314@example
3315 -target-list-available-targets
3316@end example
3317
fb40c209 3318List the possible targets to connect to.
7162c0ca 3319
e7997b74 3320@subsubheading @value{GDBN} Command
7162c0ca 3321
e7997b74 3322The corresponding @value{GDBN} command is @samp{help target}.
7162c0ca
EZ
3323
3324@subsubheading Example
fb40c209
AC
3325N.A.
3326
7162c0ca
EZ
3327
3328@subheading The @code{-target-list-current-targets} Command
3329@findex -target-list-current-targets
3330
3331@subsubheading Synopsis
3332
3333@example
3334 -target-list-current-targets
3335@end example
3336
3337Describe the current target.
3338
e7997b74 3339@subsubheading @value{GDBN} Command
7162c0ca
EZ
3340
3341The corresponding information is printed by @samp{info file} (among
3342other things).
3343
3344@subsubheading Example
fb40c209
AC
3345N.A.
3346
7162c0ca
EZ
3347
3348@subheading The @code{-target-list-parameters} Command
3349@findex -target-list-parameters
3350
3351@subsubheading Synopsis
3352
3353@example
3354 -target-list-parameters
3355@end example
3356
3357@c ????
3358
e7997b74 3359@subsubheading @value{GDBN} Command
7162c0ca
EZ
3360
3361No equivalent.
3362
3363@subsubheading Example
fb40c209
AC
3364N.A.
3365
fb40c209 3366
7162c0ca
EZ
3367@subheading The @code{-target-select} Command
3368@findex -target-select
fb40c209 3369
7162c0ca
EZ
3370@subsubheading Synopsis
3371
3372@example
e7997b74 3373 -target-select @var{type} @var{parameters @dots{}}
7162c0ca
EZ
3374@end example
3375
e7997b74 3376Connect @value{GDBN} to the remote target. This command takes two args:
fb40c209
AC
3377
3378@table @samp
7162c0ca
EZ
3379@item @var{type}
3380The type of target, for instance @samp{async}, @samp{remote}, etc.
3381@item @var{parameters}
3382Device names, host names and the like. @xref{Target Commands, ,
3383Commands for managing targets}, for more details.
fb40c209 3384@end table
7162c0ca 3385
fb40c209 3386The output is a connection notification, followed by the address at
7162c0ca 3387which the target program is, in the following form:
fb40c209 3388
7162c0ca
EZ
3389@smallexample
3390^connected,addr="@var{address}",func="@var{function name}",
dc61bc6d 3391 args=[@var{arg list}]
7162c0ca 3392@end smallexample
fb40c209 3393
e7997b74 3394@subsubheading @value{GDBN} Command
7162c0ca 3395
e7997b74 3396The corresponding @value{GDBN} command is @samp{target}.
7162c0ca
EZ
3397
3398@subsubheading Example
3399
3400@smallexample
e7997b74 3401(@value{GDBP})
fb40c209 3402-target-select async /dev/ttya
dc61bc6d 3403^connected,addr="0xfe00a300",func="??",args=[]
e7997b74 3404(@value{GDBP})
7162c0ca
EZ
3405@end smallexample
3406
3407@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3408@node GDB/MI Thread Commands
3409@section @sc{gdb/mi} Thread Commands
3410
3411
3412@subheading The @code{-thread-info} Command
3413@findex -thread-info
3414
3415@subsubheading Synopsis
3416
3417@example
3418 -thread-info
fb40c209
AC
3419@end example
3420
e7997b74 3421@subsubheading @value{GDBN} command
7162c0ca
EZ
3422
3423No equivalent.
3424
3425@subsubheading Example
3426N.A.
3427
3428
3429@subheading The @code{-thread-list-all-threads} Command
3430@findex -thread-list-all-threads
3431
3432@subsubheading Synopsis
3433
3434@example
3435 -thread-list-all-threads
3436@end example
3437
e7997b74 3438@subsubheading @value{GDBN} Command
7162c0ca 3439
e7997b74 3440The equivalent @value{GDBN} command is @samp{info threads}.
7162c0ca
EZ
3441
3442@subsubheading Example
3443N.A.
3444
3445
3446@subheading The @code{-thread-list-ids} Command
3447@findex -thread-list-ids
3448
3449@subsubheading Synopsis
3450
fb40c209 3451@example
7162c0ca
EZ
3452 -thread-list-ids
3453@end example
3454
e7997b74
EZ
3455Produces a list of the currently known @value{GDBN} thread ids. At the
3456end of the list it also prints the total number of such threads.
7162c0ca 3457
e7997b74 3458@subsubheading @value{GDBN} Command
7162c0ca
EZ
3459
3460Part of @samp{info threads} supplies the same information.
3461
3462@subsubheading Example
3463
1c85fbd9 3464No threads present, besides the main process:
7162c0ca
EZ
3465
3466@smallexample
e7997b74 3467(@value{GDBP})
fb40c209
AC
3468-thread-list-ids
3469^done,thread-ids=@{@},number-of-threads="0"
e7997b74 3470(@value{GDBP})
7162c0ca
EZ
3471@end smallexample
3472
3473
1c85fbd9 3474Several threads:
7162c0ca
EZ
3475
3476@smallexample
e7997b74 3477(@value{GDBP})
fb40c209
AC
3478-thread-list-ids
3479^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
3480number-of-threads="3"
e7997b74 3481(@value{GDBP})
7162c0ca
EZ
3482@end smallexample
3483
3484
3485@subheading The @code{-thread-select} Command
3486@findex -thread-select
3487
3488@subsubheading Synopsis
3489
3490@example
3491 -thread-select @var{threadnum}
fb40c209
AC
3492@end example
3493
7162c0ca 3494Make @var{threadnum} the current thread. It prints the number of the new
fb40c209 3495current thread, and the topmost frame for that thread.
7162c0ca 3496
e7997b74 3497@subsubheading @value{GDBN} Command
7162c0ca 3498
e7997b74 3499The corresponding @value{GDBN} command is @samp{thread}.
7162c0ca
EZ
3500
3501@subsubheading Example
3502
3503@smallexample
e7997b74 3504(@value{GDBP})
fb40c209
AC
3505-exec-next
3506^running
e7997b74 3507(@value{GDBP})
fb40c209
AC
3508*stopped,reason="end-stepping-range",thread-id="2",line="187",
3509file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
e7997b74 3510(@value{GDBP})
fb40c209
AC
3511-thread-list-ids
3512^done,
7162c0ca 3513thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
fb40c209 3514number-of-threads="3"
e7997b74 3515(@value{GDBP})
fb40c209
AC
3516-thread-select 3
3517^done,new-thread-id="3",
9f2aab2d 3518frame=@{level="0",func="vprintf",
dc61bc6d
AC
3519args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
3520@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
e7997b74 3521(@value{GDBP})
7162c0ca 3522@end smallexample
fb40c209 3523
7162c0ca
EZ
3524@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3525@node GDB/MI Tracepoint Commands
3526@section @sc{gdb/mi} Tracepoint Commands
fb40c209 3527
7162c0ca 3528The tracepoint commands are not yet implemented.
fb40c209 3529
7162c0ca 3530@c @subheading -trace-actions
fb40c209 3531
7162c0ca 3532@c @subheading -trace-delete
fb40c209 3533
7162c0ca 3534@c @subheading -trace-disable
fb40c209 3535
7162c0ca 3536@c @subheading -trace-dump
fb40c209 3537
7162c0ca 3538@c @subheading -trace-enable
fb40c209 3539
7162c0ca 3540@c @subheading -trace-exists
fb40c209 3541
7162c0ca 3542@c @subheading -trace-find
fb40c209 3543
7162c0ca 3544@c @subheading -trace-frame-number
fb40c209 3545
7162c0ca 3546@c @subheading -trace-info
fb40c209 3547
7162c0ca 3548@c @subheading -trace-insert
fb40c209 3549
7162c0ca 3550@c @subheading -trace-list
fb40c209 3551
7162c0ca 3552@c @subheading -trace-pass-count
fb40c209 3553
7162c0ca 3554@c @subheading -trace-save
fb40c209 3555
7162c0ca 3556@c @subheading -trace-start
fb40c209 3557
7162c0ca 3558@c @subheading -trace-stop
fb40c209
AC
3559
3560
7162c0ca
EZ
3561@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3562@node GDB/MI Variable Objects
3563@section @sc{gdb/mi} Variable Objects
3564
fb40c209 3565
7162c0ca 3566@subheading Motivation for Variable Objects in @sc{gdb/mi}
fb40c209
AC
3567
3568For the implementation of a variable debugger window (locals, watched
d68fc559 3569expressions, etc.), we are proposing the adaptation of the existing code
7162c0ca 3570used by @code{Insight}.
fb40c209 3571
7162c0ca 3572The two main reasons for that are:
fb40c209
AC
3573
3574@enumerate 1
3575@item
7162c0ca
EZ
3576It has been proven in practice (it is already on its second generation).
3577
fb40c209
AC
3578@item
3579It will shorten development time (needless to say how important it is
7162c0ca 3580now).
fb40c209
AC
3581@end enumerate
3582
3583The original interface was designed to be used by Tcl code, so it was
1c85fbd9
EZ
3584slightly changed so it could be used through @sc{gdb/mi}. This section
3585describes the @sc{gdb/mi} operations that will be available and gives some
7162c0ca 3586hints about their use.
fb40c209
AC
3587
3588@emph{Note}: In addition to the set of operations described here, we
7162c0ca
EZ
3589expect the @sc{gui} implementation of a variable window to require, at
3590least, the following operations:
3591
3592@itemize @bullet
1c85fbd9
EZ
3593@item @code{-gdb-show} @code{output-radix}
3594@item @code{-stack-list-arguments}
3595@item @code{-stack-list-locals}
3596@item @code{-stack-select-frame}
fb40c209
AC
3597@end itemize
3598
7162c0ca 3599@subheading Introduction to Variable Objects in @sc{gdb/mi}
fb40c209 3600
7162c0ca 3601@cindex variable objects in @sc{gdb/mi}
fb40c209
AC
3602The basic idea behind variable objects is the creation of a named object
3603to represent a variable, an expression, a memory location or even a CPU
3604register. For each object created, a set of operations is available for
3605examining or changing its properties.
3606
3607Furthermore, complex data types, such as C structures, are represented
7162c0ca
EZ
3608in a tree format. For instance, the @code{struct} type variable is the
3609root and the children will represent the struct members. If a child
3610is itself of a complex type, it will also have children of its own.
3611Appropriate language differences are handled for C, C@t{++} and Java.
fb40c209
AC
3612
3613When returning the actual values of the objects, this facility allows
3614for the individual selection of the display format used in the result
3615creation. It can be chosen among: binary, decimal, hexadecimal, octal
d68fc559 3616and natural. Natural refers to a default format automatically
7162c0ca
EZ
3617chosen based on the variable type (like decimal for an @code{int}, hex
3618for pointers, etc.).
fb40c209 3619
1c85fbd9 3620The following is the complete set of @sc{gdb/mi} operations defined to
fb40c209
AC
3621access this functionality:
3622
96c405b3 3623@multitable @columnfractions .4 .6
fb40c209
AC
3624@item @strong{Operation}
3625@tab @strong{Description}
3626
1c85fbd9 3627@item @code{-var-create}
fb40c209 3628@tab create a variable object
1c85fbd9 3629@item @code{-var-delete}
fb40c209 3630@tab delete the variable object and its children
1c85fbd9 3631@item @code{-var-set-format}
fb40c209 3632@tab set the display format of this variable
1c85fbd9 3633@item @code{-var-show-format}
fb40c209 3634@tab show the display format of this variable
1c85fbd9 3635@item @code{-var-info-num-children}
fb40c209 3636@tab tells how many children this object has
1c85fbd9 3637@item @code{-var-list-children}
fb40c209 3638@tab return a list of the object's children
1c85fbd9 3639@item @code{-var-info-type}
fb40c209 3640@tab show the type of this variable object
1c85fbd9 3641@item @code{-var-info-expression}
fb40c209 3642@tab print what this variable object represents
1c85fbd9 3643@item @code{-var-show-attributes}
fb40c209 3644@tab is this variable editable? does it exist here?
1c85fbd9 3645@item @code{-var-evaluate-expression}
fb40c209 3646@tab get the value of this variable
1c85fbd9 3647@item @code{-var-assign}
fb40c209 3648@tab set the value of this variable
1c85fbd9 3649@item @code{-var-update}
fb40c209
AC
3650@tab update the variable and its children
3651@end multitable
3652
7162c0ca
EZ
3653In the next subsection we describe each operation in detail and suggest
3654how it can be used.
3655
3656@subheading Description And Use of Operations on Variable Objects
fb40c209 3657
7162c0ca
EZ
3658@subheading The @code{-var-create} Command
3659@findex -var-create
fb40c209 3660
7162c0ca 3661@subsubheading Synopsis
fb40c209 3662
7162c0ca
EZ
3663@example
3664 -var-create @{@var{name} | "-"@}
3665 @{@var{frame-addr} | "*"@} @var{expression}
3666@end example
fb40c209
AC
3667
3668This operation creates a variable object, which allows the monitoring of
3669a variable, the result of an expression, a memory cell or a CPU
3670register.
3671
7162c0ca
EZ
3672The @var{name} parameter is the string by which the object can be
3673referenced. It must be unique. If @samp{-} is specified, the varobj
1c85fbd9 3674system will generate a string ``varNNNNNN'' automatically. It will be
7162c0ca
EZ
3675unique provided that one does not specify @var{name} on that format.
3676The command fails if a duplicate name is found.
fb40c209
AC
3677
3678The frame under which the expression should be evaluated can be
7162c0ca
EZ
3679specified by @var{frame-addr}. A @samp{*} indicates that the current
3680frame should be used.
fb40c209 3681
d68fc559 3682@var{expression} is any expression valid on the current language set (must not
7162c0ca
EZ
3683begin with a @samp{*}), or one of the following:
3684
3685@itemize @bullet
3686@item
3687@samp{*@var{addr}}, where @var{addr} is the address of a memory cell
3688
3689@item
1c85fbd9 3690@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
7162c0ca
EZ
3691
3692@item
1c85fbd9 3693@samp{$@var{regname}} --- a CPU register name
7162c0ca
EZ
3694@end itemize
3695
3696@subsubheading Result
3697
fb40c209
AC
3698This operation returns the name, number of children and the type of the
3699object created. Type is returned as a string as the ones generated by
e7997b74 3700the @value{GDBN} CLI:
7162c0ca
EZ
3701
3702@example
3703 name="@var{name}",numchild="N",type="@var{type}"
3704@end example
3705
3706
3707@subheading The @code{-var-delete} Command
3708@findex -var-delete
3709
3710@subsubheading Synopsis
3711
3712@example
3713 -var-delete @var{name}
3714@end example
3715
3716Deletes a previously created variable object and all of its children.
3717
3718Returns an error if the object @var{name} is not found.
3719
3720
3721@subheading The @code{-var-set-format} Command
3722@findex -var-set-format
3723
3724@subsubheading Synopsis
3725
3726@example
3727 -var-set-format @var{name} @var{format-spec}
3728@end example
3729
3730Sets the output format for the value of the object @var{name} to be
3731@var{format-spec}.
3732
3733The syntax for the @var{format-spec} is as follows:
3734
3735@example
3736 @var{format-spec} @expansion{}
3737 @{binary | decimal | hexadecimal | octal | natural@}
3738@end example
3739
3740
3741@subheading The @code{-var-show-format} Command
3742@findex -var-show-format
3743
3744@subsubheading Synopsis
3745
3746@example
3747 -var-show-format @var{name}
3748@end example
3749
3750Returns the format used to display the value of the object @var{name}.
3751
3752@example
1c85fbd9 3753 @var{format} @expansion{}
7162c0ca
EZ
3754 @var{format-spec}
3755@end example
3756
3757
3758@subheading The @code{-var-info-num-children} Command
3759@findex -var-info-num-children
3760
3761@subsubheading Synopsis
3762
3763@example
3764 -var-info-num-children @var{name}
3765@end example
3766
3767Returns the number of children of a variable object @var{name}:
3768
3769@example
3770 numchild=@var{n}
3771@end example
fb40c209 3772
fb40c209 3773
7162c0ca
EZ
3774@subheading The @code{-var-list-children} Command
3775@findex -var-list-children
fb40c209 3776
7162c0ca 3777@subsubheading Synopsis
fb40c209 3778
7162c0ca
EZ
3779@example
3780 -var-list-children @var{name}
3781@end example
fb40c209 3782
7162c0ca 3783Returns a list of the children of the specified variable object:
fb40c209 3784
7162c0ca 3785@example
e7494ffb
AC
3786 numchild=@var{n},children=[@{name=@var{name},
3787 numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
7162c0ca 3788@end example
fb40c209 3789
fb40c209 3790
7162c0ca
EZ
3791@subheading The @code{-var-info-type} Command
3792@findex -var-info-type
fb40c209 3793
7162c0ca 3794@subsubheading Synopsis
fb40c209 3795
7162c0ca
EZ
3796@example
3797 -var-info-type @var{name}
3798@end example
fb40c209 3799
7162c0ca 3800Returns the type of the specified variable @var{name}. The type is
e7997b74
EZ
3801returned as a string in the same format as it is output by the
3802@value{GDBN} CLI:
fb40c209 3803
7162c0ca
EZ
3804@example
3805 type=@var{typename}
3806@end example
fb40c209 3807
fb40c209 3808
7162c0ca
EZ
3809@subheading The @code{-var-info-expression} Command
3810@findex -var-info-expression
fb40c209 3811
7162c0ca 3812@subsubheading Synopsis
fb40c209 3813
7162c0ca
EZ
3814@example
3815 -var-info-expression @var{name}
3816@end example
fb40c209 3817
7162c0ca 3818Returns what is represented by the variable object @var{name}:
fb40c209 3819
7162c0ca
EZ
3820@example
3821 lang=@var{lang-spec},exp=@var{expression}
3822@end example
fb40c209 3823
7162c0ca
EZ
3824@noindent
3825where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}.
fb40c209 3826
7162c0ca
EZ
3827@subheading The @code{-var-show-attributes} Command
3828@findex -var-show-attributes
fb40c209 3829
7162c0ca 3830@subsubheading Synopsis
fb40c209 3831
7162c0ca
EZ
3832@example
3833 -var-show-attributes @var{name}
3834@end example
fb40c209 3835
7162c0ca 3836List attributes of the specified variable object @var{name}:
fb40c209 3837
7162c0ca
EZ
3838@example
3839 status=@var{attr} [ ( ,@var{attr} )* ]
3840@end example
fb40c209 3841
7162c0ca
EZ
3842@noindent
3843where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
fb40c209 3844
7162c0ca
EZ
3845@subheading The @code{-var-evaluate-expression} Command
3846@findex -var-evaluate-expression
fb40c209 3847
7162c0ca 3848@subsubheading Synopsis
fb40c209 3849
7162c0ca
EZ
3850@example
3851 -var-evaluate-expression @var{name}
3852@end example
fb40c209
AC
3853
3854Evaluates the expression that is represented by the specified variable
3855object and returns its value as a string in the current format specified
7162c0ca
EZ
3856for the object:
3857
3858@example
3859 value=@var{value}
3860@end example
3861
7501537f
AC
3862Note that one must invoke @code{-var-list-children} for a variable
3863before the value of a child variable can be evaluated.
3864
7162c0ca
EZ
3865@subheading The @code{-var-assign} Command
3866@findex -var-assign
fb40c209 3867
7162c0ca 3868@subsubheading Synopsis
fb40c209 3869
7162c0ca
EZ
3870@example
3871 -var-assign @var{name} @var{expression}
3872@end example
fb40c209 3873
7162c0ca 3874Assigns the value of @var{expression} to the variable object specified
46ae13f0
JJ
3875by @var{name}. The object must be @samp{editable}. If the variable's
3876value is altered by the assign, the variable will show up in any
3877subsequent @code{-var-update} list.
3878
3879@subsubheading Example
3880
3881@example
3882(@value{GDBP})
3883-var-assign var1 3
3884^done,value="3"
3885(@value{GDBP})
3886-var-update *
3887^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}]
3888(@value{GDBP})
3889@end example
fb40c209 3890
7162c0ca
EZ
3891@subheading The @code{-var-update} Command
3892@findex -var-update
fb40c209 3893
7162c0ca
EZ
3894@subsubheading Synopsis
3895
3896@example
3897 -var-update @{@var{name} | "*"@}
3898@end example
fb40c209 3899
7162c0ca
EZ
3900Update the value of the variable object @var{name} by evaluating its
3901expression after fetching all the new values from memory or registers.
3902A @samp{*} causes all existing variable objects to be updated.
This page took 0.447939 seconds and 4 git commands to generate.