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