2002-12-13 Andrew Cagney <ac131313@redhat.com>
[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
7162c0ca
EZ
1668 -environment-directory @var{pathdir}
1669@end example
1670
1671Add directory @var{pathdir} to beginning of search path for source files.
1672
e7997b74 1673@subsubheading @value{GDBN} Command
7162c0ca 1674
e7997b74 1675The corresponding @value{GDBN} command is @samp{dir}.
7162c0ca
EZ
1676
1677@subsubheading Example
1678
1679@smallexample
e7997b74 1680(@value{GDBP})
fb40c209
AC
1681-environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
1682^done
e7997b74 1683(@value{GDBP})
7162c0ca
EZ
1684@end smallexample
1685
1686
1687@subheading The @code{-environment-path} Command
1688@findex -environment-path
1689
1690@subsubheading Synopsis
fb40c209 1691
fb40c209 1692@example
7162c0ca
EZ
1693 -environment-path ( @var{pathdir} )+
1694@end example
1695
1c85fbd9 1696Add directories @var{pathdir} to beginning of search path for object files.
7162c0ca 1697
e7997b74 1698@subsubheading @value{GDBN} Command
7162c0ca 1699
e7997b74 1700The corresponding @value{GDBN} command is @samp{path}.
7162c0ca
EZ
1701
1702@subsubheading Example
1703
1704@smallexample
e7997b74 1705(@value{GDBP})
fb40c209
AC
1706-environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb
1707^done
e7997b74 1708(@value{GDBP})
7162c0ca
EZ
1709@end smallexample
1710
1711
1712@subheading The @code{-environment-pwd} Command
1713@findex -environment-pwd
1714
1715@subsubheading Synopsis
fb40c209 1716
fb40c209 1717@example
7162c0ca
EZ
1718 -environment-pwd
1719@end example
1720
1721Show the current working directory.
1722
e7997b74 1723@subsubheading @value{GDBN} command
7162c0ca 1724
e7997b74 1725The corresponding @value{GDBN} command is @samp{pwd}.
7162c0ca
EZ
1726
1727@subsubheading Example
1728
1729@smallexample
e7997b74 1730(@value{GDBP})
fb40c209
AC
1731-environment-pwd
1732~Working directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb.
1733^done
e7997b74 1734(@value{GDBP})
7162c0ca 1735@end smallexample
fb40c209 1736
7162c0ca
EZ
1737@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1738@node GDB/MI Program Control
1739@section @sc{gdb/mi} Program control
1740
1741@subsubheading Program termination
fb40c209 1742
fb40c209 1743As a result of execution, the inferior program can run to completion, if
e7997b74 1744it doesn't encounter any breakpoints. In this case the output will
fb40c209 1745include an exit code, if the program has exited exceptionally.
7162c0ca 1746
1c85fbd9 1747@subsubheading Examples
7162c0ca
EZ
1748
1749@noindent
fb40c209 1750Program exited normally:
7162c0ca
EZ
1751
1752@smallexample
e7997b74 1753(@value{GDBP})
fb40c209
AC
1754-exec-run
1755^running
e7997b74 1756(@value{GDBP})
fb40c209
AC
1757x = 55
1758*stopped,reason="exited-normally"
e7997b74 1759(@value{GDBP})
7162c0ca 1760@end smallexample
fb40c209 1761
7162c0ca 1762@noindent
fb40c209 1763Program exited exceptionally:
7162c0ca
EZ
1764
1765@smallexample
e7997b74 1766(@value{GDBP})
fb40c209
AC
1767-exec-run
1768^running
e7997b74 1769(@value{GDBP})
fb40c209
AC
1770x = 55
1771*stopped,reason="exited",exit-code="01"
e7997b74 1772(@value{GDBP})
7162c0ca
EZ
1773@end smallexample
1774
1775Another way the program can terminate is if it receives a signal such as
1776@code{SIGINT}. In this case, @sc{gdb/mi} displays this:
1777
1778@smallexample
e7997b74 1779(@value{GDBP})
7162c0ca
EZ
1780*stopped,reason="exited-signalled",signal-name="SIGINT",
1781signal-meaning="Interrupt"
1782@end smallexample
1783
1784
1785@subheading The @code{-exec-abort} Command
1786@findex -exec-abort
1787
1788@subsubheading Synopsis
fb40c209 1789
fb40c209 1790@example
7162c0ca 1791 -exec-abort
fb40c209
AC
1792@end example
1793
fb40c209
AC
1794Kill the inferior running program.
1795
e7997b74 1796@subsubheading @value{GDBN} Command
7162c0ca 1797
e7997b74 1798The corresponding @value{GDBN} command is @samp{kill}.
fb40c209 1799
7162c0ca 1800@subsubheading Example
fb40c209
AC
1801N.A.
1802
fb40c209 1803
7162c0ca
EZ
1804@subheading The @code{-exec-arguments} Command
1805@findex -exec-arguments
fb40c209 1806
7162c0ca
EZ
1807@subsubheading Synopsis
1808
1809@example
1810 -exec-arguments @var{args}
1811@end example
1812
1813Set the inferior program arguments, to be used in the next
1814@samp{-exec-run}.
1815
e7997b74 1816@subsubheading @value{GDBN} Command
7162c0ca 1817
e7997b74 1818The corresponding @value{GDBN} command is @samp{set args}.
7162c0ca
EZ
1819
1820@subsubheading Example
1821
1822@c FIXME!
1823Don't have one around.
fb40c209 1824
fb40c209 1825
7162c0ca
EZ
1826@subheading The @code{-exec-continue} Command
1827@findex -exec-continue
1828
1829@subsubheading Synopsis
fb40c209 1830
fb40c209 1831@example
7162c0ca
EZ
1832 -exec-continue
1833@end example
1834
1835Asynchronous command. Resumes the execution of the inferior program
1836until a breakpoint is encountered, or until the inferior exits.
1837
e7997b74 1838@subsubheading @value{GDBN} Command
7162c0ca 1839
e7997b74 1840The corresponding @value{GDBN} corresponding is @samp{continue}.
7162c0ca
EZ
1841
1842@subsubheading Example
1843
1844@smallexample
fb40c209
AC
1845-exec-continue
1846^running
e7997b74 1847(@value{GDBP})
fb40c209 1848@@Hello world
68c81b54 1849*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[],
fb40c209 1850file="hello.c",line="13"@}
e7997b74 1851(@value{GDBP})
7162c0ca
EZ
1852@end smallexample
1853
fb40c209 1854
7162c0ca
EZ
1855@subheading The @code{-exec-finish} Command
1856@findex -exec-finish
fb40c209 1857
7162c0ca 1858@subsubheading Synopsis
fb40c209 1859
fb40c209 1860@example
7162c0ca
EZ
1861 -exec-finish
1862@end example
1863
1864Asynchronous command. Resumes the execution of the inferior program
1865until the current function is exited. Displays the results returned by
1866the function.
1867
e7997b74 1868@subsubheading @value{GDBN} Command
7162c0ca 1869
e7997b74 1870The corresponding @value{GDBN} command is @samp{finish}.
7162c0ca
EZ
1871
1872@subsubheading Example
1873
1874Function returning @code{void}.
1875
1876@smallexample
fb40c209
AC
1877-exec-finish
1878^running
e7997b74 1879(@value{GDBP})
fb40c209 1880@@hello from foo
68c81b54 1881*stopped,reason="function-finished",frame=@{func="main",args=[],
fb40c209 1882file="hello.c",line="7"@}
e7997b74 1883(@value{GDBP})
7162c0ca
EZ
1884@end smallexample
1885
e7997b74
EZ
1886Function returning other than @code{void}. The name of the internal
1887@value{GDBN} variable storing the result is printed, together with the
1888value itself.
7162c0ca
EZ
1889
1890@smallexample
fb40c209
AC
1891-exec-finish
1892^running
e7997b74 1893(@value{GDBP})
fb40c209 1894*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
68c81b54 1895args=[@{name="a",value="1"],@{name="b",value="9"@}@},
7162c0ca 1896file="recursive2.c",line="14"@},
fb40c209 1897gdb-result-var="$1",return-value="0"
e7997b74 1898(@value{GDBP})
7162c0ca
EZ
1899@end smallexample
1900
1901
1902@subheading The @code{-exec-interrupt} Command
1903@findex -exec-interrupt
1904
1905@subsubheading Synopsis
fb40c209 1906
7162c0ca
EZ
1907@example
1908 -exec-interrupt
fb40c209 1909@end example
7162c0ca 1910
e7997b74 1911Asynchronous command. Interrupts the background execution of the target.
fb40c209 1912Note how the token associated with the stop message is the one for the
7162c0ca 1913execution command that has been interrupted. The token for the interrupt
e7997b74 1914itself only appears in the @samp{^done} output. If the user is trying to
7162c0ca 1915interrupt a non-running program, an error message will be printed.
fb40c209 1916
e7997b74 1917@subsubheading @value{GDBN} Command
7162c0ca 1918
e7997b74 1919The corresponding @value{GDBN} command is @samp{interrupt}.
7162c0ca
EZ
1920
1921@subsubheading Example
1922
1923@smallexample
e7997b74 1924(@value{GDBP})
fb40c209
AC
1925111-exec-continue
1926111^running
1927
e7997b74 1928(@value{GDBP})
fb40c209
AC
1929222-exec-interrupt
1930222^done
e7997b74 1931(@value{GDBP})
fb40c209 1932111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
dc61bc6d 1933frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@}
e7997b74 1934(@value{GDBP})
fb40c209 1935
e7997b74 1936(@value{GDBP})
fb40c209
AC
1937-exec-interrupt
1938^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
e7997b74 1939(@value{GDBP})
7162c0ca 1940@end smallexample
fb40c209 1941
7162c0ca
EZ
1942
1943@subheading The @code{-exec-next} Command
1944@findex -exec-next
1945
1946@subsubheading Synopsis
1947
1948@example
1949 -exec-next
fb40c209
AC
1950@end example
1951
7162c0ca 1952Asynchronous command. Resumes execution of the inferior program, stopping
fb40c209
AC
1953when the beginning of the next source line is reached.
1954
e7997b74 1955@subsubheading @value{GDBN} Command
fb40c209 1956
e7997b74 1957The corresponding @value{GDBN} command is @samp{next}.
7162c0ca
EZ
1958
1959@subsubheading Example
1960
1961@smallexample
fb40c209
AC
1962-exec-next
1963^running
e7997b74 1964(@value{GDBP})
fb40c209 1965*stopped,reason="end-stepping-range",line="8",file="hello.c"
e7997b74 1966(@value{GDBP})
7162c0ca
EZ
1967@end smallexample
1968
1969
1970@subheading The @code{-exec-next-instruction} Command
1971@findex -exec-next-instruction
1972
1973@subsubheading Synopsis
1974
1975@example
1976 -exec-next-instruction
fb40c209
AC
1977@end example
1978
7162c0ca 1979Asynchronous command. Executes one machine instruction. If the
fb40c209
AC
1980instruction is a function call continues until the function returns. If
1981the program stops at an instruction in the middle of a source line, the
1982address will be printed as well.
fb40c209 1983
e7997b74 1984@subsubheading @value{GDBN} Command
7162c0ca 1985
e7997b74 1986The corresponding @value{GDBN} command is @samp{nexti}.
7162c0ca
EZ
1987
1988@subsubheading Example
1989
1990@smallexample
e7997b74 1991(@value{GDBP})
7162c0ca 1992-exec-next-instruction
fb40c209
AC
1993^running
1994
e7997b74 1995(@value{GDBP})
fb40c209
AC
1996*stopped,reason="end-stepping-range",
1997addr="0x000100d4",line="5",file="hello.c"
e7997b74 1998(@value{GDBP})
7162c0ca
EZ
1999@end smallexample
2000
fb40c209 2001
7162c0ca
EZ
2002@subheading The @code{-exec-return} Command
2003@findex -exec-return
fb40c209 2004
7162c0ca 2005@subsubheading Synopsis
fb40c209 2006
fb40c209 2007@example
7162c0ca
EZ
2008 -exec-return
2009@end example
2010
2011Makes current function return immediately. Doesn't execute the inferior.
2012Displays the new current frame.
2013
e7997b74 2014@subsubheading @value{GDBN} Command
7162c0ca 2015
e7997b74 2016The corresponding @value{GDBN} command is @samp{return}.
7162c0ca
EZ
2017
2018@subsubheading Example
2019
2020@smallexample
e7997b74 2021(@value{GDBP})
fb40c209
AC
2022200-break-insert callee4
2023200^done,bkpt=@{number="1",addr="0x00010734",
2024file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
e7997b74 2025(@value{GDBP})
7162c0ca 2026000-exec-run
fb40c209 2027000^running
e7997b74 2028(@value{GDBP})
fb40c209 2029000*stopped,reason="breakpoint-hit",bkptno="1",
68c81b54 2030frame=@{func="callee4",args=[],
fb40c209 2031file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
e7997b74 2032(@value{GDBP})
fb40c209
AC
2033205-break-delete
2034205^done
e7997b74 2035(@value{GDBP})
fb40c209 2036111-exec-return
9f2aab2d 2037111^done,frame=@{level="0",func="callee3",
68c81b54
AC
2038args=[@{name="strarg",
2039value="0x11940 \"A string argument.\""@}],
fb40c209 2040file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
e7997b74 2041(@value{GDBP})
7162c0ca
EZ
2042@end smallexample
2043
2044
2045@subheading The @code{-exec-run} Command
2046@findex -exec-run
2047
2048@subsubheading Synopsis
2049
2050@example
2051 -exec-run
fb40c209
AC
2052@end example
2053
7162c0ca
EZ
2054Asynchronous command. Starts execution of the inferior from the
2055beginning. The inferior executes until either a breakpoint is
fb40c209
AC
2056encountered or the program exits.
2057
e7997b74 2058@subsubheading @value{GDBN} Command
fb40c209 2059
e7997b74 2060The corresponding @value{GDBN} command is @samp{run}.
7162c0ca
EZ
2061
2062@subsubheading Example
2063
2064@smallexample
e7997b74 2065(@value{GDBP})
fb40c209
AC
2066-break-insert main
2067^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
e7997b74 2068(@value{GDBP})
fb40c209
AC
2069-exec-run
2070^running
e7997b74 2071(@value{GDBP})
fb40c209 2072*stopped,reason="breakpoint-hit",bkptno="1",
68c81b54 2073frame=@{func="main",args=[],file="recursive2.c",line="4"@}
e7997b74 2074(@value{GDBP})
7162c0ca
EZ
2075@end smallexample
2076
fb40c209 2077
7162c0ca
EZ
2078@subheading The @code{-exec-show-arguments} Command
2079@findex -exec-show-arguments
2080
2081@subsubheading Synopsis
2082
2083@example
2084 -exec-show-arguments
2085@end example
fb40c209 2086
fb40c209 2087Print the arguments of the program.
7162c0ca 2088
e7997b74 2089@subsubheading @value{GDBN} Command
7162c0ca 2090
e7997b74 2091The corresponding @value{GDBN} command is @samp{show args}.
7162c0ca
EZ
2092
2093@subsubheading Example
fb40c209
AC
2094N.A.
2095
7162c0ca
EZ
2096@c @subheading -exec-signal
2097
2098@subheading The @code{-exec-step} Command
2099@findex -exec-step
2100
2101@subsubheading Synopsis
fb40c209 2102
7162c0ca
EZ
2103@example
2104 -exec-step
2105@end example
2106
2107Asynchronous command. Resumes execution of the inferior program, stopping
fb40c209 2108when the beginning of the next source line is reached, if the next
7162c0ca 2109source line is not a function call. If it is, stop at the first
fb40c209
AC
2110instruction of the called function.
2111
e7997b74 2112@subsubheading @value{GDBN} Command
7162c0ca 2113
e7997b74 2114The corresponding @value{GDBN} command is @samp{step}.
7162c0ca
EZ
2115
2116@subsubheading Example
fb40c209 2117
fb40c209 2118Stepping into a function:
7162c0ca
EZ
2119
2120@smallexample
fb40c209
AC
2121-exec-step
2122^running
e7997b74 2123(@value{GDBP})
7162c0ca 2124*stopped,reason="end-stepping-range",
68c81b54
AC
2125frame=@{func="foo",args=[@{name="a",value="10"@},
2126@{name="b",value="0"@}],file="recursive2.c",line="11"@}
e7997b74 2127(@value{GDBP})
7162c0ca
EZ
2128@end smallexample
2129
2130Regular stepping:
2131
2132@smallexample
fb40c209
AC
2133-exec-step
2134^running
e7997b74 2135(@value{GDBP})
fb40c209 2136*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
e7997b74 2137(@value{GDBP})
7162c0ca
EZ
2138@end smallexample
2139
2140
2141@subheading The @code{-exec-step-instruction} Command
2142@findex -exec-step-instruction
2143
2144@subsubheading Synopsis
2145
2146@example
2147 -exec-step-instruction
fb40c209
AC
2148@end example
2149
7162c0ca 2150Asynchronous command. Resumes the inferior which executes one machine
e7997b74 2151instruction. The output, once @value{GDBN} has stopped, will vary depending on
502d24d4
EZ
2152whether we have stopped in the middle of a source line or not. In the
2153former case, the address at which the program stopped will be printed as
2154well.
fb40c209 2155
e7997b74 2156@subsubheading @value{GDBN} Command
fb40c209 2157
e7997b74 2158The corresponding @value{GDBN} command is @samp{stepi}.
7162c0ca
EZ
2159
2160@subsubheading Example
2161
2162@smallexample
e7997b74 2163(@value{GDBP})
fb40c209
AC
2164-exec-step-instruction
2165^running
2166
e7997b74 2167(@value{GDBP})
fb40c209 2168*stopped,reason="end-stepping-range",
68c81b54 2169frame=@{func="foo",args=[],file="try.c",line="10"@}
e7997b74 2170(@value{GDBP})
fb40c209
AC
2171-exec-step-instruction
2172^running
2173
e7997b74 2174(@value{GDBP})
fb40c209 2175*stopped,reason="end-stepping-range",
68c81b54 2176frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@}
e7997b74 2177(@value{GDBP})
7162c0ca
EZ
2178@end smallexample
2179
2180
2181@subheading The @code{-exec-until} Command
2182@findex -exec-until
2183
2184@subsubheading Synopsis
2185
2186@example
2187 -exec-until [ @var{location} ]
fb40c209
AC
2188@end example
2189
7162c0ca
EZ
2190Asynchronous command. Executes the inferior until the @var{location}
2191specified in the argument is reached. If there is no argument, the inferior
fb40c209 2192executes until a source line greater than the current one is reached.
1c85fbd9 2193The reason for stopping in this case will be @samp{location-reached}.
fb40c209 2194
e7997b74 2195@subsubheading @value{GDBN} Command
7162c0ca 2196
e7997b74 2197The corresponding @value{GDBN} command is @samp{until}.
7162c0ca
EZ
2198
2199@subsubheading Example
2200
2201@smallexample
e7997b74 2202(@value{GDBP})
fb40c209
AC
2203-exec-until recursive2.c:6
2204^running
e7997b74 2205(@value{GDBP})
fb40c209 2206x = 55
68c81b54 2207*stopped,reason="location-reached",frame=@{func="main",args=[],
fb40c209 2208file="recursive2.c",line="6"@}
e7997b74 2209(@value{GDBP})
7162c0ca 2210@end smallexample
fb40c209 2211
7162c0ca
EZ
2212@ignore
2213@subheading -file-clear
fb40c209 2214Is this going away????
7162c0ca
EZ
2215@end ignore
2216
fb40c209 2217
7162c0ca
EZ
2218@subheading The @code{-file-exec-and-symbols} Command
2219@findex -file-exec-and-symbols
2220
2221@subsubheading Synopsis
fb40c209 2222
fb40c209 2223@example
7162c0ca
EZ
2224 -file-exec-and-symbols @var{file}
2225@end example
2226
2227Specify the executable file to be debugged. This file is the one from
2228which the symbol table is also read. If no file is specified, the
2229command clears the executable and symbol information. If breakpoints
e7997b74 2230are set when using this command with no arguments, @value{GDBN} will produce
d68fc559 2231error messages. Otherwise, no output is produced, except a completion
7162c0ca
EZ
2232notification.
2233
e7997b74 2234@subsubheading @value{GDBN} Command
7162c0ca 2235
e7997b74 2236The corresponding @value{GDBN} command is @samp{file}.
7162c0ca
EZ
2237
2238@subsubheading Example
2239
2240@smallexample
e7997b74 2241(@value{GDBP})
fb40c209
AC
2242-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2243^done
e7997b74 2244(@value{GDBP})
7162c0ca
EZ
2245@end smallexample
2246
2247
2248@subheading The @code{-file-exec-file} Command
2249@findex -file-exec-file
2250
2251@subsubheading Synopsis
2252
2253@example
2254 -file-exec-file @var{file}
fb40c209
AC
2255@end example
2256
7162c0ca
EZ
2257Specify the executable file to be debugged. Unlike
2258@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
e7997b74 2259from this file. If used without argument, @value{GDBN} clears the information
fb40c209
AC
2260about the executable file. No output is produced, except a completion
2261notification.
fb40c209 2262
e7997b74 2263@subsubheading @value{GDBN} Command
7162c0ca 2264
e7997b74 2265The corresponding @value{GDBN} command is @samp{exec-file}.
7162c0ca
EZ
2266
2267@subsubheading Example
2268
2269@smallexample
e7997b74 2270(@value{GDBP})
fb40c209
AC
2271-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2272^done
e7997b74 2273(@value{GDBP})
7162c0ca
EZ
2274@end smallexample
2275
2276
2277@subheading The @code{-file-list-exec-sections} Command
2278@findex -file-list-exec-sections
2279
2280@subsubheading Synopsis
2281
2282@example
2283 -file-list-exec-sections
fb40c209
AC
2284@end example
2285
fb40c209 2286List the sections of the current executable file.
7162c0ca 2287
e7997b74 2288@subsubheading @value{GDBN} Command
7162c0ca 2289
e7997b74 2290The @value{GDBN} command @samp{info file} shows, among the rest, the same
7162c0ca
EZ
2291information as this command. @code{gdbtk} has a corresponding command
2292@samp{gdb_load_info}.
2293
2294@subsubheading Example
fb40c209
AC
2295N.A.
2296
7162c0ca
EZ
2297
2298@subheading The @code{-file-list-exec-source-files} Command
2299@findex -file-list-exec-source-files
2300
2301@subsubheading Synopsis
2302
2303@example
2304 -file-list-exec-source-files
2305@end example
2306
fb40c209 2307List the source files for the current executable.
7162c0ca 2308
e7997b74 2309@subsubheading @value{GDBN} Command
7162c0ca 2310
e7997b74 2311There's no @value{GDBN} command which directly corresponds to this one.
7162c0ca
EZ
2312@code{gdbtk} has an analogous command @samp{gdb_listfiles}.
2313
2314@subsubheading Example
fb40c209
AC
2315N.A.
2316
7162c0ca
EZ
2317
2318@subheading The @code{-file-list-shared-libraries} Command
2319@findex -file-list-shared-libraries
2320
2321@subsubheading Synopsis
2322
2323@example
2324 -file-list-shared-libraries
2325@end example
2326
fb40c209 2327List the shared libraries in the program.
7162c0ca 2328
e7997b74 2329@subsubheading @value{GDBN} Command
7162c0ca 2330
e7997b74 2331The corresponding @value{GDBN} command is @samp{info shared}.
7162c0ca
EZ
2332
2333@subsubheading Example
fb40c209
AC
2334N.A.
2335
7162c0ca
EZ
2336
2337@subheading The @code{-file-list-symbol-files} Command
2338@findex -file-list-symbol-files
2339
2340@subsubheading Synopsis
2341
2342@example
2343 -file-list-symbol-files
2344@end example
2345
fb40c209 2346List symbol files.
7162c0ca 2347
e7997b74 2348@subsubheading @value{GDBN} Command
7162c0ca 2349
e7997b74 2350The corresponding @value{GDBN} command is @samp{info file} (part of it).
7162c0ca
EZ
2351
2352@subsubheading Example
fb40c209
AC
2353N.A.
2354
fb40c209 2355
7162c0ca
EZ
2356@subheading The @code{-file-symbol-file} Command
2357@findex -file-symbol-file
2358
2359@subsubheading Synopsis
2360
fb40c209 2361@example
7162c0ca
EZ
2362 -file-symbol-file @var{file}
2363@end example
2364
2365Read symbol table info from the specified @var{file} argument. When
e7997b74 2366used without arguments, clears @value{GDBN}'s symbol table info. No output is
7162c0ca
EZ
2367produced, except for a completion notification.
2368
e7997b74 2369@subsubheading @value{GDBN} Command
7162c0ca 2370
e7997b74 2371The corresponding @value{GDBN} command is @samp{symbol-file}.
7162c0ca
EZ
2372
2373@subsubheading Example
2374
2375@smallexample
e7997b74 2376(@value{GDBP})
fb40c209
AC
2377-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
2378^done
e7997b74 2379(@value{GDBP})
7162c0ca 2380@end smallexample
fb40c209 2381
7162c0ca 2382@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d68fc559 2383@node GDB/MI Miscellaneous Commands
e7997b74 2384@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
fb40c209 2385
7162c0ca 2386@c @subheading -gdb-complete
fb40c209 2387
7162c0ca
EZ
2388@subheading The @code{-gdb-exit} Command
2389@findex -gdb-exit
fb40c209 2390
7162c0ca 2391@subsubheading Synopsis
fb40c209 2392
fb40c209 2393@example
7162c0ca
EZ
2394 -gdb-exit
2395@end example
2396
e7997b74 2397Exit @value{GDBN} immediately.
7162c0ca 2398
e7997b74 2399@subsubheading @value{GDBN} Command
7162c0ca
EZ
2400
2401Approximately corresponds to @samp{quit}.
2402
2403@subsubheading Example
2404
2405@smallexample
e7997b74 2406(@value{GDBP})
fb40c209 2407-gdb-exit
7162c0ca
EZ
2408@end smallexample
2409
2410@subheading The @code{-gdb-set} Command
2411@findex -gdb-set
2412
2413@subsubheading Synopsis
2414
2415@example
2416 -gdb-set
fb40c209
AC
2417@end example
2418
e7997b74 2419Set an internal @value{GDBN} variable.
7162c0ca 2420@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
fb40c209 2421
e7997b74 2422@subsubheading @value{GDBN} Command
fb40c209 2423
e7997b74 2424The corresponding @value{GDBN} command is @samp{set}.
7162c0ca
EZ
2425
2426@subsubheading Example
2427
2428@smallexample
e7997b74 2429(@value{GDBP})
fb40c209
AC
2430-gdb-set $foo=3
2431^done
e7997b74 2432(@value{GDBP})
7162c0ca
EZ
2433@end smallexample
2434
2435
2436@subheading The @code{-gdb-show} Command
2437@findex -gdb-show
2438
2439@subsubheading Synopsis
2440
2441@example
2442 -gdb-show
fb40c209
AC
2443@end example
2444
e7997b74 2445Show the current value of a @value{GDBN} variable.
fb40c209 2446
e7997b74 2447@subsubheading @value{GDBN} command
fb40c209 2448
e7997b74 2449The corresponding @value{GDBN} command is @samp{show}.
7162c0ca
EZ
2450
2451@subsubheading Example
2452
2453@smallexample
e7997b74 2454(@value{GDBP})
fb40c209
AC
2455-gdb-show annotate
2456^done,value="0"
e7997b74 2457(@value{GDBP})
7162c0ca 2458@end smallexample
fb40c209 2459
7162c0ca 2460@c @subheading -gdb-source
fb40c209 2461
fb40c209 2462
7162c0ca
EZ
2463@subheading The @code{-gdb-version} Command
2464@findex -gdb-version
2465
2466@subsubheading Synopsis
fb40c209 2467
fb40c209 2468@example
7162c0ca
EZ
2469 -gdb-version
2470@end example
2471
e7997b74 2472Show version information for @value{GDBN}. Used mostly in testing.
7162c0ca 2473
e7997b74 2474@subsubheading @value{GDBN} Command
7162c0ca 2475
e7997b74 2476There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this
7162c0ca
EZ
2477information when you start an interactive session.
2478
2479@subsubheading Example
2480
2481@c This example modifies the actual output from GDB to avoid overfull
2482@c box in TeX.
2483@smallexample
e7997b74 2484(@value{GDBP})
fb40c209 2485-gdb-version
7162c0ca
EZ
2486~GNU gdb 5.2.1
2487~Copyright 2000 Free Software Foundation, Inc.
2488~GDB is free software, covered by the GNU General Public License, and
2489~you are welcome to change it and/or distribute copies of it under
2490~ certain conditions.
fb40c209 2491~Type "show copying" to see the conditions.
7162c0ca
EZ
2492~There is absolutely no warranty for GDB. Type "show warranty" for
2493~ details.
2494~This GDB was configured as
2495 "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
fb40c209 2496^done
e7997b74 2497(@value{GDBP})
7162c0ca 2498@end smallexample
fb40c209 2499
7162c0ca
EZ
2500@ignore
2501@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2502@node GDB/MI Kod Commands
2503@section @sc{gdb/mi} Kod Commands
fb40c209
AC
2504
2505The Kod commands are not implemented.
2506
7162c0ca 2507@c @subheading -kod-info
fb40c209 2508
7162c0ca 2509@c @subheading -kod-list
fb40c209 2510
7162c0ca 2511@c @subheading -kod-list-object-types
fb40c209 2512
7162c0ca 2513@c @subheading -kod-show
fb40c209 2514
7162c0ca
EZ
2515@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2516@node GDB/MI Memory Overlay Commands
2517@section @sc{gdb/mi} Memory Overlay Commands
fb40c209 2518
7162c0ca 2519The memory overlay commands are not implemented.
fb40c209 2520
7162c0ca 2521@c @subheading -overlay-auto
fb40c209 2522
7162c0ca 2523@c @subheading -overlay-list-mapping-state
fb40c209 2524
7162c0ca 2525@c @subheading -overlay-list-overlays
fb40c209 2526
7162c0ca 2527@c @subheading -overlay-map
fb40c209 2528
7162c0ca 2529@c @subheading -overlay-off
fb40c209 2530
7162c0ca 2531@c @subheading -overlay-on
fb40c209 2532
7162c0ca 2533@c @subheading -overlay-unmap
fb40c209 2534
7162c0ca
EZ
2535@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2536@node GDB/MI Signal Handling Commands
2537@section @sc{gdb/mi} Signal Handling Commands
fb40c209
AC
2538
2539Signal handling commands are not implemented.
2540
7162c0ca 2541@c @subheading -signal-handle
fb40c209 2542
7162c0ca 2543@c @subheading -signal-list-handle-actions
fb40c209 2544
7162c0ca
EZ
2545@c @subheading -signal-list-signal-types
2546@end ignore
fb40c209 2547
fb40c209 2548
7162c0ca
EZ
2549@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2550@node GDB/MI Stack Manipulation
d5e5643b 2551@section @sc{gdb/mi} Stack Manipulation Commands
7162c0ca
EZ
2552
2553
2554@subheading The @code{-stack-info-frame} Command
2555@findex -stack-info-frame
2556
2557@subsubheading Synopsis
2558
2559@example
2560 -stack-info-frame
2561@end example
2562
fb40c209 2563Get info on the current frame.
7162c0ca 2564
e7997b74 2565@subsubheading @value{GDBN} Command
7162c0ca 2566
e7997b74 2567The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
7162c0ca
EZ
2568(without arguments).
2569
2570@subsubheading Example
fb40c209
AC
2571N.A.
2572
7162c0ca
EZ
2573@subheading The @code{-stack-info-depth} Command
2574@findex -stack-info-depth
2575
2576@subsubheading Synopsis
2577
fb40c209 2578@example
7162c0ca
EZ
2579 -stack-info-depth [ @var{max-depth} ]
2580@end example
2581
2582Return the depth of the stack. If the integer argument @var{max-depth}
2583is specified, do not count beyond @var{max-depth} frames.
2584
e7997b74 2585@subsubheading @value{GDBN} Command
7162c0ca 2586
e7997b74 2587There's no equivalent @value{GDBN} command.
7162c0ca
EZ
2588
2589@subsubheading Example
2590
2591For a stack with frame levels 0 through 11:
2592
2593@smallexample
e7997b74 2594(@value{GDBP})
fb40c209
AC
2595-stack-info-depth
2596^done,depth="12"
e7997b74 2597(@value{GDBP})
fb40c209
AC
2598-stack-info-depth 4
2599^done,depth="4"
e7997b74 2600(@value{GDBP})
fb40c209
AC
2601-stack-info-depth 12
2602^done,depth="12"
e7997b74 2603(@value{GDBP})
fb40c209
AC
2604-stack-info-depth 11
2605^done,depth="11"
e7997b74 2606(@value{GDBP})
fb40c209
AC
2607-stack-info-depth 13
2608^done,depth="12"
e7997b74 2609(@value{GDBP})
7162c0ca
EZ
2610@end smallexample
2611
2612@subheading The @code{-stack-list-arguments} Command
2613@findex -stack-list-arguments
2614
2615@subsubheading Synopsis
fb40c209 2616
fb40c209 2617@example
7162c0ca
EZ
2618 -stack-list-arguments @var{show-values}
2619 [ @var{low-frame} @var{high-frame} ]
2620@end example
2621
2622Display a list of the arguments for the frames between @var{low-frame}
2623and @var{high-frame} (inclusive). If @var{low-frame} and
2624@var{high-frame} are not provided, list the arguments for the whole call
2625stack.
2626
2627The @var{show-values} argument must have a value of 0 or 1. A value of
26280 means that only the names of the arguments are listed, a value of 1
d68fc559 2629means that both names and values of the arguments are printed.
7162c0ca 2630
e7997b74 2631@subsubheading @value{GDBN} Command
7162c0ca 2632
e7997b74 2633@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
7162c0ca
EZ
2634@samp{gdb_get_args} command which partially overlaps with the
2635functionality of @samp{-stack-list-arguments}.
2636
2637@subsubheading Example
2638
2639@smallexample
e7997b74 2640(@value{GDBP})
fb40c209
AC
2641-stack-list-frames
2642^done,
d5e5643b 2643stack=[
9f2aab2d 2644frame=@{level="0",addr="0x00010734",func="callee4",
fb40c209 2645file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
9f2aab2d 2646frame=@{level="1",addr="0x0001076c",func="callee3",
fb40c209 2647file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
9f2aab2d 2648frame=@{level="2",addr="0x0001078c",func="callee2",
fb40c209 2649file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
9f2aab2d 2650frame=@{level="3",addr="0x000107b4",func="callee1",
fb40c209 2651file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
9f2aab2d 2652frame=@{level="4",addr="0x000107e0",func="main",
d5e5643b 2653file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
e7997b74 2654(@value{GDBP})
fb40c209
AC
2655-stack-list-arguments 0
2656^done,
d5e5643b 2657stack-args=[
dc61bc6d
AC
2658frame=@{level="0",args=[]@},
2659frame=@{level="1",args=[name="strarg"]@},
2660frame=@{level="2",args=[name="intarg",name="strarg"]@},
2661frame=@{level="3",args=[name="intarg",name="strarg",name="fltarg"]@},
2662frame=@{level="4",args=[]@}]
e7997b74 2663(@value{GDBP})
fb40c209
AC
2664-stack-list-arguments 1
2665^done,
d5e5643b 2666stack-args=[
dc61bc6d 2667frame=@{level="0",args=[]@},
7162c0ca 2668frame=@{level="1",
dc61bc6d
AC
2669 args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
2670frame=@{level="2",args=[
fb40c209 2671@{name="intarg",value="2"@},
dc61bc6d
AC
2672@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
2673@{frame=@{level="3",args=[
fb40c209
AC
2674@{name="intarg",value="2"@},
2675@{name="strarg",value="0x11940 \"A string argument.\""@},
dc61bc6d
AC
2676@{name="fltarg",value="3.5"@}]@},
2677frame=@{level="4",args=[]@}]
e7997b74 2678(@value{GDBP})
fb40c209 2679-stack-list-arguments 0 2 2
dc61bc6d 2680^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}]
e7997b74 2681(@value{GDBP})
fb40c209 2682-stack-list-arguments 1 2 2
d5e5643b 2683^done,stack-args=[frame=@{level="2",
dc61bc6d
AC
2684args=[@{name="intarg",value="2"@},
2685@{name="strarg",value="0x11940 \"A string argument.\""@}]@}]
e7997b74 2686(@value{GDBP})
7162c0ca
EZ
2687@end smallexample
2688
2689@c @subheading -stack-list-exception-handlers
2690
2691
2692@subheading The @code{-stack-list-frames} Command
2693@findex -stack-list-frames
2694
2695@subsubheading Synopsis
2696
2697@example
2698 -stack-list-frames [ @var{low-frame} @var{high-frame} ]
fb40c209
AC
2699@end example
2700
7162c0ca
EZ
2701List the frames currently on the stack. For each frame it displays the
2702following info:
fb40c209 2703
fb40c209 2704@table @samp
7162c0ca 2705@item @var{level}
fb40c209 2706The frame number, 0 being the topmost frame, i.e. the innermost function.
7162c0ca
EZ
2707@item @var{addr}
2708The @code{$pc} value for that frame.
2709@item @var{func}
2710Function name.
2711@item @var{file}
2712File name of the source file where the function lives.
2713@item @var{line}
2714Line number corresponding to the @code{$pc}.
fb40c209
AC
2715@end table
2716
7162c0ca
EZ
2717If invoked without arguments, this command prints a backtrace for the
2718whole stack. If given two integer arguments, it shows the frames whose
2719levels are between the two arguments (inclusive). If the two arguments
2720are equal, it shows the single frame at the corresponding level.
fb40c209 2721
e7997b74 2722@subsubheading @value{GDBN} Command
fb40c209 2723
e7997b74 2724The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
fb40c209 2725
7162c0ca
EZ
2726@subsubheading Example
2727
2728Full stack backtrace:
2729
2730@smallexample
e7997b74 2731(@value{GDBP})
fb40c209
AC
2732-stack-list-frames
2733^done,stack=
9f2aab2d 2734[frame=@{level="0",addr="0x0001076c",func="foo",
7162c0ca 2735 file="recursive2.c",line="11"@},
9f2aab2d 2736frame=@{level="1",addr="0x000107a4",func="foo",
7162c0ca 2737 file="recursive2.c",line="14"@},
9f2aab2d 2738frame=@{level="2",addr="0x000107a4",func="foo",
7162c0ca 2739 file="recursive2.c",line="14"@},
9f2aab2d 2740frame=@{level="3",addr="0x000107a4",func="foo",
7162c0ca 2741 file="recursive2.c",line="14"@},
9f2aab2d 2742frame=@{level="4",addr="0x000107a4",func="foo",
7162c0ca 2743 file="recursive2.c",line="14"@},
9f2aab2d 2744frame=@{level="5",addr="0x000107a4",func="foo",
7162c0ca 2745 file="recursive2.c",line="14"@},
9f2aab2d 2746frame=@{level="6",addr="0x000107a4",func="foo",
7162c0ca 2747 file="recursive2.c",line="14"@},
9f2aab2d 2748frame=@{level="7",addr="0x000107a4",func="foo",
7162c0ca 2749 file="recursive2.c",line="14"@},
9f2aab2d 2750frame=@{level="8",addr="0x000107a4",func="foo",
7162c0ca 2751 file="recursive2.c",line="14"@},
9f2aab2d 2752frame=@{level="9",addr="0x000107a4",func="foo",
7162c0ca
EZ
2753 file="recursive2.c",line="14"@},
2754frame=@{level="10",addr="0x000107a4",func="foo",
2755 file="recursive2.c",line="14"@},
2756frame=@{level="11",addr="0x00010738",func="main",
d5e5643b 2757 file="recursive2.c",line="4"@}]
e7997b74 2758(@value{GDBP})
7162c0ca
EZ
2759@end smallexample
2760
e7997b74 2761Show frames between @var{low_frame} and @var{high_frame}:
7162c0ca
EZ
2762
2763@smallexample
e7997b74 2764(@value{GDBP})
fb40c209
AC
2765-stack-list-frames 3 5
2766^done,stack=
9f2aab2d 2767[frame=@{level="3",addr="0x000107a4",func="foo",
7162c0ca 2768 file="recursive2.c",line="14"@},
9f2aab2d 2769frame=@{level="4",addr="0x000107a4",func="foo",
7162c0ca 2770 file="recursive2.c",line="14"@},
9f2aab2d 2771frame=@{level="5",addr="0x000107a4",func="foo",
d5e5643b 2772 file="recursive2.c",line="14"@}]
e7997b74 2773(@value{GDBP})
7162c0ca
EZ
2774@end smallexample
2775
2776Show a single frame:
2777
2778@smallexample
e7997b74 2779(@value{GDBP})
fb40c209
AC
2780-stack-list-frames 3 3
2781^done,stack=
9f2aab2d 2782[frame=@{level="3",addr="0x000107a4",func="foo",
d5e5643b 2783 file="recursive2.c",line="14"@}]
e7997b74 2784(@value{GDBP})
7162c0ca
EZ
2785@end smallexample
2786
2787
2788@subheading The @code{-stack-list-locals} Command
2789@findex -stack-list-locals
2790
2791@subsubheading Synopsis
2792
2793@example
2794 -stack-list-locals @var{print-values}
2795@end example
2796
d68fc559 2797Display the local variable names for the current frame. With an
7162c0ca
EZ
2798argument of 0 prints only the names of the variables, with argument of 1
2799prints also their values.
2800
e7997b74 2801@subsubheading @value{GDBN} Command
7162c0ca 2802
e7997b74 2803@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
7162c0ca
EZ
2804
2805@subsubheading Example
2806
2807@smallexample
e7997b74 2808(@value{GDBP})
7162c0ca 2809-stack-list-locals 0
dc61bc6d 2810^done,locals=[name="A",name="B",name="C"]
e7997b74 2811(@value{GDBP})
7162c0ca 2812-stack-list-locals 1
dc61bc6d
AC
2813^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
2814 @{name="C",value="3"@}]
e7997b74 2815(@value{GDBP})
7162c0ca
EZ
2816@end smallexample
2817
2818
2819@subheading The @code{-stack-select-frame} Command
2820@findex -stack-select-frame
2821
2822@subsubheading Synopsis
2823
2824@example
2825 -stack-select-frame @var{framenum}
2826@end example
2827
2828Change the current frame. Select a different frame @var{framenum} on
2829the stack.
2830
e7997b74 2831@subsubheading @value{GDBN} Command
7162c0ca 2832
e7997b74
EZ
2833The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
2834@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
7162c0ca
EZ
2835
2836@subsubheading Example
2837
2838@smallexample
e7997b74 2839(@value{GDBP})
7162c0ca
EZ
2840-stack-select-frame 2
2841^done
e7997b74 2842(@value{GDBP})
7162c0ca
EZ
2843@end smallexample
2844
2845@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2846@node GDB/MI Symbol Query
2847@section @sc{gdb/mi} Symbol Query Commands
2848
2849
2850@subheading The @code{-symbol-info-address} Command
2851@findex -symbol-info-address
2852
2853@subsubheading Synopsis
2854
2855@example
2856 -symbol-info-address @var{symbol}
2857@end example
2858
2859Describe where @var{symbol} is stored.
2860
e7997b74 2861@subsubheading @value{GDBN} Command
7162c0ca 2862
e7997b74 2863The corresponding @value{GDBN} command is @samp{info address}.
7162c0ca
EZ
2864
2865@subsubheading Example
2866N.A.
2867
2868
2869@subheading The @code{-symbol-info-file} Command
2870@findex -symbol-info-file
2871
2872@subsubheading Synopsis
2873
2874@example
2875 -symbol-info-file
2876@end example
2877
2878Show the file for the symbol.
2879
e7997b74 2880@subsubheading @value{GDBN} Command
7162c0ca 2881
e7997b74
EZ
2882There's no equivalent @value{GDBN} command. @code{gdbtk} has
2883@samp{gdb_find_file}.
7162c0ca
EZ
2884
2885@subsubheading Example
2886N.A.
2887
2888
2889@subheading The @code{-symbol-info-function} Command
2890@findex -symbol-info-function
2891
2892@subsubheading Synopsis
2893
2894@example
2895 -symbol-info-function
fb40c209
AC
2896@end example
2897
7162c0ca
EZ
2898Show which function the symbol lives in.
2899
e7997b74 2900@subsubheading @value{GDBN} Command
7162c0ca
EZ
2901
2902@samp{gdb_get_function} in @code{gdbtk}.
2903
2904@subsubheading Example
2905N.A.
2906
2907
2908@subheading The @code{-symbol-info-line} Command
2909@findex -symbol-info-line
2910
2911@subsubheading Synopsis
2912
2913@example
2914 -symbol-info-line
2915@end example
2916
2917Show the core addresses of the code for a source line.
2918
e7997b74 2919@subsubheading @value{GDBN} Command
7162c0ca 2920
e7997b74
EZ
2921The corresponding @value{GDBN} comamnd is @samp{info line}.
2922@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
7162c0ca
EZ
2923
2924@subsubheading Example
2925N.A.
2926
2927
2928@subheading The @code{-symbol-info-symbol} Command
2929@findex -symbol-info-symbol
2930
2931@subsubheading Synopsis
2932
2933@example
2934 -symbol-info-symbol @var{addr}
2935@end example
2936
2937Describe what symbol is at location @var{addr}.
2938
e7997b74 2939@subsubheading @value{GDBN} Command
7162c0ca 2940
e7997b74 2941The corresponding @value{GDBN} command is @samp{info symbol}.
7162c0ca
EZ
2942
2943@subsubheading Example
2944N.A.
2945
2946
2947@subheading The @code{-symbol-list-functions} Command
2948@findex -symbol-list-functions
2949
2950@subsubheading Synopsis
2951
2952@example
2953 -symbol-list-functions
2954@end example
2955
2956List the functions in the executable.
2957
e7997b74 2958@subsubheading @value{GDBN} Command
7162c0ca 2959
e7997b74
EZ
2960@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
2961@samp{gdb_search} in @code{gdbtk}.
7162c0ca
EZ
2962
2963@subsubheading Example
2964N.A.
2965
2966
2967@subheading The @code{-symbol-list-types} Command
2968@findex -symbol-list-types
2969
2970@subsubheading Synopsis
2971
2972@example
2973 -symbol-list-types
2974@end example
2975
2976List all the type names.
2977
e7997b74 2978@subsubheading @value{GDBN} Command
7162c0ca 2979
e7997b74 2980The corresponding commands are @samp{info types} in @value{GDBN},
7162c0ca
EZ
2981@samp{gdb_search} in @code{gdbtk}.
2982
2983@subsubheading Example
2984N.A.
2985
2986
2987@subheading The @code{-symbol-list-variables} Command
2988@findex -symbol-list-variables
2989
2990@subsubheading Synopsis
2991
2992@example
2993 -symbol-list-variables
2994@end example
2995
2996List all the global and static variable names.
2997
e7997b74 2998@subsubheading @value{GDBN} Command
7162c0ca 2999
e7997b74 3000@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
7162c0ca
EZ
3001
3002@subsubheading Example
3003N.A.
3004
3005
3006@subheading The @code{-symbol-locate} Command
3007@findex -symbol-locate
3008
3009@subsubheading Synopsis
3010
3011@example
3012 -symbol-locate
3013@end example
3014
e7997b74 3015@subsubheading @value{GDBN} Command
7162c0ca
EZ
3016
3017@samp{gdb_loc} in @code{gdbtk}.
3018
3019@subsubheading Example
3020N.A.
3021
3022
3023@subheading The @code{-symbol-type} Command
3024@findex -symbol-type
3025
3026@subsubheading Synopsis
3027
3028@example
3029 -symbol-type @var{variable}
3030@end example
3031
3032Show type of @var{variable}.
3033
e7997b74 3034@subsubheading @value{GDBN} Command
7162c0ca 3035
e7997b74 3036The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
7162c0ca
EZ
3037@samp{gdb_obj_variable}.
3038
3039@subsubheading Example
3040N.A.
3041
3042
3043@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3044@node GDB/MI Target Manipulation
3045@section @sc{gdb/mi} Target Manipulation Commands
3046
fb40c209 3047
7162c0ca
EZ
3048@subheading The @code{-target-attach} Command
3049@findex -target-attach
3050
3051@subsubheading Synopsis
fb40c209 3052
fb40c209 3053@example
7162c0ca 3054 -target-attach @var{pid} | @var{file}
fb40c209
AC
3055@end example
3056
e7997b74 3057Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
fb40c209 3058
e7997b74 3059@subsubheading @value{GDBN} command
fb40c209 3060
e7997b74 3061The corresponding @value{GDBN} command is @samp{attach}.
fb40c209 3062
7162c0ca 3063@subsubheading Example
fb40c209
AC
3064N.A.
3065
fb40c209 3066
7162c0ca
EZ
3067@subheading The @code{-target-compare-sections} Command
3068@findex -target-compare-sections
fb40c209 3069
7162c0ca 3070@subsubheading Synopsis
fb40c209 3071
7162c0ca
EZ
3072@example
3073 -target-compare-sections [ @var{section} ]
3074@end example
fb40c209 3075
7162c0ca
EZ
3076Compare data of section @var{section} on target to the exec file.
3077Without the argument, all sections are compared.
fb40c209 3078
e7997b74 3079@subsubheading @value{GDBN} Command
fb40c209 3080
e7997b74 3081The @value{GDBN} equivalent is @samp{compare-sections}.
fb40c209 3082
7162c0ca 3083@subsubheading Example
fb40c209
AC
3084N.A.
3085
fb40c209 3086
7162c0ca
EZ
3087@subheading The @code{-target-detach} Command
3088@findex -target-detach
fb40c209 3089
7162c0ca 3090@subsubheading Synopsis
fb40c209 3091
fb40c209 3092@example
7162c0ca
EZ
3093 -target-detach
3094@end example
3095
3096Disconnect from the remote target. There's no output.
3097
e7997b74 3098@subsubheading @value{GDBN} command
7162c0ca 3099
e7997b74 3100The corresponding @value{GDBN} command is @samp{detach}.
7162c0ca
EZ
3101
3102@subsubheading Example
3103
3104@smallexample
e7997b74 3105(@value{GDBP})
fb40c209
AC
3106-target-detach
3107^done
e7997b74 3108(@value{GDBP})
7162c0ca
EZ
3109@end smallexample
3110
3111
3112@subheading The @code{-target-download} Command
3113@findex -target-download
3114
3115@subsubheading Synopsis
3116
3117@example
3118 -target-download
fb40c209
AC
3119@end example
3120
fb40c209
AC
3121Loads the executable onto the remote target.
3122It prints out an update message every half second, which includes the fields:
fb40c209 3123
7162c0ca
EZ
3124@table @samp
3125@item section
3126The name of the section.
3127@item section-sent
3128The size of what has been sent so far for that section.
3129@item section-size
3130The size of the section.
3131@item total-sent
3132The total size of what was sent so far (the current and the previous sections).
3133@item total-size
3134The size of the overall executable to download.
3135@end table
3136
3137@noindent
3138Each message is sent as status record (@pxref{GDB/MI Output Syntax, ,
3139@sc{gdb/mi} Output Syntax}).
3140
3141In addition, it prints the name and size of the sections, as they are
3142downloaded. These messages include the following fields:
fb40c209 3143
7162c0ca
EZ
3144@table @samp
3145@item section
3146The name of the section.
3147@item section-size
3148The size of the section.
3149@item total-size
3150The size of the overall executable to download.
3151@end table
3152
3153@noindent
e7997b74 3154At the end, a summary is printed.
7162c0ca 3155
e7997b74 3156@subsubheading @value{GDBN} Command
7162c0ca 3157
e7997b74 3158The corresponding @value{GDBN} command is @samp{load}.
7162c0ca
EZ
3159
3160@subsubheading Example
3161
3162Note: each status message appears on a single line. Here the messages
d68fc559 3163have been broken down so that they can fit onto a page.
7162c0ca
EZ
3164
3165@smallexample
e7997b74 3166(@value{GDBP})
fb40c209
AC
3167-target-download
3168+download,@{section=".text",section-size="6668",total-size="9880"@}
3169+download,@{section=".text",section-sent="512",section-size="6668",
3170total-sent="512",total-size="9880"@}
3171+download,@{section=".text",section-sent="1024",section-size="6668",
3172total-sent="1024",total-size="9880"@}
3173+download,@{section=".text",section-sent="1536",section-size="6668",
3174total-sent="1536",total-size="9880"@}
3175+download,@{section=".text",section-sent="2048",section-size="6668",
3176total-sent="2048",total-size="9880"@}
3177+download,@{section=".text",section-sent="2560",section-size="6668",
3178total-sent="2560",total-size="9880"@}
3179+download,@{section=".text",section-sent="3072",section-size="6668",
3180total-sent="3072",total-size="9880"@}
3181+download,@{section=".text",section-sent="3584",section-size="6668",
3182total-sent="3584",total-size="9880"@}
3183+download,@{section=".text",section-sent="4096",section-size="6668",
3184total-sent="4096",total-size="9880"@}
3185+download,@{section=".text",section-sent="4608",section-size="6668",
3186total-sent="4608",total-size="9880"@}
3187+download,@{section=".text",section-sent="5120",section-size="6668",
3188total-sent="5120",total-size="9880"@}
3189+download,@{section=".text",section-sent="5632",section-size="6668",
3190total-sent="5632",total-size="9880"@}
3191+download,@{section=".text",section-sent="6144",section-size="6668",
3192total-sent="6144",total-size="9880"@}
3193+download,@{section=".text",section-sent="6656",section-size="6668",
3194total-sent="6656",total-size="9880"@}
3195+download,@{section=".init",section-size="28",total-size="9880"@}
3196+download,@{section=".fini",section-size="28",total-size="9880"@}
3197+download,@{section=".data",section-size="3156",total-size="9880"@}
3198+download,@{section=".data",section-sent="512",section-size="3156",
3199total-sent="7236",total-size="9880"@}
3200+download,@{section=".data",section-sent="1024",section-size="3156",
3201total-sent="7748",total-size="9880"@}
3202+download,@{section=".data",section-sent="1536",section-size="3156",
3203total-sent="8260",total-size="9880"@}
3204+download,@{section=".data",section-sent="2048",section-size="3156",
3205total-sent="8772",total-size="9880"@}
3206+download,@{section=".data",section-sent="2560",section-size="3156",
3207total-sent="9284",total-size="9880"@}
3208+download,@{section=".data",section-sent="3072",section-size="3156",
3209total-sent="9796",total-size="9880"@}
7162c0ca
EZ
3210^done,address="0x10004",load-size="9880",transfer-rate="6586",
3211write-rate="429"
e7997b74 3212(@value{GDBP})
7162c0ca
EZ
3213@end smallexample
3214
3215
3216@subheading The @code{-target-exec-status} Command
3217@findex -target-exec-status
3218
3219@subsubheading Synopsis
3220
3221@example
3222 -target-exec-status
fb40c209
AC
3223@end example
3224
7162c0ca
EZ
3225Provide information on the state of the target (whether it is running or
3226not, for instance).
3227
e7997b74 3228@subsubheading @value{GDBN} Command
7162c0ca 3229
e7997b74 3230There's no equivalent @value{GDBN} command.
7162c0ca
EZ
3231
3232@subsubheading Example
fb40c209
AC
3233N.A.
3234
7162c0ca
EZ
3235
3236@subheading The @code{-target-list-available-targets} Command
3237@findex -target-list-available-targets
3238
3239@subsubheading Synopsis
3240
3241@example
3242 -target-list-available-targets
3243@end example
3244
fb40c209 3245List the possible targets to connect to.
7162c0ca 3246
e7997b74 3247@subsubheading @value{GDBN} Command
7162c0ca 3248
e7997b74 3249The corresponding @value{GDBN} command is @samp{help target}.
7162c0ca
EZ
3250
3251@subsubheading Example
fb40c209
AC
3252N.A.
3253
7162c0ca
EZ
3254
3255@subheading The @code{-target-list-current-targets} Command
3256@findex -target-list-current-targets
3257
3258@subsubheading Synopsis
3259
3260@example
3261 -target-list-current-targets
3262@end example
3263
3264Describe the current target.
3265
e7997b74 3266@subsubheading @value{GDBN} Command
7162c0ca
EZ
3267
3268The corresponding information is printed by @samp{info file} (among
3269other things).
3270
3271@subsubheading Example
fb40c209
AC
3272N.A.
3273
7162c0ca
EZ
3274
3275@subheading The @code{-target-list-parameters} Command
3276@findex -target-list-parameters
3277
3278@subsubheading Synopsis
3279
3280@example
3281 -target-list-parameters
3282@end example
3283
3284@c ????
3285
e7997b74 3286@subsubheading @value{GDBN} Command
7162c0ca
EZ
3287
3288No equivalent.
3289
3290@subsubheading Example
fb40c209
AC
3291N.A.
3292
fb40c209 3293
7162c0ca
EZ
3294@subheading The @code{-target-select} Command
3295@findex -target-select
fb40c209 3296
7162c0ca
EZ
3297@subsubheading Synopsis
3298
3299@example
e7997b74 3300 -target-select @var{type} @var{parameters @dots{}}
7162c0ca
EZ
3301@end example
3302
e7997b74 3303Connect @value{GDBN} to the remote target. This command takes two args:
fb40c209
AC
3304
3305@table @samp
7162c0ca
EZ
3306@item @var{type}
3307The type of target, for instance @samp{async}, @samp{remote}, etc.
3308@item @var{parameters}
3309Device names, host names and the like. @xref{Target Commands, ,
3310Commands for managing targets}, for more details.
fb40c209 3311@end table
7162c0ca 3312
fb40c209 3313The output is a connection notification, followed by the address at
7162c0ca 3314which the target program is, in the following form:
fb40c209 3315
7162c0ca
EZ
3316@smallexample
3317^connected,addr="@var{address}",func="@var{function name}",
dc61bc6d 3318 args=[@var{arg list}]
7162c0ca 3319@end smallexample
fb40c209 3320
e7997b74 3321@subsubheading @value{GDBN} Command
7162c0ca 3322
e7997b74 3323The corresponding @value{GDBN} command is @samp{target}.
7162c0ca
EZ
3324
3325@subsubheading Example
3326
3327@smallexample
e7997b74 3328(@value{GDBP})
fb40c209 3329-target-select async /dev/ttya
dc61bc6d 3330^connected,addr="0xfe00a300",func="??",args=[]
e7997b74 3331(@value{GDBP})
7162c0ca
EZ
3332@end smallexample
3333
3334@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3335@node GDB/MI Thread Commands
3336@section @sc{gdb/mi} Thread Commands
3337
3338
3339@subheading The @code{-thread-info} Command
3340@findex -thread-info
3341
3342@subsubheading Synopsis
3343
3344@example
3345 -thread-info
fb40c209
AC
3346@end example
3347
e7997b74 3348@subsubheading @value{GDBN} command
7162c0ca
EZ
3349
3350No equivalent.
3351
3352@subsubheading Example
3353N.A.
3354
3355
3356@subheading The @code{-thread-list-all-threads} Command
3357@findex -thread-list-all-threads
3358
3359@subsubheading Synopsis
3360
3361@example
3362 -thread-list-all-threads
3363@end example
3364
e7997b74 3365@subsubheading @value{GDBN} Command
7162c0ca 3366
e7997b74 3367The equivalent @value{GDBN} command is @samp{info threads}.
7162c0ca
EZ
3368
3369@subsubheading Example
3370N.A.
3371
3372
3373@subheading The @code{-thread-list-ids} Command
3374@findex -thread-list-ids
3375
3376@subsubheading Synopsis
3377
fb40c209 3378@example
7162c0ca
EZ
3379 -thread-list-ids
3380@end example
3381
e7997b74
EZ
3382Produces a list of the currently known @value{GDBN} thread ids. At the
3383end of the list it also prints the total number of such threads.
7162c0ca 3384
e7997b74 3385@subsubheading @value{GDBN} Command
7162c0ca
EZ
3386
3387Part of @samp{info threads} supplies the same information.
3388
3389@subsubheading Example
3390
1c85fbd9 3391No threads present, besides the main process:
7162c0ca
EZ
3392
3393@smallexample
e7997b74 3394(@value{GDBP})
fb40c209
AC
3395-thread-list-ids
3396^done,thread-ids=@{@},number-of-threads="0"
e7997b74 3397(@value{GDBP})
7162c0ca
EZ
3398@end smallexample
3399
3400
1c85fbd9 3401Several threads:
7162c0ca
EZ
3402
3403@smallexample
e7997b74 3404(@value{GDBP})
fb40c209
AC
3405-thread-list-ids
3406^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
3407number-of-threads="3"
e7997b74 3408(@value{GDBP})
7162c0ca
EZ
3409@end smallexample
3410
3411
3412@subheading The @code{-thread-select} Command
3413@findex -thread-select
3414
3415@subsubheading Synopsis
3416
3417@example
3418 -thread-select @var{threadnum}
fb40c209
AC
3419@end example
3420
7162c0ca 3421Make @var{threadnum} the current thread. It prints the number of the new
fb40c209 3422current thread, and the topmost frame for that thread.
7162c0ca 3423
e7997b74 3424@subsubheading @value{GDBN} Command
7162c0ca 3425
e7997b74 3426The corresponding @value{GDBN} command is @samp{thread}.
7162c0ca
EZ
3427
3428@subsubheading Example
3429
3430@smallexample
e7997b74 3431(@value{GDBP})
fb40c209
AC
3432-exec-next
3433^running
e7997b74 3434(@value{GDBP})
fb40c209
AC
3435*stopped,reason="end-stepping-range",thread-id="2",line="187",
3436file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
e7997b74 3437(@value{GDBP})
fb40c209
AC
3438-thread-list-ids
3439^done,
7162c0ca 3440thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
fb40c209 3441number-of-threads="3"
e7997b74 3442(@value{GDBP})
fb40c209
AC
3443-thread-select 3
3444^done,new-thread-id="3",
9f2aab2d 3445frame=@{level="0",func="vprintf",
dc61bc6d
AC
3446args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
3447@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
e7997b74 3448(@value{GDBP})
7162c0ca 3449@end smallexample
fb40c209 3450
7162c0ca
EZ
3451@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3452@node GDB/MI Tracepoint Commands
3453@section @sc{gdb/mi} Tracepoint Commands
fb40c209 3454
7162c0ca 3455The tracepoint commands are not yet implemented.
fb40c209 3456
7162c0ca 3457@c @subheading -trace-actions
fb40c209 3458
7162c0ca 3459@c @subheading -trace-delete
fb40c209 3460
7162c0ca 3461@c @subheading -trace-disable
fb40c209 3462
7162c0ca 3463@c @subheading -trace-dump
fb40c209 3464
7162c0ca 3465@c @subheading -trace-enable
fb40c209 3466
7162c0ca 3467@c @subheading -trace-exists
fb40c209 3468
7162c0ca 3469@c @subheading -trace-find
fb40c209 3470
7162c0ca 3471@c @subheading -trace-frame-number
fb40c209 3472
7162c0ca 3473@c @subheading -trace-info
fb40c209 3474
7162c0ca 3475@c @subheading -trace-insert
fb40c209 3476
7162c0ca 3477@c @subheading -trace-list
fb40c209 3478
7162c0ca 3479@c @subheading -trace-pass-count
fb40c209 3480
7162c0ca 3481@c @subheading -trace-save
fb40c209 3482
7162c0ca 3483@c @subheading -trace-start
fb40c209 3484
7162c0ca 3485@c @subheading -trace-stop
fb40c209
AC
3486
3487
7162c0ca
EZ
3488@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3489@node GDB/MI Variable Objects
3490@section @sc{gdb/mi} Variable Objects
3491
fb40c209 3492
7162c0ca 3493@subheading Motivation for Variable Objects in @sc{gdb/mi}
fb40c209
AC
3494
3495For the implementation of a variable debugger window (locals, watched
d68fc559 3496expressions, etc.), we are proposing the adaptation of the existing code
7162c0ca 3497used by @code{Insight}.
fb40c209 3498
7162c0ca 3499The two main reasons for that are:
fb40c209
AC
3500
3501@enumerate 1
3502@item
7162c0ca
EZ
3503It has been proven in practice (it is already on its second generation).
3504
fb40c209
AC
3505@item
3506It will shorten development time (needless to say how important it is
7162c0ca 3507now).
fb40c209
AC
3508@end enumerate
3509
3510The original interface was designed to be used by Tcl code, so it was
1c85fbd9
EZ
3511slightly changed so it could be used through @sc{gdb/mi}. This section
3512describes the @sc{gdb/mi} operations that will be available and gives some
7162c0ca 3513hints about their use.
fb40c209
AC
3514
3515@emph{Note}: In addition to the set of operations described here, we
7162c0ca
EZ
3516expect the @sc{gui} implementation of a variable window to require, at
3517least, the following operations:
3518
3519@itemize @bullet
1c85fbd9
EZ
3520@item @code{-gdb-show} @code{output-radix}
3521@item @code{-stack-list-arguments}
3522@item @code{-stack-list-locals}
3523@item @code{-stack-select-frame}
fb40c209
AC
3524@end itemize
3525
7162c0ca 3526@subheading Introduction to Variable Objects in @sc{gdb/mi}
fb40c209 3527
7162c0ca 3528@cindex variable objects in @sc{gdb/mi}
fb40c209
AC
3529The basic idea behind variable objects is the creation of a named object
3530to represent a variable, an expression, a memory location or even a CPU
3531register. For each object created, a set of operations is available for
3532examining or changing its properties.
3533
3534Furthermore, complex data types, such as C structures, are represented
7162c0ca
EZ
3535in a tree format. For instance, the @code{struct} type variable is the
3536root and the children will represent the struct members. If a child
3537is itself of a complex type, it will also have children of its own.
3538Appropriate language differences are handled for C, C@t{++} and Java.
fb40c209
AC
3539
3540When returning the actual values of the objects, this facility allows
3541for the individual selection of the display format used in the result
3542creation. It can be chosen among: binary, decimal, hexadecimal, octal
d68fc559 3543and natural. Natural refers to a default format automatically
7162c0ca
EZ
3544chosen based on the variable type (like decimal for an @code{int}, hex
3545for pointers, etc.).
fb40c209 3546
1c85fbd9 3547The following is the complete set of @sc{gdb/mi} operations defined to
fb40c209
AC
3548access this functionality:
3549
96c405b3 3550@multitable @columnfractions .4 .6
fb40c209
AC
3551@item @strong{Operation}
3552@tab @strong{Description}
3553
1c85fbd9 3554@item @code{-var-create}
fb40c209 3555@tab create a variable object
1c85fbd9 3556@item @code{-var-delete}
fb40c209 3557@tab delete the variable object and its children
1c85fbd9 3558@item @code{-var-set-format}
fb40c209 3559@tab set the display format of this variable
1c85fbd9 3560@item @code{-var-show-format}
fb40c209 3561@tab show the display format of this variable
1c85fbd9 3562@item @code{-var-info-num-children}
fb40c209 3563@tab tells how many children this object has
1c85fbd9 3564@item @code{-var-list-children}
fb40c209 3565@tab return a list of the object's children
1c85fbd9 3566@item @code{-var-info-type}
fb40c209 3567@tab show the type of this variable object
1c85fbd9 3568@item @code{-var-info-expression}
fb40c209 3569@tab print what this variable object represents
1c85fbd9 3570@item @code{-var-show-attributes}
fb40c209 3571@tab is this variable editable? does it exist here?
1c85fbd9 3572@item @code{-var-evaluate-expression}
fb40c209 3573@tab get the value of this variable
1c85fbd9 3574@item @code{-var-assign}
fb40c209 3575@tab set the value of this variable
1c85fbd9 3576@item @code{-var-update}
fb40c209
AC
3577@tab update the variable and its children
3578@end multitable
3579
7162c0ca
EZ
3580In the next subsection we describe each operation in detail and suggest
3581how it can be used.
3582
3583@subheading Description And Use of Operations on Variable Objects
fb40c209 3584
7162c0ca
EZ
3585@subheading The @code{-var-create} Command
3586@findex -var-create
fb40c209 3587
7162c0ca 3588@subsubheading Synopsis
fb40c209 3589
7162c0ca
EZ
3590@example
3591 -var-create @{@var{name} | "-"@}
3592 @{@var{frame-addr} | "*"@} @var{expression}
3593@end example
fb40c209
AC
3594
3595This operation creates a variable object, which allows the monitoring of
3596a variable, the result of an expression, a memory cell or a CPU
3597register.
3598
7162c0ca
EZ
3599The @var{name} parameter is the string by which the object can be
3600referenced. It must be unique. If @samp{-} is specified, the varobj
1c85fbd9 3601system will generate a string ``varNNNNNN'' automatically. It will be
7162c0ca
EZ
3602unique provided that one does not specify @var{name} on that format.
3603The command fails if a duplicate name is found.
fb40c209
AC
3604
3605The frame under which the expression should be evaluated can be
7162c0ca
EZ
3606specified by @var{frame-addr}. A @samp{*} indicates that the current
3607frame should be used.
fb40c209 3608
d68fc559 3609@var{expression} is any expression valid on the current language set (must not
7162c0ca
EZ
3610begin with a @samp{*}), or one of the following:
3611
3612@itemize @bullet
3613@item
3614@samp{*@var{addr}}, where @var{addr} is the address of a memory cell
3615
3616@item
1c85fbd9 3617@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
7162c0ca
EZ
3618
3619@item
1c85fbd9 3620@samp{$@var{regname}} --- a CPU register name
7162c0ca
EZ
3621@end itemize
3622
3623@subsubheading Result
3624
fb40c209
AC
3625This operation returns the name, number of children and the type of the
3626object created. Type is returned as a string as the ones generated by
e7997b74 3627the @value{GDBN} CLI:
7162c0ca
EZ
3628
3629@example
3630 name="@var{name}",numchild="N",type="@var{type}"
3631@end example
3632
3633
3634@subheading The @code{-var-delete} Command
3635@findex -var-delete
3636
3637@subsubheading Synopsis
3638
3639@example
3640 -var-delete @var{name}
3641@end example
3642
3643Deletes a previously created variable object and all of its children.
3644
3645Returns an error if the object @var{name} is not found.
3646
3647
3648@subheading The @code{-var-set-format} Command
3649@findex -var-set-format
3650
3651@subsubheading Synopsis
3652
3653@example
3654 -var-set-format @var{name} @var{format-spec}
3655@end example
3656
3657Sets the output format for the value of the object @var{name} to be
3658@var{format-spec}.
3659
3660The syntax for the @var{format-spec} is as follows:
3661
3662@example
3663 @var{format-spec} @expansion{}
3664 @{binary | decimal | hexadecimal | octal | natural@}
3665@end example
3666
3667
3668@subheading The @code{-var-show-format} Command
3669@findex -var-show-format
3670
3671@subsubheading Synopsis
3672
3673@example
3674 -var-show-format @var{name}
3675@end example
3676
3677Returns the format used to display the value of the object @var{name}.
3678
3679@example
1c85fbd9 3680 @var{format} @expansion{}
7162c0ca
EZ
3681 @var{format-spec}
3682@end example
3683
3684
3685@subheading The @code{-var-info-num-children} Command
3686@findex -var-info-num-children
3687
3688@subsubheading Synopsis
3689
3690@example
3691 -var-info-num-children @var{name}
3692@end example
3693
3694Returns the number of children of a variable object @var{name}:
3695
3696@example
3697 numchild=@var{n}
3698@end example
fb40c209 3699
fb40c209 3700
7162c0ca
EZ
3701@subheading The @code{-var-list-children} Command
3702@findex -var-list-children
fb40c209 3703
7162c0ca 3704@subsubheading Synopsis
fb40c209 3705
7162c0ca
EZ
3706@example
3707 -var-list-children @var{name}
3708@end example
fb40c209 3709
7162c0ca 3710Returns a list of the children of the specified variable object:
fb40c209 3711
7162c0ca
EZ
3712@example
3713 numchild=@var{n},children=@{@{name=@var{name},
1c85fbd9 3714 numchild=@var{n},type=@var{type}@},@r{(repeats N times)}@}
7162c0ca 3715@end example
fb40c209 3716
fb40c209 3717
7162c0ca
EZ
3718@subheading The @code{-var-info-type} Command
3719@findex -var-info-type
fb40c209 3720
7162c0ca 3721@subsubheading Synopsis
fb40c209 3722
7162c0ca
EZ
3723@example
3724 -var-info-type @var{name}
3725@end example
fb40c209 3726
7162c0ca 3727Returns the type of the specified variable @var{name}. The type is
e7997b74
EZ
3728returned as a string in the same format as it is output by the
3729@value{GDBN} CLI:
fb40c209 3730
7162c0ca
EZ
3731@example
3732 type=@var{typename}
3733@end example
fb40c209 3734
fb40c209 3735
7162c0ca
EZ
3736@subheading The @code{-var-info-expression} Command
3737@findex -var-info-expression
fb40c209 3738
7162c0ca 3739@subsubheading Synopsis
fb40c209 3740
7162c0ca
EZ
3741@example
3742 -var-info-expression @var{name}
3743@end example
fb40c209 3744
7162c0ca 3745Returns what is represented by the variable object @var{name}:
fb40c209 3746
7162c0ca
EZ
3747@example
3748 lang=@var{lang-spec},exp=@var{expression}
3749@end example
fb40c209 3750
7162c0ca
EZ
3751@noindent
3752where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}.
fb40c209 3753
7162c0ca
EZ
3754@subheading The @code{-var-show-attributes} Command
3755@findex -var-show-attributes
fb40c209 3756
7162c0ca 3757@subsubheading Synopsis
fb40c209 3758
7162c0ca
EZ
3759@example
3760 -var-show-attributes @var{name}
3761@end example
fb40c209 3762
7162c0ca 3763List attributes of the specified variable object @var{name}:
fb40c209 3764
7162c0ca
EZ
3765@example
3766 status=@var{attr} [ ( ,@var{attr} )* ]
3767@end example
fb40c209 3768
7162c0ca
EZ
3769@noindent
3770where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
fb40c209 3771
7162c0ca
EZ
3772@subheading The @code{-var-evaluate-expression} Command
3773@findex -var-evaluate-expression
fb40c209 3774
7162c0ca 3775@subsubheading Synopsis
fb40c209 3776
7162c0ca
EZ
3777@example
3778 -var-evaluate-expression @var{name}
3779@end example
fb40c209
AC
3780
3781Evaluates the expression that is represented by the specified variable
3782object and returns its value as a string in the current format specified
7162c0ca
EZ
3783for the object:
3784
3785@example
3786 value=@var{value}
3787@end example
3788
7501537f
AC
3789Note that one must invoke @code{-var-list-children} for a variable
3790before the value of a child variable can be evaluated.
3791
7162c0ca
EZ
3792@subheading The @code{-var-assign} Command
3793@findex -var-assign
fb40c209 3794
7162c0ca 3795@subsubheading Synopsis
fb40c209 3796
7162c0ca
EZ
3797@example
3798 -var-assign @var{name} @var{expression}
3799@end example
fb40c209 3800
7162c0ca 3801Assigns the value of @var{expression} to the variable object specified
46ae13f0
JJ
3802by @var{name}. The object must be @samp{editable}. If the variable's
3803value is altered by the assign, the variable will show up in any
3804subsequent @code{-var-update} list.
3805
3806@subsubheading Example
3807
3808@example
3809(@value{GDBP})
3810-var-assign var1 3
3811^done,value="3"
3812(@value{GDBP})
3813-var-update *
3814^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}]
3815(@value{GDBP})
3816@end example
fb40c209 3817
7162c0ca
EZ
3818@subheading The @code{-var-update} Command
3819@findex -var-update
fb40c209 3820
7162c0ca
EZ
3821@subsubheading Synopsis
3822
3823@example
3824 -var-update @{@var{name} | "*"@}
3825@end example
fb40c209 3826
7162c0ca
EZ
3827Update the value of the variable object @var{name} by evaluating its
3828expression after fetching all the new values from memory or registers.
3829A @samp{*} causes all existing variable objects to be updated.
This page took 0.427828 seconds and 4 git commands to generate.