OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [doc/] [gdb.info-9] - Blame information for rev 106

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
This is ./gdb.info, produced by Makeinfo version 3.12f from gdb.texinfo.
2
 
3
INFO-DIR-SECTION Programming & development tools.
4
START-INFO-DIR-ENTRY
5
* Gdb: (gdb).                     The GNU debugger.
6
END-INFO-DIR-ENTRY
7
 
8
   This file documents the GNU debugger GDB.
9
 
10
   This is the Eighth Edition, March 2000, of `Debugging with GDB: the
11
GNU Source-Level Debugger' for GDB Version 5.0.
12
 
13
   Copyright (C) 1988-2000 Free Software Foundation, Inc.
14
 
15
   Permission is granted to make and distribute verbatim copies of this
16
manual provided the copyright notice and this permission notice are
17
preserved on all copies.
18
 
19
   Permission is granted to copy and distribute modified versions of
20
this manual under the conditions for verbatim copying, provided also
21
that the entire resulting derived work is distributed under the terms
22
of a permission notice identical to this one.
23
 
24
   Permission is granted to copy and distribute translations of this
25
manual into another language, under the above conditions for modified
26
versions.
27
 
28

29
File: gdb.info,  Node: Screen Size,  Next: Numbers,  Prev: History,  Up: Controlling GDB
30
 
31
Screen size
32
===========
33
 
34
   Certain commands to GDB may produce large amounts of information
35
output to the screen.  To help you read all of it, GDB pauses and asks
36
you for input at the end of each page of output.  Type  when you
37
want to continue the output, or `q' to discard the remaining output.
38
Also, the screen width setting determines when to wrap lines of output.
39
Depending on what is being printed, GDB tries to break the line at a
40
readable place, rather than simply letting it overflow onto the
41
following line.
42
 
43
   Normally GDB knows the size of the screen from the terminal driver
44
software.  For example, on Unix GDB uses the termcap data base together
45
with the value of the `TERM' environment variable and the `stty rows'
46
and `stty cols' settings.  If this is not correct, you can override it
47
with the `set height' and `set width' commands:
48
 
49
`set height LPP'
50
`show height'
51
`set width CPL'
52
`show width'
53
     These `set' commands specify a screen height of LPP lines and a
54
     screen width of CPL characters.  The associated `show' commands
55
     display the current settings.
56
 
57
     If you specify a height of zero lines, GDB does not pause during
58
     output no matter how long the output is.  This is useful if output
59
     is to a file or to an editor buffer.
60
 
61
     Likewise, you can specify `set width 0' to prevent GDB from
62
     wrapping its output.
63
 
64

65
File: gdb.info,  Node: Numbers,  Next: Messages/Warnings,  Prev: Screen Size,  Up: Controlling GDB
66
 
67
Numbers
68
=======
69
 
70
   You can always enter numbers in octal, decimal, or hexadecimal in
71
GDB by the usual conventions: octal numbers begin with `0', decimal
72
numbers end with `.', and hexadecimal numbers begin with `0x'.  Numbers
73
that begin with none of these are, by default, entered in base 10;
74
likewise, the default display for numbers--when no particular format is
75
specified--is base 10.  You can change the default base for both input
76
and output with the `set radix' command.
77
 
78
`set input-radix BASE'
79
     Set the default base for numeric input.  Supported choices for
80
     BASE are decimal 8, 10, or 16.  BASE must itself be specified
81
     either unambiguously or using the current default radix; for
82
     example, any of
83
 
84
          set radix 012
85
          set radix 10.
86
          set radix 0xa
87
 
88
     sets the base to decimal.  On the other hand, `set radix 10'
89
     leaves the radix unchanged no matter what it was.
90
 
91
`set output-radix BASE'
92
     Set the default base for numeric display.  Supported choices for
93
     BASE are decimal 8, 10, or 16.  BASE must itself be specified
94
     either unambiguously or using the current default radix.
95
 
96
`show input-radix'
97
     Display the current default base for numeric input.
98
 
99
`show output-radix'
100
     Display the current default base for numeric display.
101
 
102

103
File: gdb.info,  Node: Messages/Warnings,  Next: Debugging Output,  Prev: Numbers,  Up: Controlling GDB
104
 
105
Optional warnings and messages
106
==============================
107
 
108
   By default, GDB is silent about its inner workings.  If you are
109
running on a slow machine, you may want to use the `set verbose'
110
command.  This makes GDB tell you when it does a lengthy internal
111
operation, so you will not think it has crashed.
112
 
113
   Currently, the messages controlled by `set verbose' are those which
114
announce that the symbol table for a source file is being read; see
115
`symbol-file' in *Note Commands to specify files: Files.
116
 
117
`set verbose on'
118
     Enables GDB output of certain informational messages.
119
 
120
`set verbose off'
121
     Disables GDB output of certain informational messages.
122
 
123
`show verbose'
124
     Displays whether `set verbose' is on or off.
125
 
126
   By default, if GDB encounters bugs in the symbol table of an object
127
file, it is silent; but if you are debugging a compiler, you may find
128
this information useful (*note Errors reading symbol files: Symbol
129
Errors.).
130
 
131
`set complaints LIMIT'
132
     Permits GDB to output LIMIT complaints about each type of unusual
133
     symbols before becoming silent about the problem.  Set LIMIT to
134
     zero to suppress all complaints; set it to a large number to
135
     prevent complaints from being suppressed.
136
 
137
`show complaints'
138
     Displays how many symbol complaints GDB is permitted to produce.
139
 
140
   By default, GDB is cautious, and asks what sometimes seems to be a
141
lot of stupid questions to confirm certain commands.  For example, if
142
you try to run a program which is already running:
143
 
144
     (gdb) run
145
     The program being debugged has been started already.
146
     Start it from the beginning? (y or n)
147
 
148
   If you are willing to unflinchingly face the consequences of your own
149
commands, you can disable this "feature":
150
 
151
`set confirm off'
152
     Disables confirmation requests.
153
 
154
`set confirm on'
155
     Enables confirmation requests (the default).
156
 
157
`show confirm'
158
     Displays state of confirmation requests.
159
 
160

161
File: gdb.info,  Node: Debugging Output,  Prev: Messages/Warnings,  Up: Controlling GDB
162
 
163
Optional messages about internal happenings
164
===========================================
165
 
166
`set debug arch'
167
     Turns on or off display of gdbarch debugging info. The default is
168
     off
169
 
170
`show debug arch'
171
     Displays the current state of displaying gdbarch debugging info.
172
 
173
`set debug event'
174
     Turns on or off display of GDB event debugging info. The default
175
     is off.
176
 
177
`show debug event'
178
     Displays the current state of displaying GDB event debugging info.
179
 
180
`set debug expression'
181
     Turns on or off display of GDB expression debugging info. The
182
     default is off.
183
 
184
`show debug expression'
185
     Displays the current state of displaying GDB expression debugging
186
     info.
187
 
188
`set debug overload'
189
     Turns on or off display of GDB C++ overload debugging info. This
190
     includes info such as ranking of functions, etc. The default is
191
     off.
192
 
193
`show debug overload'
194
     Displays the current state of displaying GDB C++ overload
195
     debugging info.
196
 
197
`set debug remote'
198
     Turns on or off display of reports on all packets sent back and
199
     forth across the serial line to the remote machine.  The info is
200
     printed on the GDB standard output stream. The default is off.
201
 
202
`show debug remote'
203
     Displays the state of display of remote packets.
204
 
205
`set debug serial'
206
     Turns on or off display of GDB serial debugging info. The default
207
     is off.
208
 
209
`show debug serial'
210
     Displays the current state of displaying GDB serial debugging info.
211
 
212
`set debug target'
213
     Turns on or off display of GDB target debugging info. This info
214
     includes what is going on at the target level of GDB, as it
215
     happens. The default is off.
216
 
217
`show debug target'
218
     Displays the current state of displaying GDB target debugging info.
219
 
220
`set debug varobj'
221
     Turns on or off display of GDB variable object debugging info. The
222
     default is off.
223
 
224
`show debug varobj'
225
     Displays the current state of displaying GDB variable object
226
     debugging info.
227
 
228

229
File: gdb.info,  Node: Sequences,  Next: Emacs,  Prev: Controlling GDB,  Up: Top
230
 
231
Canned Sequences of Commands
232
****************************
233
 
234
   Aside from breakpoint commands (*note Breakpoint command lists:
235
Break Commands.), GDB provides two ways to store sequences of commands
236
for execution as a unit: user-defined commands and command files.
237
 
238
* Menu:
239
 
240
* Define::                      User-defined commands
241
* Hooks::                       User-defined command hooks
242
* Command Files::               Command files
243
* Output::                      Commands for controlled output
244
 
245

246
File: gdb.info,  Node: Define,  Next: Hooks,  Up: Sequences
247
 
248
User-defined commands
249
=====================
250
 
251
   A "user-defined command" is a sequence of GDB commands to which you
252
assign a new name as a command.  This is done with the `define'
253
command.  User commands may accept up to 10 arguments separated by
254
whitespace.  Arguments are accessed within the user command via
255
$ARG0...$ARG9.  A trivial example:
256
 
257
     define adder
258
       print $arg0 + $arg1 + $arg2
259
 
260
To execute the command use:
261
 
262
     adder 1 2 3
263
 
264
This defines the command `adder', which prints the sum of its three
265
arguments.  Note the arguments are text substitutions, so they may
266
reference variables, use complex expressions, or even perform inferior
267
functions calls.
268
 
269
`define COMMANDNAME'
270
     Define a command named COMMANDNAME.  If there is already a command
271
     by that name, you are asked to confirm that you want to redefine
272
     it.
273
 
274
     The definition of the command is made up of other GDB command
275
     lines, which are given following the `define' command.  The end of
276
     these commands is marked by a line containing `end'.
277
 
278
`if'
279
     Takes a single argument, which is an expression to evaluate.  It
280
     is followed by a series of commands that are executed only if the
281
     expression is true (nonzero).  There can then optionally be a line
282
     `else', followed by a series of commands that are only executed if
283
     the expression was false.  The end of the list is marked by a line
284
     containing `end'.
285
 
286
`while'
287
     The syntax is similar to `if': the command takes a single argument,
288
     which is an expression to evaluate, and must be followed by the
289
     commands to execute, one per line, terminated by an `end'.  The
290
     commands are executed repeatedly as long as the expression
291
     evaluates to true.
292
 
293
`document COMMANDNAME'
294
     Document the user-defined command COMMANDNAME, so that it can be
295
     accessed by `help'.  The command COMMANDNAME must already be
296
     defined.  This command reads lines of documentation just as
297
     `define' reads the lines of the command definition, ending with
298
     `end'.  After the `document' command is finished, `help' on command
299
     COMMANDNAME displays the documentation you have written.
300
 
301
     You may use the `document' command again to change the
302
     documentation of a command.  Redefining the command with `define'
303
     does not change the documentation.
304
 
305
`help user-defined'
306
     List all user-defined commands, with the first line of the
307
     documentation (if any) for each.
308
 
309
`show user'
310
`show user COMMANDNAME'
311
     Display the GDB commands used to define COMMANDNAME (but not its
312
     documentation).  If no COMMANDNAME is given, display the
313
     definitions for all user-defined commands.
314
 
315
   When user-defined commands are executed, the commands of the
316
definition are not printed.  An error in any command stops execution of
317
the user-defined command.
318
 
319
   If used interactively, commands that would ask for confirmation
320
proceed without asking when used inside a user-defined command.  Many
321
GDB commands that normally print messages to say what they are doing
322
omit the messages when used in a user-defined command.
323
 
324

325
File: gdb.info,  Node: Hooks,  Next: Command Files,  Prev: Define,  Up: Sequences
326
 
327
User-defined command hooks
328
==========================
329
 
330
   You may define _hooks_, which are a special kind of user-defined
331
command.  Whenever you run the command `foo', if the user-defined
332
command `hook-foo' exists, it is executed (with no arguments) before
333
that command.
334
 
335
   In addition, a pseudo-command, `stop' exists.  Defining
336
(`hook-stop') makes the associated commands execute every time
337
execution stops in your program: before breakpoint commands are run,
338
displays are printed, or the stack frame is printed.
339
 
340
   For example, to ignore `SIGALRM' signals while single-stepping, but
341
treat them normally during normal execution, you could define:
342
 
343
     define hook-stop
344
     handle SIGALRM nopass
345
     end
346
 
347
     define hook-run
348
     handle SIGALRM pass
349
     end
350
 
351
     define hook-continue
352
     handle SIGLARM pass
353
     end
354
 
355
   You can define a hook for any single-word command in GDB, but not
356
for command aliases; you should define a hook for the basic command
357
name, e.g.  `backtrace' rather than `bt'.  If an error occurs during
358
the execution of your hook, execution of GDB commands stops and GDB
359
issues a prompt (before the command that you actually typed had a
360
chance to run).
361
 
362
   If you try to define a hook which does not match any known command,
363
you get a warning from the `define' command.
364
 
365

366
File: gdb.info,  Node: Command Files,  Next: Output,  Prev: Hooks,  Up: Sequences
367
 
368
Command files
369
=============
370
 
371
   A command file for GDB is a file of lines that are GDB commands.
372
Comments (lines starting with `#') may also be included.  An empty line
373
in a command file does nothing; it does not mean to repeat the last
374
command, as it would from the terminal.
375
 
376
   When you start GDB, it automatically executes commands from its
377
"init files".  These are files named `.gdbinit' on Unix, or `gdb.ini'
378
on DOS/Windows.  GDB reads the init file (if any) in your home
379
directory(1), then processes command line options and operands, and then
380
reads the init file (if any) in the current working directory.  This is
381
so the init file in your home directory can set options (such as `set
382
complaints') which affect the processing of the command line options
383
and operands.  The init files are not executed if you use the `-nx'
384
option; *note Choosing modes: Mode Options..
385
 
386
   On some configurations of GDB, the init file is known by a different
387
name (these are typically environments where a specialized form of GDB
388
may need to coexist with other forms, hence a different name for the
389
specialized version's init file).  These are the environments with
390
special init file names:
391
 
392
   * VxWorks (Wind River Systems real-time OS): `.vxgdbinit'
393
 
394
   * OS68K (Enea Data Systems real-time OS): `.os68gdbinit'
395
 
396
   * ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit'
397
 
398
   You can also request the execution of a command file with the
399
`source' command:
400
 
401
`source FILENAME'
402
     Execute the command file FILENAME.
403
 
404
   The lines in a command file are executed sequentially.  They are not
405
printed as they are executed.  An error in any command terminates
406
execution of the command file.
407
 
408
   Commands that would ask for confirmation if used interactively
409
proceed without asking when used in a command file.  Many GDB commands
410
that normally print messages to say what they are doing omit the
411
messages when called from command files.
412
 
413
   ---------- Footnotes ----------
414
 
415
   (1) On DOS/Windows systems, the home directory is the one pointed to
416
by the `HOME' environment variable.
417
 
418

419
File: gdb.info,  Node: Output,  Prev: Command Files,  Up: Sequences
420
 
421
Commands for controlled output
422
==============================
423
 
424
   During the execution of a command file or a user-defined command,
425
normal GDB output is suppressed; the only output that appears is what is
426
explicitly printed by the commands in the definition.  This section
427
describes three commands useful for generating exactly the output you
428
want.
429
 
430
`echo TEXT'
431
     Print TEXT.  Nonprinting characters can be included in TEXT using
432
     C escape sequences, such as `\n' to print a newline.  *No newline
433
     is printed unless you specify one.* In addition to the standard C
434
     escape sequences, a backslash followed by a space stands for a
435
     space.  This is useful for displaying a string with spaces at the
436
     beginning or the end, since leading and trailing spaces are
437
     otherwise trimmed from all arguments.  To print ` and foo = ', use
438
     the command `echo \ and foo = \ '.
439
 
440
     A backslash at the end of TEXT can be used, as in C, to continue
441
     the command onto subsequent lines.  For example,
442
 
443
          echo This is some text\n\
444
          which is continued\n\
445
          onto several lines.\n
446
 
447
     produces the same output as
448
 
449
          echo This is some text\n
450
          echo which is continued\n
451
          echo onto several lines.\n
452
 
453
`output EXPRESSION'
454
     Print the value of EXPRESSION and nothing but that value: no
455
     newlines, no `$NN = '.  The value is not entered in the value
456
     history either.  *Note Expressions: Expressions, for more
457
     information on expressions.
458
 
459
`output/FMT EXPRESSION'
460
     Print the value of EXPRESSION in format FMT.  You can use the same
461
     formats as for `print'.  *Note Output formats: Output Formats, for
462
     more information.
463
 
464
`printf STRING, EXPRESSIONS...'
465
     Print the values of the EXPRESSIONS under the control of STRING.
466
     The EXPRESSIONS are separated by commas and may be either numbers
467
     or pointers.  Their values are printed as specified by STRING,
468
     exactly as if your program were to execute the C subroutine
469
 
470
          printf (STRING, EXPRESSIONS...);
471
 
472
     For example, you can print two values in hex like this:
473
 
474
          printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
475
 
476
     The only backslash-escape sequences that you can use in the format
477
     string are the simple ones that consist of backslash followed by a
478
     letter.
479
 
480

481
File: gdb.info,  Node: Emacs,  Next: Annotations,  Prev: Sequences,  Up: Top
482
 
483
Using GDB under GNU Emacs
484
*************************
485
 
486
   A special interface allows you to use GNU Emacs to view (and edit)
487
the source files for the program you are debugging with GDB.
488
 
489
   To use this interface, use the command `M-x gdb' in Emacs.  Give the
490
executable file you want to debug as an argument.  This command starts
491
GDB as a subprocess of Emacs, with input and output through a newly
492
created Emacs buffer.
493
 
494
   Using GDB under Emacs is just like using GDB normally except for two
495
things:
496
 
497
   * All "terminal" input and output goes through the Emacs buffer.
498
 
499
   This applies both to GDB commands and their output, and to the input
500
and output done by the program you are debugging.
501
 
502
   This is useful because it means that you can copy the text of
503
previous commands and input them again; you can even use parts of the
504
output in this way.
505
 
506
   All the facilities of Emacs' Shell mode are available for interacting
507
with your program.  In particular, you can send signals the usual
508
way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
509
 
510
   * GDB displays source code through Emacs.
511
 
512
   Each time GDB displays a stack frame, Emacs automatically finds the
513
source file for that frame and puts an arrow (`=>') at the left margin
514
of the current line.  Emacs uses a separate buffer for source display,
515
and splits the screen to show both your GDB session and the source.
516
 
517
   Explicit GDB `list' or search commands still produce output as
518
usual, but you probably have no reason to use them from Emacs.
519
 
520
     _Warning:_ If the directory where your program resides is not your
521
     current directory, it can be easy to confuse Emacs about the
522
     location of the source files, in which case the auxiliary display
523
     buffer does not appear to show your source.  GDB can find programs
524
     by searching your environment's `PATH' variable, so the GDB input
525
     and output session proceeds normally; but Emacs does not get
526
     enough information back from GDB to locate the source files in
527
     this situation.  To avoid this problem, either start GDB mode from
528
     the directory where your program resides, or specify an absolute
529
     file name when prompted for the `M-x gdb' argument.
530
 
531
     A similar confusion can result if you use the GDB `file' command to
532
     switch to debugging a program in some other location, from an
533
     existing GDB buffer in Emacs.
534
 
535
   By default, `M-x gdb' calls the program called `gdb'.  If you need
536
to call GDB by a different name (for example, if you keep several
537
configurations around, with different names) you can set the Emacs
538
variable `gdb-command-name'; for example,
539
 
540
     (setq gdb-command-name "mygdb")
541
 
542
(preceded by `M-:' or `ESC :', or typed in the `*scratch*' buffer, or
543
in your `.emacs' file) makes Emacs call the program named "`mygdb'"
544
instead.
545
 
546
   In the GDB I/O buffer, you can use these special Emacs commands in
547
addition to the standard Shell mode commands:
548
 
549
`C-h m'
550
     Describe the features of Emacs' GDB Mode.
551
 
552
`M-s'
553
     Execute to another source line, like the GDB `step' command; also
554
     update the display window to show the current file and location.
555
 
556
`M-n'
557
     Execute to next source line in this function, skipping all function
558
     calls, like the GDB `next' command.  Then update the display window
559
     to show the current file and location.
560
 
561
`M-i'
562
     Execute one instruction, like the GDB `stepi' command; update
563
     display window accordingly.
564
 
565
`M-x gdb-nexti'
566
     Execute to next instruction, using the GDB `nexti' command; update
567
     display window accordingly.
568
 
569
`C-c C-f'
570
     Execute until exit from the selected stack frame, like the GDB
571
     `finish' command.
572
 
573
`M-c'
574
     Continue execution of your program, like the GDB `continue'
575
     command.
576
 
577
     _Warning:_ In Emacs v19, this command is `C-c C-p'.
578
 
579
`M-u'
580
     Go up the number of frames indicated by the numeric argument
581
     (*note Numeric Arguments: (Emacs)Arguments.), like the GDB `up'
582
     command.
583
 
584
     _Warning:_ In Emacs v19, this command is `C-c C-u'.
585
 
586
`M-d'
587
     Go down the number of frames indicated by the numeric argument,
588
     like the GDB `down' command.
589
 
590
     _Warning:_ In Emacs v19, this command is `C-c C-d'.
591
 
592
`C-x &'
593
     Read the number where the cursor is positioned, and insert it at
594
     the end of the GDB I/O buffer.  For example, if you wish to
595
     disassemble code around an address that was displayed earlier,
596
     type `disassemble'; then move the cursor to the address display,
597
     and pick up the argument for `disassemble' by typing `C-x &'.
598
 
599
     You can customize this further by defining elements of the list
600
     `gdb-print-command'; once it is defined, you can format or
601
     otherwise process numbers picked up by `C-x &' before they are
602
     inserted.  A numeric argument to `C-x &' indicates that you wish
603
     special formatting, and also acts as an index to pick an element
604
     of the list.  If the list element is a string, the number to be
605
     inserted is formatted using the Emacs function `format'; otherwise
606
     the number is passed as an argument to the corresponding list
607
     element.
608
 
609
   In any source file, the Emacs command `C-x SPC' (`gdb-break') tells
610
GDB to set a breakpoint on the source line point is on.
611
 
612
   If you accidentally delete the source-display buffer, an easy way to
613
get it back is to type the command `f' in the GDB buffer, to request a
614
frame display; when you run under Emacs, this recreates the source
615
buffer if necessary to show you the context of the current frame.
616
 
617
   The source files displayed in Emacs are in ordinary Emacs buffers
618
which are visiting the source files in the usual way.  You can edit the
619
files with these buffers if you wish; but keep in mind that GDB
620
communicates with Emacs in terms of line numbers.  If you add or delete
621
lines from the text, the line numbers that GDB knows cease to
622
correspond properly with the code.
623
 
624

625
File: gdb.info,  Node: Annotations,  Next: GDB/MI,  Prev: Emacs,  Up: Top
626
 
627
GDB Annotations
628
***************
629
 
630
   This chapter describes annotations in GDB.  Annotations are designed
631
to interface GDB to graphical user interfaces or other similar programs
632
which want to interact with GDB at a relatively high level.
633
 
634
* Menu:
635
 
636
* Annotations Overview::  What annotations are; the general syntax.
637
* Server Prefix::       Issuing a command without affecting user state.
638
* Value Annotations::   Values are marked as such.
639
* Frame Annotations::   Stack frames are annotated.
640
* Displays::            GDB can be told to display something periodically.
641
* Prompting::           Annotations marking GDB's need for input.
642
* Errors::              Annotations for error messages.
643
* Breakpoint Info::     Information on breakpoints.
644
* Invalidation::        Some annotations describe things now invalid.
645
* Annotations for Running::
646
                        Whether the program is running, how it stopped, etc.
647
* Source Annotations::  Annotations describing source code.
648
* TODO::                Annotations which might be added in the future.
649
 
650

651
File: gdb.info,  Node: Annotations Overview,  Next: Server Prefix,  Up: Annotations
652
 
653
What is an Annotation?
654
======================
655
 
656
   To produce annotations, start GDB with the `--annotate=2' option.
657
 
658
   Annotations start with a newline character, two `control-z'
659
characters, and the name of the annotation.  If there is no additional
660
information associated with this annotation, the name of the annotation
661
is followed immediately by a newline.  If there is additional
662
information, the name of the annotation is followed by a space, the
663
additional information, and a newline.  The additional information
664
cannot contain newline characters.
665
 
666
   Any output not beginning with a newline and two `control-z'
667
characters denotes literal output from GDB.  Currently there is no need
668
for GDB to output a newline followed by two `control-z' characters, but
669
if there was such a need, the annotations could be extended with an
670
`escape' annotation which means those three characters as output.
671
 
672
   A simple example of starting up GDB with annotations is:
673
 
674
     $ gdb --annotate=2
675
     GNU GDB 5.0
676
     Copyright 2000 Free Software Foundation, Inc.
677
     GDB is free software, covered by the GNU General Public License,
678
     and you are welcome to change it and/or distribute copies of it
679
     under certain conditions.
680
     Type "show copying" to see the conditions.
681
     There is absolutely no warranty for GDB.  Type "show warranty"
682
     for details.
683
     This GDB was configured as "sparc-sun-sunos4.1.3"
684
 
685
     ^Z^Zpre-prompt
686
     (gdb)
687
     ^Z^Zprompt
688
     quit
689
 
690
     ^Z^Zpost-prompt
691
     $
692
 
693
   Here `quit' is input to GDB; the rest is output from GDB.  The three
694
lines beginning `^Z^Z' (where `^Z' denotes a `control-z' character) are
695
annotations; the rest is output from GDB.
696
 
697

698
File: gdb.info,  Node: Server Prefix,  Next: Value Annotations,  Prev: Annotations Overview,  Up: Annotations
699
 
700
The Server Prefix
701
=================
702
 
703
   To issue a command to GDB without affecting certain aspects of the
704
state which is seen by users, prefix it with `server '.  This means
705
that this command will not affect the command history, nor will it
706
affect GDB's notion of which command to repeat if  is pressed on a
707
line by itself.
708
 
709
   The server prefix does not affect the recording of values into the
710
value history; to print a value without recording it into the value
711
history, use the `output' command instead of the `print' command.
712
 
713

714
File: gdb.info,  Node: Value Annotations,  Next: Frame Annotations,  Prev: Server Prefix,  Up: Annotations
715
 
716
Values
717
======
718
 
719
   When a value is printed in various contexts, GDB uses annotations to
720
delimit the value from the surrounding text.
721
 
722
   If a value is printed using `print' and added to the value history,
723
the annotation looks like
724
 
725
     ^Z^Zvalue-history-begin HISTORY-NUMBER VALUE-FLAGS
726
     HISTORY-STRING
727
     ^Z^Zvalue-history-value
728
     THE-VALUE
729
     ^Z^Zvalue-history-end
730
 
731
   where HISTORY-NUMBER is the number it is getting in the value
732
history, HISTORY-STRING is a string, such as `$5 = ', which introduces
733
the value to the user, THE-VALUE is the output corresponding to the
734
value itself, and VALUE-FLAGS is `*' for a value which can be
735
dereferenced and `-' for a value which cannot.
736
 
737
   If the value is not added to the value history (it is an invalid
738
float or it is printed with the `output' command), the annotation is
739
similar:
740
 
741
     ^Z^Zvalue-begin VALUE-FLAGS
742
     THE-VALUE
743
     ^Z^Zvalue-end
744
 
745
   When GDB prints an argument to a function (for example, in the output
746
from the `backtrace' command), it annotates it as follows:
747
 
748
     ^Z^Zarg-begin
749
     ARGUMENT-NAME
750
     ^Z^Zarg-name-end
751
     SEPARATOR-STRING
752
     ^Z^Zarg-value VALUE-FLAGS
753
     THE-VALUE
754
     ^Z^Zarg-end
755
 
756
   where ARGUMENT-NAME is the name of the argument, SEPARATOR-STRING is
757
text which separates the name from the value for the user's benefit
758
(such as `='), and VALUE-FLAGS and THE-VALUE have the same meanings as
759
in a `value-history-begin' annotation.
760
 
761
   When printing a structure, GDB annotates it as follows:
762
 
763
     ^Z^Zfield-begin VALUE-FLAGS
764
     FIELD-NAME
765
     ^Z^Zfield-name-end
766
     SEPARATOR-STRING
767
     ^Z^Zfield-value
768
     THE-VALUE
769
     ^Z^Zfield-end
770
 
771
   where FIELD-NAME is the name of the field, SEPARATOR-STRING is text
772
which separates the name from the value for the user's benefit (such as
773
`='), and VALUE-FLAGS and THE-VALUE have the same meanings as in a
774
`value-history-begin' annotation.
775
 
776
   When printing an array, GDB annotates it as follows:
777
 
778
     ^Z^Zarray-section-begin ARRAY-INDEX VALUE-FLAGS
779
 
780
   where ARRAY-INDEX is the index of the first element being annotated
781
and VALUE-FLAGS has the same meaning as in a `value-history-begin'
782
annotation.  This is followed by any number of elements, where is
783
element can be either a single element:
784
 
785
     `,' WHITESPACE         ; omitted for the first element
786
     THE-VALUE
787
     ^Z^Zelt
788
 
789
   or a repeated element
790
 
791
     `,' WHITESPACE         ; omitted for the first element
792
     THE-VALUE
793
     ^Z^Zelt-rep NUMBER-OF-REPITITIONS
794
     REPETITION-STRING
795
     ^Z^Zelt-rep-end
796
 
797
   In both cases, THE-VALUE is the output for the value of the element
798
and WHITESPACE can contain spaces, tabs, and newlines.  In the repeated
799
case, NUMBER-OF-REPITITONS is the number of consecutive array elements
800
which contain that value, and REPETITION-STRING is a string which is
801
designed to convey to the user that repitition is being depicted.
802
 
803
   Once all the array elements have been output, the array annotation is
804
ended with
805
 
806
     ^Z^Zarray-section-end
807
 
808

809
File: gdb.info,  Node: Frame Annotations,  Next: Displays,  Prev: Value Annotations,  Up: Annotations
810
 
811
Frames
812
======
813
 
814
   Whenever GDB prints a frame, it annotates it.  For example, this
815
applies to frames printed when GDB stops, output from commands such as
816
`backtrace' or `up', etc.
817
 
818
   The frame annotation begins with
819
 
820
     ^Z^Zframe-begin LEVEL ADDRESS
821
     LEVEL-STRING
822
 
823
   where LEVEL is the number of the frame (0 is the innermost frame,
824
and other frames have positive numbers), ADDRESS is the address of the
825
code executing in that frame, and LEVEL-STRING is a string designed to
826
convey the level to the user.  ADDRESS is in the form `0x' followed by
827
one or more lowercase hex digits (note that this does not depend on the
828
language).  The frame ends with
829
 
830
     ^Z^Zframe-end
831
 
832
   Between these annotations is the main body of the frame, which can
833
consist of
834
 
835
   *      ^Z^Zfunction-call
836
          FUNCTION-CALL-STRING
837
 
838
     where FUNCTION-CALL-STRING is text designed to convey to the user
839
     that this frame is associated with a function call made by GDB to a
840
     function in the program being debugged.
841
 
842
   *      ^Z^Zsignal-handler-caller
843
          SIGNAL-HANDLER-CALLER-STRING
844
 
845
     where SIGNAL-HANDLER-CALLER-STRING is text designed to convey to
846
     the user that this frame is associated with whatever mechanism is
847
     used by this operating system to call a signal handler (it is the
848
     frame which calls the signal handler, not the frame for the signal
849
     handler itself).
850
 
851
   * A normal frame.
852
 
853
     This can optionally (depending on whether this is thought of as
854
     interesting information for the user to see) begin with
855
 
856
          ^Z^Zframe-address
857
          ADDRESS
858
          ^Z^Zframe-address-end
859
          SEPARATOR-STRING
860
 
861
     where ADDRESS is the address executing in the frame (the same
862
     address as in the `frame-begin' annotation, but printed in a form
863
     which is intended for user consumption--in particular, the syntax
864
     varies depending on the language), and SEPARATOR-STRING is a string
865
     intended to separate this address from what follows for the user's
866
     benefit.
867
 
868
     Then comes
869
 
870
          ^Z^Zframe-function-name
871
          FUNCTION-NAME
872
          ^Z^Zframe-args
873
          ARGUMENTS
874
 
875
     where FUNCTION-NAME is the name of the function executing in the
876
     frame, or `??' if not known, and ARGUMENTS are the arguments to
877
     the frame, with parentheses around them (each argument is annotated
878
     individually as well, *note Value Annotations::.).
879
 
880
     If source information is available, a reference to it is then
881
     printed:
882
 
883
          ^Z^Zframe-source-begin
884
          SOURCE-INTRO-STRING
885
          ^Z^Zframe-source-file
886
          FILENAME
887
          ^Z^Zframe-source-file-end
888
          :
889
          ^Z^Zframe-source-line
890
          LINE-NUMBER
891
          ^Z^Zframe-source-end
892
 
893
     where SOURCE-INTRO-STRING separates for the user's benefit the
894
     reference from the text which precedes it, FILENAME is the name of
895
     the source file, and LINE-NUMBER is the line number within that
896
     file (the first line is line 1).
897
 
898
     If GDB prints some information about where the frame is from (which
899
     library, which load segment, etc.; currently only done on the
900
     RS/6000), it is annotated with
901
 
902
          ^Z^Zframe-where
903
          INFORMATION
904
 
905
     Then, if source is to actually be displayed for this frame (for
906
     example, this is not true for output from the `backtrace'
907
     command), then a `source' annotation (*note Source Annotations::.)
908
     is displayed.  Unlike most annotations, this is output instead of
909
     the normal text which would be output, not in addition.
910
 
911

912
File: gdb.info,  Node: Displays,  Next: Prompting,  Prev: Frame Annotations,  Up: Annotations
913
 
914
Displays
915
========
916
 
917
   When GDB is told to display something using the `display' command,
918
the results of the display are annotated:
919
 
920
     ^Z^Zdisplay-begin
921
     NUMBER
922
     ^Z^Zdisplay-number-end
923
     NUMBER-SEPARATOR
924
     ^Z^Zdisplay-format
925
     FORMAT
926
     ^Z^Zdisplay-expression
927
     EXPRESSION
928
     ^Z^Zdisplay-expression-end
929
     EXPRESSION-SEPARATOR
930
     ^Z^Zdisplay-value
931
     VALUE
932
     ^Z^Zdisplay-end
933
 
934
   where NUMBER is the number of the display, NUMBER-SEPARATOR is
935
intended to separate the number from what follows for the user, FORMAT
936
includes information such as the size, format, or other information
937
about how the value is being displayed, EXPRESSION is the expression
938
being displayed, EXPRESSION-SEPARATOR is intended to separate the
939
expression from the text that follows for the user, and VALUE is the
940
actual value being displayed.
941
 
942

943
File: gdb.info,  Node: Prompting,  Next: Errors,  Prev: Displays,  Up: Annotations
944
 
945
Annotation for GDB Input
946
========================
947
 
948
   When GDB prompts for input, it annotates this fact so it is possible
949
to know when to send output, when the output from a given command is
950
over, etc.
951
 
952
   Different kinds of input each have a different "input type".  Each
953
input type has three annotations: a `pre-' annotation, which denotes
954
the beginning of any prompt which is being output, a plain annotation,
955
which denotes the end of the prompt, and then a `post-' annotation
956
which denotes the end of any echo which may (or may not) be associated
957
with the input.  For example, the `prompt' input type features the
958
following annotations:
959
 
960
     ^Z^Zpre-prompt
961
     ^Z^Zprompt
962
     ^Z^Zpost-prompt
963
 
964
   The input types are
965
 
966
`prompt'
967
     When GDB is prompting for a command (the main GDB prompt).
968
 
969
`commands'
970
     When GDB prompts for a set of commands, like in the `commands'
971
     command.  The annotations are repeated for each command which is
972
     input.
973
 
974
`overload-choice'
975
     When GDB wants the user to select between various overloaded
976
     functions.
977
 
978
`query'
979
     When GDB wants the user to confirm a potentially dangerous
980
     operation.
981
 
982
`prompt-for-continue'
983
     When GDB is asking the user to press return to continue.  Note:
984
     Don't expect this to work well; instead use `set height 0' to
985
     disable prompting.  This is because the counting of lines is buggy
986
     in the presence of annotations.
987
 
988

989
File: gdb.info,  Node: Errors,  Next: Breakpoint Info,  Prev: Prompting,  Up: Annotations
990
 
991
Errors
992
======
993
 
994
     ^Z^Zquit
995
 
996
   This annotation occurs right before GDB responds to an interrupt.
997
 
998
     ^Z^Zerror
999
 
1000
   This annotation occurs right before GDB responds to an error.
1001
 
1002
   Quit and error annotations indicate that any annotations which GDB
1003
was in the middle of may end abruptly.  For example, if a
1004
`value-history-begin' annotation is followed by a `error', one cannot
1005
expect to receive the matching `value-history-end'.  One cannot expect
1006
not to receive it either, however; an error annotation does not
1007
necessarily mean that GDB is immediately returning all the way to the
1008
top level.
1009
 
1010
   A quit or error annotation may be preceded by
1011
 
1012
     ^Z^Zerror-begin
1013
 
1014
   Any output between that and the quit or error annotation is the error
1015
message.
1016
 
1017
   Warning messages are not yet annotated.
1018
 
1019

1020
File: gdb.info,  Node: Breakpoint Info,  Next: Invalidation,  Prev: Errors,  Up: Annotations
1021
 
1022
Information on Breakpoints
1023
==========================
1024
 
1025
   The output from the `info breakpoints' command is annotated as
1026
follows:
1027
 
1028
     ^Z^Zbreakpoints-headers
1029
     HEADER-ENTRY
1030
     ^Z^Zbreakpoints-table
1031
 
1032
   where HEADER-ENTRY has the same syntax as an entry (see below) but
1033
instead of containing data, it contains strings which are intended to
1034
convey the meaning of each field to the user.  This is followed by any
1035
number of entries.  If a field does not apply for this entry, it is
1036
omitted.  Fields may contain trailing whitespace.  Each entry consists
1037
of:
1038
 
1039
     ^Z^Zrecord
1040
     ^Z^Zfield 0
1041
     NUMBER
1042
     ^Z^Zfield 1
1043
     TYPE
1044
     ^Z^Zfield 2
1045
     DISPOSITION
1046
     ^Z^Zfield 3
1047
     ENABLE
1048
     ^Z^Zfield 4
1049
     ADDRESS
1050
     ^Z^Zfield 5
1051
     WHAT
1052
     ^Z^Zfield 6
1053
     FRAME
1054
     ^Z^Zfield 7
1055
     CONDITION
1056
     ^Z^Zfield 8
1057
     IGNORE-COUNT
1058
     ^Z^Zfield 9
1059
     COMMANDS
1060
 
1061
   Note that ADDRESS is intended for user consumption--the syntax
1062
varies depending on the language.
1063
 
1064
   The output ends with
1065
 
1066
     ^Z^Zbreakpoints-table-end
1067
 
1068

1069
File: gdb.info,  Node: Invalidation,  Next: Annotations for Running,  Prev: Breakpoint Info,  Up: Annotations
1070
 
1071
Invalidation Notices
1072
====================
1073
 
1074
   The following annotations say that certain pieces of state may have
1075
changed.
1076
 
1077
`^Z^Zframes-invalid'
1078
     The frames (for example, output from the `backtrace' command) may
1079
     have changed.
1080
 
1081
`^Z^Zbreakpoints-invalid'
1082
     The breakpoints may have changed.  For example, the user just
1083
     added or deleted a breakpoint.
1084
 
1085

1086
File: gdb.info,  Node: Annotations for Running,  Next: Source Annotations,  Prev: Invalidation,  Up: Annotations
1087
 
1088
Running the Program
1089
===================
1090
 
1091
   When the program starts executing due to a GDB command such as
1092
`step' or `continue',
1093
 
1094
     ^Z^Zstarting
1095
 
1096
   is output.  When the program stops,
1097
 
1098
     ^Z^Zstopped
1099
 
1100
   is output.  Before the `stopped' annotation, a variety of
1101
annotations describe how the program stopped.
1102
 
1103
`^Z^Zexited EXIT-STATUS'
1104
     The program exited, and EXIT-STATUS is the exit status (zero for
1105
     successful exit, otherwise nonzero).
1106
 
1107
`^Z^Zsignalled'
1108
     The program exited with a signal.  After the `^Z^Zsignalled', the
1109
     annotation continues:
1110
 
1111
          INTRO-TEXT
1112
          ^Z^Zsignal-name
1113
          NAME
1114
          ^Z^Zsignal-name-end
1115
          MIDDLE-TEXT
1116
          ^Z^Zsignal-string
1117
          STRING
1118
          ^Z^Zsignal-string-end
1119
          END-TEXT
1120
 
1121
     where NAME is the name of the signal, such as `SIGILL' or
1122
     `SIGSEGV', and STRING is the explanation of the signal, such as
1123
     `Illegal Instruction' or `Segmentation fault'.  INTRO-TEXT,
1124
     MIDDLE-TEXT, and END-TEXT are for the user's benefit and have no
1125
     particular format.
1126
 
1127
`^Z^Zsignal'
1128
     The syntax of this annotation is just like `signalled', but GDB is
1129
     just saying that the program received the signal, not that it was
1130
     terminated with it.
1131
 
1132
`^Z^Zbreakpoint NUMBER'
1133
     The program hit breakpoint number NUMBER.
1134
 
1135
`^Z^Zwatchpoint NUMBER'
1136
     The program hit watchpoint number NUMBER.
1137
 
1138

1139
File: gdb.info,  Node: Source Annotations,  Next: TODO,  Prev: Annotations for Running,  Up: Annotations
1140
 
1141
Displaying Source
1142
=================
1143
 
1144
   The following annotation is used instead of displaying source code:
1145
 
1146
     ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
1147
 
1148
   where FILENAME is an absolute file name indicating which source
1149
file, LINE is the line number within that file (where 1 is the first
1150
line in the file), CHARACTER is the character position within the file
1151
(where 0 is the first character in the file) (for most debug formats
1152
this will necessarily point to the beginning of a line), MIDDLE is
1153
`middle' if ADDR is in the middle of the line, or `beg' if ADDR is at
1154
the beginning of the line, and ADDR is the address in the target
1155
program associated with the source which is being displayed.  ADDR is
1156
in the form `0x' followed by one or more lowercase hex digits (note
1157
that this does not depend on the language).
1158
 
1159

1160
File: gdb.info,  Node: TODO,  Prev: Source Annotations,  Up: Annotations
1161
 
1162
Annotations We Might Want in the Future
1163
=======================================
1164
 
1165
    - target-invalid
1166
      the target might have changed (registers, heap contents, or
1167
      execution status).  For performance, we might eventually want
1168
      to hit `registers-invalid' and `all-registers-invalid' with
1169
      greater precision
1170
 
1171
    - systematic annotation for set/show parameters (including
1172
      invalidation notices).
1173
 
1174
    - similarly, `info' returns a list of candidates for invalidation
1175
      notices.
1176
 
1177

1178
File: gdb.info,  Node: GDB/MI,  Next: GDB Bugs,  Prev: Annotations,  Up: Top
1179
 
1180
The GDB/MI Interface
1181
********************
1182
 
1183
Function and Purpose
1184
====================
1185
 
1186
   GDB/MI is a line based machine oriented text interface to GDB.  It is
1187
specifically intended to support the development of systems which use
1188
the debugger as just one small component of a larger system.
1189
 
1190
   This chapter is a specification of the GDB/MI interface.  It is
1191
written in the form of a reference manual.
1192
 
1193
   Note that GDB/MI is still under construction, so some of the
1194
features described below are incomplete and subject to change.
1195
 
1196
Notation and Terminology
1197
========================
1198
 
1199
   This chapter uses the following notation:
1200
 
1201
   * `|' separates two alternatives.
1202
 
1203
   * `[ SOMETHING ]' indicates that SOMETHING is optional: it may or
1204
     may not be given.
1205
 
1206
   * `( GROUP )*' means that GROUP inside the parentheses may repeat
1207
     zero or more times.
1208
 
1209
   * `( GROUP )+' means that GROUP inside the parentheses may repeat
1210
     one or more times.
1211
 
1212
   * `"STRING"' means a literal STRING.
1213
 
1214
Acknowledgments
1215
===============
1216
 
1217
   In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
1218
Elena Zannoni.
1219
 
1220
* Menu:
1221
 
1222
* GDB/MI Command Syntax::
1223
* GDB/MI Compatibility with CLI::
1224
* GDB/MI Output Records::
1225
* GDB/MI Command Description Format::
1226
* GDB/MI Breakpoint Table Commands::
1227
* GDB/MI Data Manipulation::
1228
* GDB/MI Program Control::
1229
* GDB/MI Miscellaneous Commands::
1230
* GDB/MI Stack Manipulation::
1231
* GDB/MI Symbol Query::
1232
* GDB/MI Target Manipulation::
1233
* GDB/MI Thread Commands::
1234
* GDB/MI Tracepoint Commands::
1235
* GDB/MI Variable Objects::
1236
* GDB/MI Draft Changes to Output Syntax::
1237
 
1238

1239
File: gdb.info,  Node: GDB/MI Command Syntax,  Next: GDB/MI Compatibility with CLI,  Up: GDB/MI
1240
 
1241
GDB/MI Command Syntax
1242
=====================
1243
 
1244
* Menu:
1245
 
1246
* GDB/MI Input Syntax::
1247
* GDB/MI Output Syntax::
1248
* GDB/MI Simple Examples::
1249
 
1250

1251
File: gdb.info,  Node: GDB/MI Input Syntax,  Next: GDB/MI Output Syntax,  Up: GDB/MI Command Syntax
1252
 
1253
GDB/MI Input Syntax
1254
-------------------
1255
 
1256
`COMMAND ==>'
1257
     `CLI-COMMAND | MI-COMMAND'
1258
 
1259
`CLI-COMMAND ==>'
1260
     `[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB
1261
     CLI command.
1262
 
1263
`MI-COMMAND ==>'
1264
     `[ TOKEN ] "-" OPERATION ( " " OPTION )* `[' " --" `]' ( " "
1265
     PARAMETER )* NL'
1266
 
1267
`TOKEN ==>'
1268
     `"any sequence of digits"'
1269
 
1270
`OPTION ==>'
1271
     `"-" PARAMETER [ " " PARAMETER ]'
1272
 
1273
`PARAMETER ==>'
1274
     `NON-BLANK-SEQUENCE | C-STRING'
1275
 
1276
`OPERATION ==>'
1277
     _any of the operations described in this document_
1278
 
1279
`NON-BLANK-SEQUENCE ==>'
1280
     _anything, provided it doesn't contain special characters such as
1281
     "-", NL, """ and of course " "_
1282
 
1283
`C-STRING ==>'
1284
     `""" SEVEN-BIT-ISO-C-STRING-CONTENT """'
1285
 
1286
`NL ==>'
1287
     `CR | CR-LF'
1288
 
1289
   Notes:
1290
 
1291
   * The CLI commands are still handled by the MI interpreter; their
1292
     output is described below.
1293
 
1294
   * The `TOKEN', when present, is passed back when the command
1295
     finishes.
1296
 
1297
   * Some MI commands accept optional arguments as part of the parameter
1298
     list. Each option is identified by a leading `-' (dash) and may be
1299
     followed by an optional argument parameter.  Options occur first
1300
     in the parameter list and can be delimited from normal parameters
1301
     using `--' (this is useful when some parameters begin with a dash).
1302
 
1303
   Pragmatics:
1304
 
1305
   * We want easy access to the existing CLI syntax (for debugging).
1306
 
1307
   * We want it to be easy to spot a MI operation.
1308
 
1309

1310
File: gdb.info,  Node: GDB/MI Output Syntax,  Next: GDB/MI Simple Examples,  Prev: GDB/MI Input Syntax,  Up: GDB/MI Command Syntax
1311
 
1312
GDB/MI Output Syntax
1313
--------------------
1314
 
1315
   The output from GDB/MI consists of zero or more out-of-band records
1316
followed, optionally, by a single result record.  This result record is
1317
for the most recent command.  The sequence of output records is
1318
terminated by `(gdb)'.
1319
 
1320
   If an input command was prefixed with a `TOKEN' then the
1321
corresponding output for that command will also be prefixed by that same
1322
TOKEN.
1323
 
1324
`OUTPUT ==>'
1325
     `( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
1326
 
1327
`RESULT-RECORD ==>'
1328
     ` [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
1329
 
1330
`OUT-OF-BAND-RECORD ==>'
1331
     `ASYNC-RECORD | STREAM-RECORD'
1332
 
1333
`ASYNC-RECORD ==>'
1334
     `EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
1335
 
1336
`EXEC-ASYNC-OUTPUT ==>'
1337
     `[ TOKEN ] "*" ASYNC-OUTPUT'
1338
 
1339
`STATUS-ASYNC-OUTPUT ==>'
1340
     `[ TOKEN ] "+" ASYNC-OUTPUT'
1341
 
1342
`NOTIFY-ASYNC-OUTPUT ==>'
1343
     `[ TOKEN ] "=" ASYNC-OUTPUT'
1344
 
1345
`ASYNC-OUTPUT ==>'
1346
     `ASYNC-CLASS ( "," RESULT )* NL'
1347
 
1348
`RESULT-CLASS ==>'
1349
     `"done" | "running" | "connected" | "error" | "exit"'
1350
 
1351
`ASYNC-CLASS ==>'
1352
     `"stopped" | OTHERS' (where OTHERS will be added depending on the
1353
     needs--this is still in development).
1354
 
1355
`RESULT ==>'
1356
     `[ STRING "=" ] VALUE'
1357
 
1358
`VALUE ==>'
1359
     `CONST | "{" RESULT ( "," RESULT )* "}"'
1360
 
1361
`CONST ==>'
1362
     `C-STRING'
1363
 
1364
`STREAM-RECORD ==>'
1365
     `CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
1366
 
1367
`CONSOLE-STREAM-OUTPUT ==>'
1368
     `"~" C-STRING'
1369
 
1370
`TARGET-STREAM-OUTPUT ==>'
1371
     `"@" C-STRING'
1372
 
1373
`LOG-STREAM-OUTPUT ==>'
1374
     `"&" C-STRING'
1375
 
1376
`NL ==>'
1377
     `CR | CR-LF'
1378
 
1379
`TOKEN ==>'
1380
     _any sequence of digits_.
1381
 
1382
   In addition, the following are still being developed:
1383
 
1384
`QUERY'
1385
     This action is currently undefined.
1386
 
1387
   Notes:
1388
 
1389
   * All output sequences end in a single line containing a period.
1390
 
1391
   * The `TOKEN' is from the corresponding request.  If an execution
1392
     command is interrupted by the `-exec-interrupt' command, the TOKEN
1393
     associated with the `*stopped' message is the one of the original
1394
     execution command, not the one of the interrupt-command.
1395
 
1396
   * STATUS-ASYNC-OUTPUT contains on-going status information about the
1397
     progress of a slow operation.  It can be discarded.  All status
1398
     output is prefixed by `+'.
1399
 
1400
   * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
1401
     (stopped, started, disappeared).  All async output is prefixed by
1402
     `*'.
1403
 
1404
   * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
1405
     client should handle (e.g., a new breakpoint information).  All
1406
     notify output is prefixed by `='.
1407
 
1408
   * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
1409
     the console.  It is the textual response to a CLI command.  All
1410
     the console output is prefixed by `~'.
1411
 
1412
   * TARGET-STREAM-OUTPUT is the output produced by the target program.
1413
     All the target output is prefixed by `@'.
1414
 
1415
   * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
1416
     instance messages that should be displayed as part of an error
1417
     log.  All the log output is prefixed by `&'.
1418
 
1419
   *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
1420
about the various output records.
1421
 
1422
   *Note GDB/MI Draft Changes to Output Syntax: GDB/MI Draft Changes to
1423
Output Syntax, for proposed revisions to the current output syntax.
1424
 
1425

1426
File: gdb.info,  Node: GDB/MI Simple Examples,  Prev: GDB/MI Output Syntax,  Up: GDB/MI Command Syntax
1427
 
1428
Simple Examples of GDB/MI Interaction
1429
-------------------------------------
1430
 
1431
   This subsection presents several simple examples of interaction using
1432
the GDB/MI interface.  In these examples, `->' means that the following
1433
line is passed to GDB/MI as input, while `<-' means the output received
1434
from GDB/MI.
1435
 
1436
Target Stop
1437
...........
1438
 
1439
   Here's an example of stopping the inferior process:
1440
 
1441
     -> -stop
1442
     <- (gdb)
1443
 
1444
and later:
1445
 
1446
     <- *stop,reason="stop",address="0x123",source="a.c:123"
1447
     <- (gdb)
1448
 
1449
Simple CLI Command
1450
..................
1451
 
1452
   Here's an example of a simple CLI command being passed through
1453
GDB/MI and on to the CLI.
1454
 
1455
     -> print 1+2
1456
     <- ~3\n
1457
     <- (gdb)
1458
 
1459
Command With Side Effects
1460
.........................
1461
 
1462
     -> -symbol-file xyz.exe
1463
     <- *breakpoint,nr="3",address="0x123",source="a.c:123"
1464
     <- (gdb)
1465
 
1466
A Bad Command
1467
.............
1468
 
1469
   Here's what happens if you pass a non-existent command:
1470
 
1471
     -> -rubbish
1472
     <- error,"Rubbish not found"
1473
     <- (gdb)
1474
 
1475

1476
File: gdb.info,  Node: GDB/MI Compatibility with CLI,  Next: GDB/MI Output Records,  Prev: GDB/MI Command Syntax,  Up: GDB/MI
1477
 
1478
GDB/MI Compatibility with CLI
1479
=============================
1480
 
1481
   To help users familiar with GDB's existing CLI interface, GDB/MI
1482
accepts existing CLI commands.  As specified by the syntax, such
1483
commands can be directly entered into the GDB/MI interface and GDB will
1484
respond.
1485
 
1486
   This mechanism is provided as an aid to developers of GDB/MI clients
1487
and not as a reliable interface into the CLI.  Since the command is
1488
being interpreteted in an environment that assumes GDB/MI behaviour,
1489
the exact output of such commands is likely to end up being an
1490
un-supported hybrid of GDB/MI and CLI output.
1491
 
1492

1493
File: gdb.info,  Node: GDB/MI Output Records,  Next: GDB/MI Command Description Format,  Prev: GDB/MI Compatibility with CLI,  Up: GDB/MI
1494
 
1495
GDB/MI Output Records
1496
=====================
1497
 
1498
* Menu:
1499
 
1500
* GDB/MI Result Records::
1501
* GDB/MI Stream Records::
1502
* GDB/MI Out-of-band Records::
1503
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.