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