1This is gdb.info, produced by makeinfo version 4.6 from ./gdb.texinfo.
2
3INFO-DIR-SECTION Software development
4START-INFO-DIR-ENTRY
5* Gdb: (gdb).                     The GNU debugger.
6END-INFO-DIR-ENTRY
7
8   This file documents the GNU debugger GDB.
9
10   This is the Ninth Edition, of `Debugging with GDB: the GNU
11Source-Level Debugger' for GDB Version 6.2.1.
12
13   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
141998,
151999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
16
17   Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.1 or
19any later version published by the Free Software Foundation; with the
20Invariant Sections being "Free Software" and "Free Software Needs Free
21Documentation", with the Front-Cover Texts being "A GNU Manual," and
22with the Back-Cover Texts as in (a) below.
23
24   (a) The Free Software Foundation's Back-Cover Text is: "You have
25freedom to copy and modify this GNU Manual, like GNU software.  Copies
26published by the Free Software Foundation raise funds for GNU
27development."
28
29
30File: gdb.info,  Node: Built-In Func/Proc,  Next: M2 Constants,  Prev: M2 Operators,  Up: Modula-2
31
32Built-in functions and procedures
33.................................
34
35Modula-2 also makes available several built-in procedures and functions.
36In describing these, the following metavariables are used:
37
38A
39     represents an `ARRAY' variable.
40
41C
42     represents a `CHAR' constant or variable.
43
44I
45     represents a variable or constant of integral type.
46
47M
48     represents an identifier that belongs to a set.  Generally used in
49     the same function with the metavariable S.  The type of S should
50     be `SET OF MTYPE' (where MTYPE is the type of M).
51
52N
53     represents a variable or constant of integral or floating-point
54     type.
55
56R
57     represents a variable or constant of floating-point type.
58
59T
60     represents a type.
61
62V
63     represents a variable.
64
65X
66     represents a variable or constant of one of many types.  See the
67     explanation of the function for details.
68
69   All Modula-2 built-in procedures also return a result, described
70below.
71
72`ABS(N)'
73     Returns the absolute value of N.
74
75`CAP(C)'
76     If C is a lower case letter, it returns its upper case equivalent,
77     otherwise it returns its argument.
78
79`CHR(I)'
80     Returns the character whose ordinal value is I.
81
82`DEC(V)'
83     Decrements the value in the variable V by one.  Returns the new
84     value.
85
86`DEC(V,I)'
87     Decrements the value in the variable V by I.  Returns the new
88     value.
89
90`EXCL(M,S)'
91     Removes the element M from the set S.  Returns the new set.
92
93`FLOAT(I)'
94     Returns the floating point equivalent of the integer I.
95
96`HIGH(A)'
97     Returns the index of the last member of A.
98
99`INC(V)'
100     Increments the value in the variable V by one.  Returns the new
101     value.
102
103`INC(V,I)'
104     Increments the value in the variable V by I.  Returns the new
105     value.
106
107`INCL(M,S)'
108     Adds the element M to the set S if it is not already there.
109     Returns the new set.
110
111`MAX(T)'
112     Returns the maximum value of the type T.
113
114`MIN(T)'
115     Returns the minimum value of the type T.
116
117`ODD(I)'
118     Returns boolean TRUE if I is an odd number.
119
120`ORD(X)'
121     Returns the ordinal value of its argument.  For example, the
122     ordinal value of a character is its ASCII value (on machines
123     supporting the ASCII character set).  X must be of an ordered
124     type, which include integral, character and enumerated types.
125
126`SIZE(X)'
127     Returns the size of its argument.  X can be a variable or a type.
128
129`TRUNC(R)'
130     Returns the integral part of R.
131
132`VAL(T,I)'
133     Returns the member of the type T whose ordinal value is I.
134
135     _Warning:_  Sets and their operations are not yet supported, so
136     GDB treats the use of procedures `INCL' and `EXCL' as an error.
137
138
139File: gdb.info,  Node: M2 Constants,  Next: M2 Defaults,  Prev: Built-In Func/Proc,  Up: Modula-2
140
141Constants
142.........
143
144GDB allows you to express the constants of Modula-2 in the following
145ways:
146
147   * Integer constants are simply a sequence of digits.  When used in an
148     expression, a constant is interpreted to be type-compatible with
149     the rest of the expression.  Hexadecimal integers are specified by
150     a trailing `H', and octal integers by a trailing `B'.
151
152   * Floating point constants appear as a sequence of digits, followed
153     by a decimal point and another sequence of digits.  An optional
154     exponent can then be specified, in the form `E[+|-]NNN', where
155     `[+|-]NNN' is the desired exponent.  All of the digits of the
156     floating point constant must be valid decimal (base 10) digits.
157
158   * Character constants consist of a single character enclosed by a
159     pair of like quotes, either single (`'') or double (`"').  They may
160     also be expressed by their ordinal value (their ASCII value,
161     usually) followed by a `C'.
162
163   * String constants consist of a sequence of characters enclosed by a
164     pair of like quotes, either single (`'') or double (`"').  Escape
165     sequences in the style of C are also allowed.  *Note C and C++
166     constants: C Constants, for a brief explanation of escape
167     sequences.
168
169   * Enumerated constants consist of an enumerated identifier.
170
171   * Boolean constants consist of the identifiers `TRUE' and `FALSE'.
172
173   * Pointer constants consist of integral values only.
174
175   * Set constants are not yet supported.
176
177
178File: gdb.info,  Node: M2 Defaults,  Next: Deviations,  Prev: M2 Constants,  Up: Modula-2
179
180Modula-2 defaults
181.................
182
183If type and range checking are set automatically by GDB, they both
184default to `on' whenever the working language changes to Modula-2.
185This happens regardless of whether you or GDB selected the working
186language.
187
188   If you allow GDB to set the language automatically, then entering
189code compiled from a file whose name ends with `.mod' sets the working
190language to Modula-2.  *Note Having GDB set the language automatically:
191Automatically, for further details.
192
193
194File: gdb.info,  Node: Deviations,  Next: M2 Checks,  Prev: M2 Defaults,  Up: Modula-2
195
196Deviations from standard Modula-2
197.................................
198
199A few changes have been made to make Modula-2 programs easier to debug.
200This is done primarily via loosening its type strictness:
201
202   * Unlike in standard Modula-2, pointer constants can be formed by
203     integers.  This allows you to modify pointer variables during
204     debugging.  (In standard Modula-2, the actual address contained in
205     a pointer variable is hidden from you; it can only be modified
206     through direct assignment to another pointer variable or
207     expression that returned a pointer.)
208
209   * C escape sequences can be used in strings and characters to
210     represent non-printable characters.  GDB prints out strings with
211     these escape sequences embedded.  Single non-printable characters
212     are printed using the `CHR(NNN)' format.
213
214   * The assignment operator (`:=') returns the value of its right-hand
215     argument.
216
217   * All built-in procedures both modify _and_ return their argument.
218
219
220File: gdb.info,  Node: M2 Checks,  Next: M2 Scope,  Prev: Deviations,  Up: Modula-2
221
222Modula-2 type and range checks
223..............................
224
225     _Warning:_ in this release, GDB does not yet perform type or range
226     checking.
227
228   GDB considers two Modula-2 variables type equivalent if:
229
230   * They are of types that have been declared equivalent via a `TYPE
231     T1 = T2' statement
232
233   * They have been declared on the same line.  (Note:  This is true of
234     the GNU Modula-2 compiler, but it may not be true of other
235     compilers.)
236
237   As long as type checking is enabled, any attempt to combine variables
238whose types are not equivalent is an error.
239
240   Range checking is done on all mathematical operations, assignment,
241array index bounds, and all built-in functions and procedures.
242
243
244File: gdb.info,  Node: M2 Scope,  Next: GDB/M2,  Prev: M2 Checks,  Up: Modula-2
245
246The scope operators `::' and `.'
247................................
248
249There are a few subtle differences between the Modula-2 scope operator
250(`.') and the GDB scope operator (`::').  The two have similar syntax:
251
252
253     MODULE . ID
254     SCOPE :: ID
255
256where SCOPE is the name of a module or a procedure, MODULE the name of
257a module, and ID is any declared identifier within your program, except
258another module.
259
260   Using the `::' operator makes GDB search the scope specified by
261SCOPE for the identifier ID.  If it is not found in the specified
262scope, then GDB searches all scopes enclosing the one specified by
263SCOPE.
264
265   Using the `.' operator makes GDB search the current scope for the
266identifier specified by ID that was imported from the definition module
267specified by MODULE.  With this operator, it is an error if the
268identifier ID was not imported from definition module MODULE, or if ID
269is not an identifier in MODULE.
270
271
272File: gdb.info,  Node: GDB/M2,  Prev: M2 Scope,  Up: Modula-2
273
274GDB and Modula-2
275................
276
277Some GDB commands have little use when debugging Modula-2 programs.
278Five subcommands of `set print' and `show print' apply specifically to
279C and C++: `vtbl', `demangle', `asm-demangle', `object', and `union'.
280The first four apply to C++, and the last to the C `union' type, which
281has no direct analogue in Modula-2.
282
283   The `@' operator (*note Expressions: Expressions.), while available
284with any language, is not useful with Modula-2.  Its intent is to aid
285the debugging of "dynamic arrays", which cannot be created in Modula-2
286as they can in C or C++.  However, because an address can be specified
287by an integral constant, the construct `{TYPE}ADREXP' is still useful.
288
289   In GDB scripts, the Modula-2 inequality operator `#' is interpreted
290as the beginning of a comment.  Use `<>' instead.
291
292
293File: gdb.info,  Node: Unsupported languages,  Prev: Support,  Up: Languages
294
295Unsupported languages
296=====================
297
298In addition to the other fully-supported programming languages, GDB
299also provides a pseudo-language, called `minimal'.  It does not
300represent a real programming language, but provides a set of
301capabilities close to what the C or assembly languages provide.  This
302should allow most simple operations to be performed while debugging an
303application that uses a language currently not supported by GDB.
304
305   If the language is set to `auto', GDB will automatically select this
306language if the current frame corresponds to an unsupported language.
307
308
309File: gdb.info,  Node: Symbols,  Next: Altering,  Prev: Languages,  Up: Top
310
311Examining the Symbol Table
312**************************
313
314The commands described in this chapter allow you to inquire about the
315symbols (names of variables, functions and types) defined in your
316program.  This information is inherent in the text of your program and
317does not change as your program executes.  GDB finds it in your
318program's symbol table, in the file indicated when you started GDB
319(*note Choosing files: File Options.), or by one of the file-management
320commands (*note Commands to specify files: Files.).
321
322   Occasionally, you may need to refer to symbols that contain unusual
323characters, which GDB ordinarily treats as word delimiters.  The most
324frequent case is in referring to static variables in other source files
325(*note Program variables: Variables.).  File names are recorded in
326object files as debugging symbols, but GDB would ordinarily parse a
327typical file name, like `foo.c', as the three words `foo' `.' `c'.  To
328allow GDB to recognize `foo.c' as a single symbol, enclose it in single
329quotes; for example,
330
331     p 'foo.c'::x
332
333looks up the value of `x' in the scope of the file `foo.c'.
334
335`info address SYMBOL'
336     Describe where the data for SYMBOL is stored.  For a register
337     variable, this says which register it is kept in.  For a
338     non-register local variable, this prints the stack-frame offset at
339     which the variable is always stored.
340
341     Note the contrast with `print &SYMBOL', which does not work at all
342     for a register variable, and for a stack local variable prints the
343     exact address of the current instantiation of the variable.
344
345`info symbol ADDR'
346     Print the name of a symbol which is stored at the address ADDR.
347     If no symbol is stored exactly at ADDR, GDB prints the nearest
348     symbol and an offset from it:
349
350          (gdb) info symbol 0x54320
351          _initialize_vx + 396 in section .text
352
353     This is the opposite of the `info address' command.  You can use
354     it to find out the name of a variable or a function given its
355     address.
356
357`whatis EXPR'
358     Print the data type of expression EXPR.  EXPR is not actually
359     evaluated, and any side-effecting operations (such as assignments
360     or function calls) inside it do not take place.  *Note
361     Expressions: Expressions.
362
363`whatis'
364     Print the data type of `$', the last value in the value history.
365
366`ptype TYPENAME'
367     Print a description of data type TYPENAME.  TYPENAME may be the
368     name of a type, or for C code it may have the form `class
369     CLASS-NAME', `struct STRUCT-TAG', `union UNION-TAG' or `enum
370     ENUM-TAG'.
371
372`ptype EXPR'
373`ptype'
374     Print a description of the type of expression EXPR.  `ptype'
375     differs from `whatis' by printing a detailed description, instead
376     of just the name of the type.
377
378     For example, for this variable declaration:
379
380          struct complex {double real; double imag;} v;
381
382     the two commands give this output:
383
384          (gdb) whatis v
385          type = struct complex
386          (gdb) ptype v
387          type = struct complex {
388              double real;
389              double imag;
390          }
391
392     As with `whatis', using `ptype' without an argument refers to the
393     type of `$', the last value in the value history.
394
395`info types REGEXP'
396`info types'
397     Print a brief description of all types whose names match REGEXP
398     (or all types in your program, if you supply no argument).  Each
399     complete typename is matched as though it were a complete line;
400     thus, `i type value' gives information on all types in your
401     program whose names include the string `value', but `i type
402     ^value$' gives information only on types whose complete name is
403     `value'.
404
405     This command differs from `ptype' in two ways: first, like
406     `whatis', it does not print a detailed description; second, it
407     lists all source files where a type is defined.
408
409`info scope ADDR'
410     List all the variables local to a particular scope.  This command
411     accepts a location--a function name, a source line, or an address
412     preceded by a `*', and prints all the variables local to the scope
413     defined by that location.  For example:
414
415          (gdb) info scope command_line_handler
416          Scope for command_line_handler:
417          Symbol rl is an argument at stack/frame offset 8, length 4.
418          Symbol linebuffer is in static storage at address 0x150a18, length 4.
419          Symbol linelength is in static storage at address 0x150a1c, length 4.
420          Symbol p is a local variable in register $esi, length 4.
421          Symbol p1 is a local variable in register $ebx, length 4.
422          Symbol nline is a local variable in register $edx, length 4.
423          Symbol repeat is a local variable at frame offset -8, length 4.
424
425     This command is especially useful for determining what data to
426     collect during a "trace experiment", see *Note collect: Tracepoint
427     Actions.
428
429`info source'
430     Show information about the current source file--that is, the
431     source file for the function containing the current point of
432     execution:
433        * the name of the source file, and the directory containing it,
434
435        * the directory it was compiled in,
436
437        * its length, in lines,
438
439        * which programming language it is written in,
440
441        * whether the executable includes debugging information for
442          that file, and if so, what format the information is in
443          (e.g., STABS, Dwarf 2, etc.), and
444
445        * whether the debugging information includes information about
446          preprocessor macros.
447
448`info sources'
449     Print the names of all source files in your program for which
450     there is debugging information, organized into two lists: files
451     whose symbols have already been read, and files whose symbols will
452     be read when needed.
453
454`info functions'
455     Print the names and data types of all defined functions.
456
457`info functions REGEXP'
458     Print the names and data types of all defined functions whose
459     names contain a match for regular expression REGEXP.  Thus, `info
460     fun step' finds all functions whose names include `step'; `info
461     fun ^step' finds those whose names start with `step'.  If a
462     function name contains characters that conflict with the regular
463     expression language (eg.  `operator*()'), they may be quoted with
464     a backslash.
465
466`info variables'
467     Print the names and data types of all variables that are declared
468     outside of functions (i.e. excluding local variables).
469
470`info variables REGEXP'
471     Print the names and data types of all variables (except for local
472     variables) whose names contain a match for regular expression
473     REGEXP.
474
475`info classes'
476`info classes REGEXP'
477     Display all Objective-C classes in your program, or (with the
478     REGEXP argument) all those matching a particular regular
479     expression.
480
481`info selectors'
482`info selectors REGEXP'
483     Display all Objective-C selectors in your program, or (with the
484     REGEXP argument) all those matching a particular regular
485     expression.
486
487     Some systems allow individual object files that make up your
488     program to be replaced without stopping and restarting your
489     program.  For example, in VxWorks you can simply recompile a
490     defective object file and keep on running.  If you are running on
491     one of these systems, you can allow GDB to reload the symbols for
492     automatically relinked modules:
493
494    `set symbol-reloading on'
495          Replace symbol definitions for the corresponding source file
496          when an object file with a particular name is seen again.
497
498    `set symbol-reloading off'
499          Do not replace symbol definitions when encountering object
500          files of the same name more than once.  This is the default
501          state; if you are not running on a system that permits
502          automatic relinking of modules, you should leave
503          `symbol-reloading' off, since otherwise GDB may discard
504          symbols when linking large programs, that may contain several
505          modules (from different directories or libraries) with the
506          same name.
507
508    `show symbol-reloading'
509          Show the current `on' or `off' setting.
510
511`set opaque-type-resolution on'
512     Tell GDB to resolve opaque types.  An opaque type is a type
513     declared as a pointer to a `struct', `class', or `union'--for
514     example, `struct MyType *'--that is used in one source file
515     although the full declaration of `struct MyType' is in another
516     source file.  The default is on.
517
518     A change in the setting of this subcommand will not take effect
519     until the next time symbols for a file are loaded.
520
521`set opaque-type-resolution off'
522     Tell GDB not to resolve opaque types.  In this case, the type is
523     printed as follows:
524          {<no data fields>}
525
526`show opaque-type-resolution'
527     Show whether opaque types are resolved or not.
528
529`maint print symbols FILENAME'
530`maint print psymbols FILENAME'
531`maint print msymbols FILENAME'
532     Write a dump of debugging symbol data into the file FILENAME.
533     These commands are used to debug the GDB symbol-reading code.  Only
534     symbols with debugging data are included.  If you use `maint print
535     symbols', GDB includes all the symbols for which it has already
536     collected full details: that is, FILENAME reflects symbols for
537     only those files whose symbols GDB has read.  You can use the
538     command `info sources' to find out which files these are.  If you
539     use `maint print psymbols' instead, the dump shows information
540     about symbols that GDB only knows partially--that is, symbols
541     defined in files that GDB has skimmed, but not yet read
542     completely.  Finally, `maint print msymbols' dumps just the
543     minimal symbol information required for each object file from
544     which GDB has read some symbols.  *Note Commands to specify files:
545     Files, for a discussion of how GDB reads symbols (in the
546     description of `symbol-file').
547
548`maint info symtabs [ REGEXP ]'
549`maint info psymtabs [ REGEXP ]'
550     List the `struct symtab' or `struct partial_symtab' structures
551     whose names match REGEXP.  If REGEXP is not given, list them all.
552     The output includes expressions which you can copy into a GDB
553     debugging this one to examine a particular structure in more
554     detail.  For example:
555
556          (gdb) maint info psymtabs dwarf2read
557          { objfile /home/gnu/build/gdb/gdb
558            ((struct objfile *) 0x82e69d0)
559            { psymtab /home/gnu/src/gdb/dwarf2read.c
560              ((struct partial_symtab *) 0x8474b10)
561              readin no
562              fullname (null)
563              text addresses 0x814d3c8 -- 0x8158074
564              globals (* (struct partial_symbol **) 0x8507a08 @ 9)
565              statics (* (struct partial_symbol **) 0x40e95b78 @ 2882)
566              dependencies (none)
567            }
568          }
569          (gdb) maint info symtabs
570          (gdb)
571
572     We see that there is one partial symbol table whose filename
573     contains the string `dwarf2read', belonging to the `gdb'
574     executable; and we see that GDB has not read in any symtabs yet at
575     all.  If we set a breakpoint on a function, that will cause GDB to
576     read the symtab for the compilation unit containing that function:
577
578          (gdb) break dwarf2_psymtab_to_symtab
579          Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
580          line 1574.
581          (gdb) maint info symtabs
582          { objfile /home/gnu/build/gdb/gdb
583            ((struct objfile *) 0x82e69d0)
584            { symtab /home/gnu/src/gdb/dwarf2read.c
585              ((struct symtab *) 0x86c1f38)
586              dirname (null)
587              fullname (null)
588              blockvector ((struct blockvector *) 0x86c1bd0) (primary)
589              debugformat DWARF 2
590            }
591          }
592          (gdb)
593
594
595File: gdb.info,  Node: Altering,  Next: GDB Files,  Prev: Symbols,  Up: Top
596
597Altering Execution
598******************
599
600Once you think you have found an error in your program, you might want
601to find out for certain whether correcting the apparent error would
602lead to correct results in the rest of the run.  You can find the
603answer by experiment, using the GDB features for altering execution of
604the program.
605
606   For example, you can store new values into variables or memory
607locations, give your program a signal, restart it at a different
608address, or even return prematurely from a function.
609
610* Menu:
611
612* Assignment::                  Assignment to variables
613* Jumping::                     Continuing at a different address
614* Signaling::                   Giving your program a signal
615* Returning::                   Returning from a function
616* Calling::                     Calling your program's functions
617* Patching::                    Patching your program
618
619
620File: gdb.info,  Node: Assignment,  Next: Jumping,  Up: Altering
621
622Assignment to variables
623=======================
624
625To alter the value of a variable, evaluate an assignment expression.
626*Note Expressions: Expressions.  For example,
627
628     print x=4
629
630stores the value 4 into the variable `x', and then prints the value of
631the assignment expression (which is 4).  *Note Using GDB with Different
632Languages: Languages, for more information on operators in supported
633languages.
634
635   If you are not interested in seeing the value of the assignment, use
636the `set' command instead of the `print' command.  `set' is really the
637same as `print' except that the expression's value is not printed and
638is not put in the value history (*note Value history: Value History.).
639The expression is evaluated only for its effects.
640
641   If the beginning of the argument string of the `set' command appears
642identical to a `set' subcommand, use the `set variable' command instead
643of just `set'.  This command is identical to `set' except for its lack
644of subcommands.  For example, if your program has a variable `width',
645you get an error if you try to set a new value with just `set
646width=13', because GDB has the command `set width':
647
648     (gdb) whatis width
649     type = double
650     (gdb) p width
651     $4 = 13
652     (gdb) set width=47
653     Invalid syntax in expression.
654
655The invalid expression, of course, is `=47'.  In order to actually set
656the program's variable `width', use
657
658     (gdb) set var width=47
659
660   Because the `set' command has many subcommands that can conflict
661with the names of program variables, it is a good idea to use the `set
662variable' command instead of just `set'.  For example, if your program
663has a variable `g', you run into problems if you try to set a new value
664with just `set g=4', because GDB has the command `set gnutarget',
665abbreviated `set g':
666
667     (gdb) whatis g
668     type = double
669     (gdb) p g
670     $1 = 1
671     (gdb) set g=4
672     (gdb) p g
673     $2 = 1
674     (gdb) r
675     The program being debugged has been started already.
676     Start it from the beginning? (y or n) y
677     Starting program: /home/smith/cc_progs/a.out
678     "/home/smith/cc_progs/a.out": can't open to read symbols:
679                                      Invalid bfd target.
680     (gdb) show g
681     The current BFD target is "=4".
682
683The program variable `g' did not change, and you silently set the
684`gnutarget' to an invalid value.  In order to set the variable `g', use
685
686     (gdb) set var g=4
687
688   GDB allows more implicit conversions in assignments than C; you can
689freely store an integer value into a pointer variable or vice versa,
690and you can convert any structure to any other structure that is the
691same length or shorter.
692
693   To store values into arbitrary places in memory, use the `{...}'
694construct to generate a value of specified type at a specified address
695(*note Expressions: Expressions.).  For example, `{int}0x83040' refers
696to memory location `0x83040' as an integer (which implies a certain size
697and representation in memory), and
698
699     set {int}0x83040 = 4
700
701stores the value 4 into that memory location.
702
703
704File: gdb.info,  Node: Jumping,  Next: Signaling,  Prev: Assignment,  Up: Altering
705
706Continuing at a different address
707=================================
708
709Ordinarily, when you continue your program, you do so at the place where
710it stopped, with the `continue' command.  You can instead continue at
711an address of your own choosing, with the following commands:
712
713`jump LINESPEC'
714     Resume execution at line LINESPEC.  Execution stops again
715     immediately if there is a breakpoint there.  *Note Printing source
716     lines: List, for a description of the different forms of LINESPEC.
717     It is common practice to use the `tbreak' command in conjunction
718     with `jump'.  *Note Setting breakpoints: Set Breaks.
719
720     The `jump' command does not change the current stack frame, or the
721     stack pointer, or the contents of any memory location or any
722     register other than the program counter.  If line LINESPEC is in a
723     different function from the one currently executing, the results
724     may be bizarre if the two functions expect different patterns of
725     arguments or of local variables.  For this reason, the `jump'
726     command requests confirmation if the specified line is not in the
727     function currently executing.  However, even bizarre results are
728     predictable if you are well acquainted with the machine-language
729     code of your program.
730
731`jump *ADDRESS'
732     Resume execution at the instruction at address ADDRESS.
733
734   On many systems, you can get much the same effect as the `jump'
735command by storing a new value into the register `$pc'.  The difference
736is that this does not start your program running; it only changes the
737address of where it _will_ run when you continue.  For example,
738
739     set $pc = 0x485
740
741makes the next `continue' command or stepping command execute at
742address `0x485', rather than at the address where your program stopped.
743*Note Continuing and stepping: Continuing and Stepping.
744
745   The most common occasion to use the `jump' command is to back
746up--perhaps with more breakpoints set--over a portion of a program that
747has already executed, in order to examine its execution in more detail.
748
749
750File: gdb.info,  Node: Signaling,  Next: Returning,  Prev: Jumping,  Up: Altering
751
752Giving your program a signal
753============================
754
755`signal SIGNAL'
756     Resume execution where your program stopped, but immediately give
757     it the signal SIGNAL.  SIGNAL can be the name or the number of a
758     signal.  For example, on many systems `signal 2' and `signal
759     SIGINT' are both ways of sending an interrupt signal.
760
761     Alternatively, if SIGNAL is zero, continue execution without
762     giving a signal.  This is useful when your program stopped on
763     account of a signal and would ordinary see the signal when resumed
764     with the `continue' command; `signal 0' causes it to resume
765     without a signal.
766
767     `signal' does not repeat when you press <RET> a second time after
768     executing the command.
769
770   Invoking the `signal' command is not the same as invoking the `kill'
771utility from the shell.  Sending a signal with `kill' causes GDB to
772decide what to do with the signal depending on the signal handling
773tables (*note Signals::).  The `signal' command passes the signal
774directly to your program.
775
776
777File: gdb.info,  Node: Returning,  Next: Calling,  Prev: Signaling,  Up: Altering
778
779Returning from a function
780=========================
781
782`return'
783`return EXPRESSION'
784     You can cancel execution of a function call with the `return'
785     command.  If you give an EXPRESSION argument, its value is used as
786     the function's return value.
787
788   When you use `return', GDB discards the selected stack frame (and
789all frames within it).  You can think of this as making the discarded
790frame return prematurely.  If you wish to specify a value to be
791returned, give that value as the argument to `return'.
792
793   This pops the selected stack frame (*note Selecting a frame:
794Selection.), and any other frames inside of it, leaving its caller as
795the innermost remaining frame.  That frame becomes selected.  The
796specified value is stored in the registers used for returning values of
797functions.
798
799   The `return' command does not resume execution; it leaves the
800program stopped in the state that would exist if the function had just
801returned.  In contrast, the `finish' command (*note Continuing and
802stepping: Continuing and Stepping.) resumes execution until the
803selected stack frame returns naturally.
804
805
806File: gdb.info,  Node: Calling,  Next: Patching,  Prev: Returning,  Up: Altering
807
808Calling program functions
809=========================
810
811`call EXPR'
812     Evaluate the expression EXPR without displaying `void' returned
813     values.
814
815   You can use this variant of the `print' command if you want to
816execute a function from your program, but without cluttering the output
817with `void' returned values.  If the result is not void, it is printed
818and saved in the value history.
819
820
821File: gdb.info,  Node: Patching,  Prev: Calling,  Up: Altering
822
823Patching programs
824=================
825
826By default, GDB opens the file containing your program's executable
827code (or the corefile) read-only.  This prevents accidental alterations
828to machine code; but it also prevents you from intentionally patching
829your program's binary.
830
831   If you'd like to be able to patch the binary, you can specify that
832explicitly with the `set write' command.  For example, you might want
833to turn on internal debugging flags, or even to make emergency repairs.
834
835`set write on'
836`set write off'
837     If you specify `set write on', GDB opens executable and core files
838     for both reading and writing; if you specify `set write off' (the
839     default), GDB opens them read-only.
840
841     If you have already loaded a file, you must load it again (using
842     the `exec-file' or `core-file' command) after changing `set
843     write', for your new setting to take effect.
844
845`show write'
846     Display whether executable files and core files are opened for
847     writing as well as reading.
848
849
850File: gdb.info,  Node: GDB Files,  Next: Targets,  Prev: Altering,  Up: Top
851
852GDB Files
853*********
854
855GDB needs to know the file name of the program to be debugged, both in
856order to read its symbol table and in order to start your program.  To
857debug a core dump of a previous run, you must also tell GDB the name of
858the core dump file.
859
860* Menu:
861
862* Files::                       Commands to specify files
863* Separate Debug Files::        Debugging information in separate files
864* Symbol Errors::               Errors reading symbol files
865
866
867File: gdb.info,  Node: Files,  Next: Separate Debug Files,  Up: GDB Files
868
869Commands to specify files
870=========================
871
872You may want to specify executable and core dump file names.  The usual
873way to do this is at start-up time, using the arguments to GDB's
874start-up commands (*note Getting In and Out of GDB: Invocation.).
875
876   Occasionally it is necessary to change to a different file during a
877GDB session.  Or you may run GDB and forget to specify a file you want
878to use.  In these situations the GDB commands to specify new files are
879useful.
880
881`file FILENAME'
882     Use FILENAME as the program to be debugged.  It is read for its
883     symbols and for the contents of pure memory.  It is also the
884     program executed when you use the `run' command.  If you do not
885     specify a directory and the file is not found in the GDB working
886     directory, GDB uses the environment variable `PATH' as a list of
887     directories to search, just as the shell does when looking for a
888     program to run.  You can change the value of this variable, for
889     both GDB and your program, using the `path' command.
890
891     On systems with memory-mapped files, an auxiliary file named
892     `FILENAME.syms' may hold symbol table information for FILENAME.
893     If so, GDB maps in the symbol table from `FILENAME.syms', starting
894     up more quickly.  See the descriptions of the file options
895     `-mapped' and `-readnow' (available on the command line, and with
896     the commands `file', `symbol-file', or `add-symbol-file',
897     described below), for more information.
898
899`file'
900     `file' with no argument makes GDB discard any information it has
901     on both executable file and the symbol table.
902
903`exec-file [ FILENAME ]'
904     Specify that the program to be run (but not the symbol table) is
905     found in FILENAME.  GDB searches the environment variable `PATH'
906     if necessary to locate your program.  Omitting FILENAME means to
907     discard information on the executable file.
908
909`symbol-file [ FILENAME ]'
910     Read symbol table information from file FILENAME.  `PATH' is
911     searched when necessary.  Use the `file' command to get both symbol
912     table and program to run from the same file.
913
914     `symbol-file' with no argument clears out GDB information on your
915     program's symbol table.
916
917     The `symbol-file' command causes GDB to forget the contents of its
918     convenience variables, the value history, and all breakpoints and
919     auto-display expressions.  This is because they may contain
920     pointers to the internal data recording symbols and data types,
921     which are part of the old symbol table data being discarded inside
922     GDB.
923
924     `symbol-file' does not repeat if you press <RET> again after
925     executing it once.
926
927     When GDB is configured for a particular environment, it
928     understands debugging information in whatever format is the
929     standard generated for that environment; you may use either a GNU
930     compiler, or other compilers that adhere to the local conventions.
931     Best results are usually obtained from GNU compilers; for example,
932     using `gcc' you can generate debugging information for optimized
933     code.
934
935     For most kinds of object files, with the exception of old SVR3
936     systems using COFF, the `symbol-file' command does not normally
937     read the symbol table in full right away.  Instead, it scans the
938     symbol table quickly to find which source files and which symbols
939     are present.  The details are read later, one source file at a
940     time, as they are needed.
941
942     The purpose of this two-stage reading strategy is to make GDB
943     start up faster.  For the most part, it is invisible except for
944     occasional pauses while the symbol table details for a particular
945     source file are being read.  (The `set verbose' command can turn
946     these pauses into messages if desired.  *Note Optional warnings
947     and messages: Messages/Warnings.)
948
949     We have not implemented the two-stage strategy for COFF yet.  When
950     the symbol table is stored in COFF format, `symbol-file' reads the
951     symbol table data in full right away.  Note that "stabs-in-COFF"
952     still does the two-stage strategy, since the debug info is actually
953     in stabs format.
954
955`symbol-file FILENAME [ -readnow ] [ -mapped ]'
956`file FILENAME [ -readnow ] [ -mapped ]'
957     You can override the GDB two-stage strategy for reading symbol
958     tables by using the `-readnow' option with any of the commands that
959     load symbol table information, if you want to be sure GDB has the
960     entire symbol table available.
961
962     If memory-mapped files are available on your system through the
963     `mmap' system call, you can use another option, `-mapped', to
964     cause GDB to write the symbols for your program into a reusable
965     file.  Future GDB debugging sessions map in symbol information
966     from this auxiliary symbol file (if the program has not changed),
967     rather than spending time reading the symbol table from the
968     executable program.  Using the `-mapped' option has the same
969     effect as starting GDB with the `-mapped' command-line option.
970
971     You can use both options together, to make sure the auxiliary
972     symbol file has all the symbol information for your program.
973
974     The auxiliary symbol file for a program called MYPROG is called
975     `MYPROG.syms'.  Once this file exists (so long as it is newer than
976     the corresponding executable), GDB always attempts to use it when
977     you debug MYPROG; no special options or commands are needed.
978
979     The `.syms' file is specific to the host machine where you run
980     GDB.  It holds an exact image of the internal GDB symbol table.
981     It cannot be shared across multiple host platforms.
982
983`core-file [ FILENAME ]'
984`core'
985     Specify the whereabouts of a core dump file to be used as the
986     "contents of memory".  Traditionally, core files contain only some
987     parts of the address space of the process that generated them; GDB
988     can access the executable file itself for other parts.
989
990     `core-file' with no argument specifies that no core file is to be
991     used.
992
993     Note that the core file is ignored when your program is actually
994     running under GDB.  So, if you have been running your program and
995     you wish to debug a core file instead, you must kill the
996     subprocess in which the program is running.  To do this, use the
997     `kill' command (*note Killing the child process: Kill Process.).
998
999`add-symbol-file FILENAME ADDRESS'
1000`add-symbol-file FILENAME ADDRESS [ -readnow ] [ -mapped ]'
1001`add-symbol-file FILENAME -sSECTION ADDRESS ...'
1002     The `add-symbol-file' command reads additional symbol table
1003     information from the file FILENAME.  You would use this command
1004     when FILENAME has been dynamically loaded (by some other means)
1005     into the program that is running.  ADDRESS should be the memory
1006     address at which the file has been loaded; GDB cannot figure this
1007     out for itself.  You can additionally specify an arbitrary number
1008     of `-sSECTION ADDRESS' pairs, to give an explicit section name and
1009     base address for that section.  You can specify any ADDRESS as an
1010     expression.
1011
1012     The symbol table of the file FILENAME is added to the symbol table
1013     originally read with the `symbol-file' command.  You can use the
1014     `add-symbol-file' command any number of times; the new symbol data
1015     thus read keeps adding to the old.  To discard all old symbol data
1016     instead, use the `symbol-file' command without any arguments.
1017
1018     Although FILENAME is typically a shared library file, an
1019     executable file, or some other object file which has been fully
1020     relocated for loading into a process, you can also load symbolic
1021     information from relocatable `.o' files, as long as:
1022
1023        * the file's symbolic information refers only to linker symbols
1024          defined in that file, not to symbols defined by other object
1025          files,
1026
1027        * every section the file's symbolic information refers to has
1028          actually been loaded into the inferior, as it appears in the
1029          file, and
1030
1031        * you can determine the address at which every section was
1032          loaded, and provide these to the `add-symbol-file' command.
1033
1034     Some embedded operating systems, like Sun Chorus and VxWorks, can
1035     load relocatable files into an already running program; such
1036     systems typically make the requirements above easy to meet.
1037     However, it's important to recognize that many native systems use
1038     complex link procedures (`.linkonce' section factoring and C++
1039     constructor table assembly, for example) that make the
1040     requirements difficult to meet.  In general, one cannot assume
1041     that using `add-symbol-file' to read a relocatable object file's
1042     symbolic information will have the same effect as linking the
1043     relocatable object file into the program in the normal way.
1044
1045     `add-symbol-file' does not repeat if you press <RET> after using
1046     it.
1047
1048     You can use the `-mapped' and `-readnow' options just as with the
1049     `symbol-file' command, to change how GDB manages the symbol table
1050     information for FILENAME.
1051
1052`add-shared-symbol-file'
1053     The `add-shared-symbol-file' command can be used only under
1054     Harris' CXUX operating system for the Motorola 88k.  GDB
1055     automatically looks for shared libraries, however if GDB does not
1056     find yours, you can run `add-shared-symbol-file'.  It takes no
1057     arguments.
1058
1059`section'
1060     The `section' command changes the base address of section SECTION
1061     of the exec file to ADDR.  This can be used if the exec file does
1062     not contain section addresses, (such as in the a.out format), or
1063     when the addresses specified in the file itself are wrong.  Each
1064     section must be changed separately.  The `info files' command,
1065     described below, lists all the sections and their addresses.
1066
1067`info files'
1068`info target'
1069     `info files' and `info target' are synonymous; both print the
1070     current target (*note Specifying a Debugging Target: Targets.),
1071     including the names of the executable and core dump files
1072     currently in use by GDB, and the files from which symbols were
1073     loaded.  The command `help target' lists all possible targets
1074     rather than current ones.
1075
1076`maint info sections'
1077     Another command that can give you extra information about program
1078     sections is `maint info sections'.  In addition to the section
1079     information displayed by `info files', this command displays the
1080     flags and file offset of each section in the executable and core
1081     dump files.  In addition, `maint info sections' provides the
1082     following command options (which may be arbitrarily combined):
1083
1084    `ALLOBJ'
1085          Display sections for all loaded object files, including
1086          shared libraries.
1087
1088    `SECTIONS'
1089          Display info only for named SECTIONS.
1090
1091    `SECTION-FLAGS'
1092          Display info only for sections for which SECTION-FLAGS are
1093          true.  The section flags that GDB currently knows about are:
1094         `ALLOC'
1095               Section will have space allocated in the process when
1096               loaded.  Set for all sections except those containing
1097               debug information.
1098
1099         `LOAD'
1100               Section will be loaded from the file into the child
1101               process memory.  Set for pre-initialized code and data,
1102               clear for `.bss' sections.
1103
1104         `RELOC'
1105               Section needs to be relocated before loading.
1106
1107         `READONLY'
1108               Section cannot be modified by the child process.
1109
1110         `CODE'
1111               Section contains executable code only.
1112
1113         `DATA'
1114               Section contains data only (no executable code).
1115
1116         `ROM'
1117               Section will reside in ROM.
1118
1119         `CONSTRUCTOR'
1120               Section contains data for constructor/destructor lists.
1121
1122         `HAS_CONTENTS'
1123               Section is not empty.
1124
1125         `NEVER_LOAD'
1126               An instruction to the linker to not output the section.
1127
1128         `COFF_SHARED_LIBRARY'
1129               A notification to the linker that the section contains
1130               COFF shared library information.
1131
1132         `IS_COMMON'
1133               Section contains common symbols.
1134
1135`set trust-readonly-sections on'
1136     Tell GDB that readonly sections in your object file really are
1137     read-only (i.e. that their contents will not change).  In that
1138     case, GDB can fetch values from these sections out of the object
1139     file, rather than from the target program.  For some targets
1140     (notably embedded ones), this can be a significant enhancement to
1141     debugging performance.
1142
1143     The default is off.
1144
1145`set trust-readonly-sections off'
1146     Tell GDB not to trust readonly sections.  This means that the
1147     contents of the section might change while the program is running,
1148     and must therefore be fetched from the target when needed.
1149
1150   All file-specifying commands allow both absolute and relative file
1151names as arguments.  GDB always converts the file name to an absolute
1152file name and remembers it that way.
1153
1154   GDB supports HP-UX, SunOS, SVr4, Irix 5, and IBM RS/6000 shared
1155libraries.
1156
1157   GDB automatically loads symbol definitions from shared libraries
1158when you use the `run' command, or when you examine a core file.
1159(Before you issue the `run' command, GDB does not understand references
1160to a function in a shared library, however--unless you are debugging a
1161core file).
1162
1163   On HP-UX, if the program loads a library explicitly, GDB
1164automatically loads the symbols at the time of the `shl_load' call.
1165
1166   There are times, however, when you may wish to not automatically load
1167symbol definitions from shared libraries, such as when they are
1168particularly large or there are many of them.
1169
1170   To control the automatic loading of shared library symbols, use the
1171commands:
1172
1173`set auto-solib-add MODE'
1174     If MODE is `on', symbols from all shared object libraries will be
1175     loaded automatically when the inferior begins execution, you
1176     attach to an independently started inferior, or when the dynamic
1177     linker informs GDB that a new library has been loaded.  If MODE is
1178     `off', symbols must be loaded manually, using the `sharedlibrary'
1179     command.  The default value is `on'.
1180
1181`show auto-solib-add'
1182     Display the current autoloading mode.
1183
1184   To explicitly load shared library symbols, use the `sharedlibrary'
1185command:
1186
1187`info share'
1188`info sharedlibrary'
1189     Print the names of the shared libraries which are currently loaded.
1190
1191`sharedlibrary REGEX'
1192`share REGEX'
1193     Load shared object library symbols for files matching a Unix
1194     regular expression.  As with files loaded automatically, it only
1195     loads shared libraries required by your program for a core file or
1196     after typing `run'.  If REGEX is omitted all shared libraries
1197     required by your program are loaded.
1198
1199   On some systems, such as HP-UX systems, GDB supports autoloading
1200shared library symbols until a limiting threshold size is reached.
1201This provides the benefit of allowing autoloading to remain on by
1202default, but avoids autoloading excessively large shared libraries, up
1203to a threshold that is initially set, but which you can modify if you
1204wish.
1205
1206   Beyond that threshold, symbols from shared libraries must be
1207explicitly loaded.  To load these symbols, use the command
1208`sharedlibrary FILENAME'.  The base address of the shared library is
1209determined automatically by GDB and need not be specified.
1210
1211   To display or set the threshold, use the commands:
1212
1213`set auto-solib-limit THRESHOLD'
1214     Set the autoloading size threshold, in an integral number of
1215     megabytes.  If THRESHOLD is nonzero and shared library autoloading
1216     is enabled, symbols from all shared object libraries will be
1217     loaded until the total size of the loaded shared library symbols
1218     exceeds this threshold.  Otherwise, symbols must be loaded
1219     manually, using the `sharedlibrary' command.  The default
1220     threshold is 100 (i.e. 100 Mb).
1221
1222`show auto-solib-limit'
1223     Display the current autoloading size threshold, in megabytes.
1224
1225   Shared libraries are also supported in many cross or remote debugging
1226configurations.  A copy of the target's libraries need to be present on
1227the host system; they need to be the same as the target libraries,
1228although the copies on the target can be stripped as long as the copies
1229on the host are not.
1230
1231   You need to tell GDB where the target libraries are, so that it can
1232load the correct copies--otherwise, it may try to load the host's
1233libraries.  GDB has two variables to specify the search directories for
1234target libraries.
1235
1236`set solib-absolute-prefix PATH'
1237     If this variable is set, PATH will be used as a prefix for any
1238     absolute shared library paths; many runtime loaders store the
1239     absolute paths to the shared library in the target program's
1240     memory.  If you use `solib-absolute-prefix' to find shared
1241     libraries, they need to be laid out in the same way that they are
1242     on the target, with e.g. a `/usr/lib' hierarchy under PATH.
1243
1244     You can set the default value of `solib-absolute-prefix' by using
1245     the configure-time `--with-sysroot' option.
1246
1247`show solib-absolute-prefix'
1248     Display the current shared library prefix.
1249
1250`set solib-search-path PATH'
1251     If this variable is set, PATH is a colon-separated list of
1252     directories to search for shared libraries.  `solib-search-path'
1253     is used after `solib-absolute-prefix' fails to locate the library,
1254     or if the path to the library is relative instead of absolute.  If
1255     you want to use `solib-search-path' instead of
1256     `solib-absolute-prefix', be sure to set `solib-absolute-prefix' to
1257     a nonexistant directory to prevent GDB from finding your host's
1258     libraries.
1259
1260`show solib-search-path'
1261     Display the current shared library search path.
1262
1263
1264File: gdb.info,  Node: Separate Debug Files,  Next: Symbol Errors,  Prev: Files,  Up: GDB Files
1265
1266Debugging Information in Separate Files
1267=======================================
1268
1269GDB allows you to put a program's debugging information in a file
1270separate from the executable itself, in a way that allows GDB to find
1271and load the debugging information automatically.  Since debugging
1272information can be very large -- sometimes larger than the executable
1273code itself -- some systems distribute debugging information for their
1274executables in separate files, which users can install only when they
1275need to debug a problem.
1276
1277   If an executable's debugging information has been extracted to a
1278separate file, the executable should contain a "debug link" giving the
1279name of the debugging information file (with no directory components),
1280and a checksum of its contents.  (The exact form of a debug link is
1281described below.)  If the full name of the directory containing the
1282executable is EXECDIR, and the executable has a debug link that
1283specifies the name DEBUGFILE, then GDB will automatically search for
1284the debugging information file in three places:
1285
1286   * the directory containing the executable file (that is, it will look
1287     for a file named `EXECDIR/DEBUGFILE',
1288
1289   * a subdirectory of that directory named `.debug' (that is, the file
1290     `EXECDIR/.debug/DEBUGFILE', and
1291
1292   * a subdirectory of the global debug file directory that includes the
1293     executable's full path, and the name from the link (that is, the
1294     file `GLOBALDEBUGDIR/EXECDIR/DEBUGFILE', where GLOBALDEBUGDIR is
1295     the global debug file directory, and EXECDIR has been turned into
1296     a relative path).
1297
1298GDB checks under each of these names for a debugging information file
1299whose checksum matches that given in the link, and reads the debugging
1300information from the first one it finds.
1301
1302   So, for example, if you ask GDB to debug `/usr/bin/ls', which has a
1303link containing the name `ls.debug', and the global debug directory is
1304`/usr/lib/debug', then GDB will look for debug information in
1305`/usr/bin/ls.debug', `/usr/bin/.debug/ls.debug', and
1306`/usr/lib/debug/usr/bin/ls.debug'.
1307
1308   You can set the global debugging info directory's name, and view the
1309name GDB is currently using.
1310
1311`set debug-file-directory DIRECTORY'
1312     Set the directory which GDB searches for separate debugging
1313     information files to DIRECTORY.
1314
1315`show debug-file-directory'
1316     Show the directory GDB searches for separate debugging information
1317     files.
1318
1319
1320   A debug link is a special section of the executable file named
1321`.gnu_debuglink'.  The section must contain:
1322
1323   * A filename, with any leading directory components removed,
1324     followed by a zero byte,
1325
1326   * zero to three bytes of padding, as needed to reach the next
1327     four-byte boundary within the section, and
1328
1329   * a four-byte CRC checksum, stored in the same endianness used for
1330     the executable file itself.  The checksum is computed on the
1331     debugging information file's full contents by the function given
1332     below, passing zero as the CRC argument.
1333
1334   Any executable file format can carry a debug link, as long as it can
1335contain a section named `.gnu_debuglink' with the contents described
1336above.
1337
1338   The debugging information file itself should be an ordinary
1339executable, containing a full set of linker symbols, sections, and
1340debugging information.  The sections of the debugging information file
1341should have the same names, addresses and sizes as the original file,
1342but they need not contain any data -- much like a `.bss' section in an
1343ordinary executable.
1344
1345   As of December 2002, there is no standard GNU utility to produce
1346separated executable / debugging information file pairs.  Ulrich
1347Drepper's `elfutils' package, starting with version 0.53, contains a
1348version of the `strip' command such that the command `strip foo -f
1349foo.debug' removes the debugging information from the executable file
1350`foo', places it in the file `foo.debug', and leaves behind a debug
1351link in `foo'.
1352
1353   Since there are many different ways to compute CRC's (different
1354polynomials, reversals, byte ordering, etc.), the simplest way to
1355describe the CRC used in `.gnu_debuglink' sections is to give the
1356complete code for a function that computes it:
1357
1358     unsigned long
1359     gnu_debuglink_crc32 (unsigned long crc,
1360                          unsigned char *buf, size_t len)
1361     {
1362       static const unsigned long crc32_table[256] =
1363         {
1364           0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
1365           0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
1366           0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
1367           0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
1368           0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
1369           0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
1370           0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
1371           0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
1372           0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
1373           0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
1374           0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
1375           0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
1376           0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
1377           0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
1378           0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
1379           0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
1380           0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
1381           0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
1382           0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
1383           0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
1384           0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
1385           0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
1386           0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
1387           0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
1388           0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
1389           0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
1390           0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
1391           0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
1392           0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
1393           0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
1394           0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
1395           0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
1396           0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
1397           0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
1398           0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
1399           0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
1400           0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
1401           0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
1402           0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
1403           0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
1404           0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
1405           0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
1406           0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
1407           0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
1408           0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
1409           0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
1410           0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
1411           0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
1412           0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
1413           0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
1414           0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
1415           0x2d02ef8d
1416         };
1417       unsigned char *end;
1418
1419       crc = ~crc & 0xffffffff;
1420       for (end = buf + len; buf < end; ++buf)
1421         crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
1422       return ~crc & 0xffffffff;
1423     }
1424
1425
1426File: gdb.info,  Node: Symbol Errors,  Prev: Separate Debug Files,  Up: GDB Files
1427
1428Errors reading symbol files
1429===========================
1430
1431While reading a symbol file, GDB occasionally encounters problems, such
1432as symbol types it does not recognize, or known bugs in compiler
1433output.  By default, GDB does not notify you of such problems, since
1434they are relatively common and primarily of interest to people
1435debugging compilers.  If you are interested in seeing information about
1436ill-constructed symbol tables, you can either ask GDB to print only one
1437message about each such type of problem, no matter how many times the
1438problem occurs; or you can ask GDB to print more messages, to see how
1439many times the problems occur, with the `set complaints' command (*note
1440Optional warnings and messages: Messages/Warnings.).
1441
1442   The messages currently printed, and their meanings, include:
1443
1444`inner block not inside outer block in SYMBOL'
1445     The symbol information shows where symbol scopes begin and end
1446     (such as at the start of a function or a block of statements).
1447     This error indicates that an inner scope block is not fully
1448     contained in its outer scope blocks.
1449
1450     GDB circumvents the problem by treating the inner block as if it
1451     had the same scope as the outer block.  In the error message,
1452     SYMBOL may be shown as "`(don't know)'" if the outer block is not a
1453     function.
1454
1455`block at ADDRESS out of order'
1456     The symbol information for symbol scope blocks should occur in
1457     order of increasing addresses.  This error indicates that it does
1458     not do so.
1459
1460     GDB does not circumvent this problem, and has trouble locating
1461     symbols in the source file whose symbols it is reading.  (You can
1462     often determine what source file is affected by specifying `set
1463     verbose on'.  *Note Optional warnings and messages:
1464     Messages/Warnings.)
1465
1466`bad block start address patched'
1467     The symbol information for a symbol scope block has a start address
1468     smaller than the address of the preceding source line.  This is
1469     known to occur in the SunOS 4.1.1 (and earlier) C compiler.
1470
1471     GDB circumvents the problem by treating the symbol scope block as
1472     starting on the previous source line.
1473
1474`bad string table offset in symbol N'
1475     Symbol number N contains a pointer into the string table which is
1476     larger than the size of the string table.
1477
1478     GDB circumvents the problem by considering the symbol to have the
1479     name `foo', which may cause other problems if many symbols end up
1480     with this name.
1481
1482`unknown symbol type `0xNN''
1483     The symbol information contains new data types that GDB does not
1484     yet know how to read.  `0xNN' is the symbol type of the
1485     uncomprehended information, in hexadecimal.
1486
1487     GDB circumvents the error by ignoring this symbol information.
1488     This usually allows you to debug your program, though certain
1489     symbols are not accessible.  If you encounter such a problem and
1490     feel like debugging it, you can debug `gdb' with itself, breakpoint
1491     on `complain', then go up to the function `read_dbx_symtab' and
1492     examine `*bufp' to see the symbol.
1493
1494`stub type has NULL name'
1495     GDB could not find the full definition for a struct or class.
1496
1497`const/volatile indicator missing (ok if using g++ v1.x), got...'
1498     The symbol information for a C++ member function is missing some
1499     information that recent versions of the compiler should have
1500     output for it.
1501
1502`info mismatch between compiler and debugger'
1503     GDB could not parse a type specification output by the compiler.
1504
1505
1506
1507File: gdb.info,  Node: Targets,  Next: Remote Debugging,  Prev: GDB Files,  Up: Top
1508
1509Specifying a Debugging Target
1510*****************************
1511
1512A "target" is the execution environment occupied by your program.
1513
1514   Often, GDB runs in the same host environment as your program; in
1515that case, the debugging target is specified as a side effect when you
1516use the `file' or `core' commands.  When you need more flexibility--for
1517example, running GDB on a physically separate host, or controlling a
1518standalone system over a serial port or a realtime system over a TCP/IP
1519connection--you can use the `target' command to specify one of the
1520target types configured for GDB (*note Commands for managing targets:
1521Target Commands.).
1522
1523* Menu:
1524
1525* Active Targets::              Active targets
1526* Target Commands::             Commands for managing targets
1527* Byte Order::                  Choosing target byte order
1528* Remote::                      Remote debugging
1529* KOD::                         Kernel Object Display
1530
1531
1532File: gdb.info,  Node: Active Targets,  Next: Target Commands,  Up: Targets
1533
1534Active targets
1535==============
1536
1537There are three classes of targets: processes, core files, and
1538executable files.  GDB can work concurrently on up to three active
1539targets, one in each class.  This allows you to (for example) start a
1540process and inspect its activity without abandoning your work on a core
1541file.
1542
1543   For example, if you execute `gdb a.out', then the executable file
1544`a.out' is the only active target.  If you designate a core file as
1545well--presumably from a prior run that crashed and coredumped--then GDB
1546has two active targets and uses them in tandem, looking first in the
1547corefile target, then in the executable file, to satisfy requests for
1548memory addresses.  (Typically, these two classes of target are
1549complementary, since core files contain only a program's read-write
1550memory--variables and so on--plus machine status, while executable
1551files contain only the program text and initialized data.)
1552
1553   When you type `run', your executable file becomes an active process
1554target as well.  When a process target is active, all GDB commands
1555requesting memory addresses refer to that target; addresses in an
1556active core file or executable file target are obscured while the
1557process target is active.
1558
1559   Use the `core-file' and `exec-file' commands to select a new core
1560file or executable target (*note Commands to specify files: Files.).
1561To specify as a target a process that is already running, use the
1562`attach' command (*note Debugging an already-running process: Attach.).
1563
1564
1565File: gdb.info,  Node: Target Commands,  Next: Byte Order,  Prev: Active Targets,  Up: Targets
1566
1567Commands for managing targets
1568=============================
1569
1570`target TYPE PARAMETERS'
1571     Connects the GDB host environment to a target machine or process.
1572     A target is typically a protocol for talking to debugging
1573     facilities.  You use the argument TYPE to specify the type or
1574     protocol of the target machine.
1575
1576     Further PARAMETERS are interpreted by the target protocol, but
1577     typically include things like device names or host names to connect
1578     with, process numbers, and baud rates.
1579
1580     The `target' command does not repeat if you press <RET> again
1581     after executing the command.
1582
1583`help target'
1584     Displays the names of all targets available.  To display targets
1585     currently selected, use either `info target' or `info files'
1586     (*note Commands to specify files: Files.).
1587
1588`help target NAME'
1589     Describe a particular target, including any parameters necessary to
1590     select it.
1591
1592`set gnutarget ARGS'
1593     GDB uses its own library BFD to read your files.  GDB knows
1594     whether it is reading an "executable", a "core", or a ".o" file;
1595     however, you can specify the file format with the `set gnutarget'
1596     command.  Unlike most `target' commands, with `gnutarget' the
1597     `target' refers to a program, not a machine.
1598
1599          _Warning:_ To specify a file format with `set gnutarget', you
1600          must know the actual BFD name.
1601
1602     *Note Commands to specify files: Files.
1603
1604`show gnutarget'
1605     Use the `show gnutarget' command to display what file format
1606     `gnutarget' is set to read.  If you have not set `gnutarget', GDB
1607     will determine the file format for each file automatically, and
1608     `show gnutarget' displays `The current BDF target is "auto"'.
1609
1610   Here are some common targets (available, or not, depending on the GDB
1611configuration):
1612
1613`target exec PROGRAM'
1614     An executable file.  `target exec PROGRAM' is the same as
1615     `exec-file PROGRAM'.
1616
1617`target core FILENAME'
1618     A core dump file.  `target core FILENAME' is the same as
1619     `core-file FILENAME'.
1620
1621`target remote DEV'
1622     Remote serial target in GDB-specific protocol.  The argument DEV
1623     specifies what serial device to use for the connection (e.g.
1624     `/dev/ttya'). *Note Remote debugging: Remote.  `target remote'
1625     supports the `load' command.  This is only useful if you have some
1626     other way of getting the stub to the target system, and you can put
1627     it somewhere in memory where it won't get clobbered by the
1628     download.
1629
1630`target sim'
1631     Builtin CPU simulator.  GDB includes simulators for most
1632     architectures.  In general,
1633                  target sim
1634                  load
1635                  run
1636
1637     works; however, you cannot assume that a specific memory map,
1638     device drivers, or even basic I/O is available, although some
1639     simulators do provide these.  For info about any
1640     processor-specific simulator details, see the appropriate section
1641     in *Note Embedded Processors: Embedded Processors.
1642
1643
1644   Some configurations may include these targets as well:
1645
1646`target nrom DEV'
1647     NetROM ROM emulator.  This target only supports downloading.
1648
1649
1650   Different targets are available on different configurations of GDB;
1651your configuration may have more or fewer targets.
1652
1653   Many remote targets require you to download the executable's code
1654once you've successfully established a connection.
1655
1656`load FILENAME'
1657     Depending on what remote debugging facilities are configured into
1658     GDB, the `load' command may be available.  Where it exists, it is
1659     meant to make FILENAME (an executable) available for debugging on
1660     the remote system--by downloading, or dynamic linking, for example.
1661     `load' also records the FILENAME symbol table in GDB, like the
1662     `add-symbol-file' command.
1663
1664     If your GDB does not have a `load' command, attempting to execute
1665     it gets the error message "`You can't do that when your target is
1666     ...'"
1667
1668     The file is loaded at whatever address is specified in the
1669     executable.  For some object file formats, you can specify the
1670     load address when you link the program; for other formats, like
1671     a.out, the object file format specifies a fixed address.
1672
1673     `load' does not repeat if you press <RET> again after using it.
1674
1675
1676File: gdb.info,  Node: Byte Order,  Next: Remote,  Prev: Target Commands,  Up: Targets
1677
1678Choosing target byte order
1679==========================
1680
1681Some types of processors, such as the MIPS, PowerPC, and Renesas SH,
1682offer the ability to run either big-endian or little-endian byte
1683orders.  Usually the executable or symbol will include a bit to
1684designate the endian-ness, and you will not need to worry about which
1685to use.  However, you may still find it useful to adjust GDB's idea of
1686processor endian-ness manually.
1687
1688`set endian big'
1689     Instruct GDB to assume the target is big-endian.
1690
1691`set endian little'
1692     Instruct GDB to assume the target is little-endian.
1693
1694`set endian auto'
1695     Instruct GDB to use the byte order associated with the executable.
1696
1697`show endian'
1698     Display GDB's current idea of the target byte order.
1699
1700
1701   Note that these commands merely adjust interpretation of symbolic
1702data on the host, and that they have absolutely no effect on the target
1703system.
1704
1705
1706File: gdb.info,  Node: Remote,  Next: KOD,  Prev: Byte Order,  Up: Targets
1707
1708Remote debugging
1709================
1710
1711If you are trying to debug a program running on a machine that cannot
1712run GDB in the usual way, it is often useful to use remote debugging.
1713For example, you might use remote debugging on an operating system
1714kernel, or on a small system which does not have a general purpose
1715operating system powerful enough to run a full-featured debugger.
1716
1717   Some configurations of GDB have special serial or TCP/IP interfaces
1718to make this work with particular debugging targets.  In addition, GDB
1719comes with a generic serial protocol (specific to GDB, but not specific
1720to any particular target system) which you can use if you write the
1721remote stubs--the code that runs on the remote system to communicate
1722with GDB.
1723
1724   Other remote targets may be available in your configuration of GDB;
1725use `help target' to list them.
1726
1727
1728File: gdb.info,  Node: KOD,  Prev: Remote,  Up: Targets
1729
1730Kernel Object Display
1731=====================
1732
1733Some targets support kernel object display.  Using this facility, GDB
1734communicates specially with the underlying operating system and can
1735display information about operating system-level objects such as
1736mutexes and other synchronization objects.  Exactly which objects can be
1737displayed is determined on a per-OS basis.
1738
1739   Use the `set os' command to set the operating system.  This tells
1740GDB which kernel object display module to initialize:
1741
1742     (gdb) set os cisco
1743
1744   The associated command `show os' displays the operating system set
1745with the `set os' command; if no operating system has been set, `show
1746os' will display an empty string `""'.
1747
1748   If `set os' succeeds, GDB will display some information about the
1749operating system, and will create a new `info' command which can be
1750used to query the target.  The `info' command is named after the
1751operating system:
1752
1753     (gdb) info cisco
1754     List of Cisco Kernel Objects
1755     Object     Description
1756     any        Any and all objects
1757
1758   Further subcommands can be used to query about particular objects
1759known by the kernel.
1760
1761   There is currently no way to determine whether a given operating
1762system is supported other than to try setting it with `set os NAME',
1763where NAME is the name of the operating system you want to try.
1764
1765
1766File: gdb.info,  Node: Remote Debugging,  Next: Configurations,  Prev: Targets,  Up: Top
1767
1768Debugging remote programs
1769*************************
1770
1771* Menu:
1772
1773* Connecting::                  Connecting to a remote target
1774* Server::	                Using the gdbserver program
1775* NetWare::                     Using the gdbserve.nlm program
1776* Remote configuration::        Remote configuration
1777* remote stub::                 Implementing a remote stub
1778
1779
1780File: gdb.info,  Node: Connecting,  Next: Server,  Up: Remote Debugging
1781
1782Connecting to a remote target
1783=============================
1784
1785On the GDB host machine, you will need an unstripped copy of your
1786program, since GDB needs symobl and debugging information.  Start up
1787GDB as usual, using the name of the local copy of your program as the
1788first argument.
1789
1790   If you're using a serial line, you may want to give GDB the `--baud'
1791option, or use the `set remotebaud' command before the `target' command.
1792
1793   After that, use `target remote' to establish communications with the
1794target machine.  Its argument specifies how to communicate--either via
1795a devicename attached to a direct serial line, or a TCP or UDP port
1796(possibly to a terminal server which in turn has a serial line to the
1797target).  For example, to use a serial line connected to the device
1798named `/dev/ttyb':
1799
1800     target remote /dev/ttyb
1801
1802   To use a TCP connection, use an argument of the form `HOST:PORT' or
1803`tcp:HOST:PORT'.  For example, to connect to port 2828 on a terminal
1804server named `manyfarms':
1805
1806     target remote manyfarms:2828
1807
1808   If your remote target is actually running on the same machine as
1809your debugger session (e.g. a simulator of your target running on the
1810same host), you can omit the hostname.  For example, to connect to port
18111234 on your local machine:
1812
1813     target remote :1234
1814
1815Note that the colon is still required here.
1816
1817   To use a UDP connection, use an argument of the form
1818`udp:HOST:PORT'.  For example, to connect to UDP port 2828 on a
1819terminal server named `manyfarms':
1820
1821     target remote udp:manyfarms:2828
1822
1823   When using a UDP connection for remote debugging, you should keep in
1824mind that the `U' stands for "Unreliable".  UDP can silently drop
1825packets on busy or unreliable networks, which will cause havoc with
1826your debugging session.
1827
1828   Now you can use all the usual commands to examine and change data
1829and to step and continue the remote program.
1830
1831   Whenever GDB is waiting for the remote program, if you type the
1832interrupt character (often <C-C>), GDB attempts to stop the program.
1833This may or may not succeed, depending in part on the hardware and the
1834serial drivers the remote system uses.  If you type the interrupt
1835character once again, GDB displays this prompt:
1836
1837     Interrupted while waiting for the program.
1838     Give up (and stop debugging it)?  (y or n)
1839
1840   If you type `y', GDB abandons the remote debugging session.  (If you
1841decide you want to try again later, you can use `target remote' again
1842to connect once more.)  If you type `n', GDB goes back to waiting.
1843
1844`detach'
1845     When you have finished debugging the remote program, you can use
1846     the `detach' command to release it from GDB control.  Detaching
1847     from the target normally resumes its execution, but the results
1848     will depend on your particular remote stub.  After the `detach'
1849     command, GDB is free to connect to another target.
1850
1851`disconnect'
1852     The `disconnect' command behaves like `detach', except that the
1853     target is generally not resumed.  It will wait for GDB (this
1854     instance or another one) to connect and continue debugging.  After
1855     the `disconnect' command, GDB is again free to connect to another
1856     target.
1857
1858
1859File: gdb.info,  Node: Server,  Next: NetWare,  Prev: Connecting,  Up: Remote Debugging
1860
1861Using the `gdbserver' program
1862=============================
1863
1864`gdbserver' is a control program for Unix-like systems, which allows
1865you to connect your program with a remote GDB via `target remote'--but
1866without linking in the usual debugging stub.
1867
1868   `gdbserver' is not a complete replacement for the debugging stubs,
1869because it requires essentially the same operating-system facilities
1870that GDB itself does.  In fact, a system that can run `gdbserver' to
1871connect to a remote GDB could also run GDB locally!  `gdbserver' is
1872sometimes useful nevertheless, because it is a much smaller program
1873than GDB itself.  It is also easier to port than all of GDB, so you may
1874be able to get started more quickly on a new system by using
1875`gdbserver'.  Finally, if you develop code for real-time systems, you
1876may find that the tradeoffs involved in real-time operation make it
1877more convenient to do as much development work as possible on another
1878system, for example by cross-compiling.  You can use `gdbserver' to
1879make a similar choice for debugging.
1880
1881   GDB and `gdbserver' communicate via either a serial line or a TCP
1882connection, using the standard GDB remote serial protocol.
1883
1884_On the target machine,_
1885     you need to have a copy of the program you want to debug.
1886     `gdbserver' does not need your program's symbol table, so you can
1887     strip the program if necessary to save space.  GDB on the host
1888     system does all the symbol handling.
1889
1890     To use the server, you must tell it how to communicate with GDB;
1891     the name of your program; and the arguments for your program.  The
1892     usual syntax is:
1893
1894          target> gdbserver COMM PROGRAM [ ARGS ... ]
1895
1896     COMM is either a device name (to use a serial line) or a TCP
1897     hostname and portnumber.  For example, to debug Emacs with the
1898     argument `foo.txt' and communicate with GDB over the serial port
1899     `/dev/com1':
1900
1901          target> gdbserver /dev/com1 emacs foo.txt
1902
1903     `gdbserver' waits passively for the host GDB to communicate with
1904     it.
1905
1906     To use a TCP connection instead of a serial line:
1907
1908          target> gdbserver host:2345 emacs foo.txt
1909
1910     The only difference from the previous example is the first
1911     argument, specifying that you are communicating with the host GDB
1912     via TCP.  The `host:2345' argument means that `gdbserver' is to
1913     expect a TCP connection from machine `host' to local TCP port 2345.
1914     (Currently, the `host' part is ignored.)  You can choose any number
1915     you want for the port number as long as it does not conflict with
1916     any TCP ports already in use on the target system (for example,
1917     `23' is reserved for `telnet').(1)  You must use the same port
1918     number with the host GDB `target remote' command.
1919
1920     On some targets, `gdbserver' can also attach to running programs.
1921     This is accomplished via the `--attach' argument.  The syntax is:
1922
1923          target> gdbserver COMM --attach PID
1924
1925     PID is the process ID of a currently running process.  It isn't
1926     necessary to point `gdbserver' at a binary for the running process.
1927
1928     You can debug processes by name instead of process ID if your
1929     target has the `pidof' utility:
1930
1931          target> gdbserver COMM --attach `pidof PROGRAM`
1932
1933     In case more than one copy of PROGRAM is running, or PROGRAM has
1934     multiple threads, most versions of `pidof' support the `-s' option
1935     to only return the first process ID.
1936
1937_On the host machine,_
1938     connect to your target (*note Connecting to a remote target:
1939     Connecting.).  For TCP connections, you must start up `gdbserver'
1940     prior to using the `target remote' command.  Otherwise you may get
1941     an error whose text depends on the host system, but which usually
1942     looks something like `Connection refused'.  You don't need to use
1943     the `load' command in GDB when using gdbserver, since the program
1944     is already on the target.
1945
1946
1947   ---------- Footnotes ----------
1948
1949   (1) If you choose a port number that conflicts with another service,
1950`gdbserver' prints an error message and exits.
1951
1952
1953File: gdb.info,  Node: NetWare,  Next: Remote configuration,  Prev: Server,  Up: Remote Debugging
1954
1955Using the `gdbserve.nlm' program
1956================================
1957
1958`gdbserve.nlm' is a control program for NetWare systems, which allows
1959you to connect your program with a remote GDB via `target remote'.
1960
1961   GDB and `gdbserve.nlm' communicate via a serial line, using the
1962standard GDB remote serial protocol.
1963
1964_On the target machine,_
1965     you need to have a copy of the program you want to debug.
1966     `gdbserve.nlm' does not need your program's symbol table, so you
1967     can strip the program if necessary to save space.  GDB on the host
1968     system does all the symbol handling.
1969
1970     To use the server, you must tell it how to communicate with GDB;
1971     the name of your program; and the arguments for your program.  The
1972     syntax is:
1973
1974          load gdbserve [ BOARD=BOARD ] [ PORT=PORT ]
1975                        [ BAUD=BAUD ] PROGRAM [ ARGS ... ]
1976
1977     BOARD and PORT specify the serial line; BAUD specifies the baud
1978     rate used by the connection.  PORT and NODE default to 0, BAUD
1979     defaults to 9600bps.
1980
1981     For example, to debug Emacs with the argument `foo.txt'and
1982     communicate with GDB over serial port number 2 or board 1 using a
1983     19200bps connection:
1984
1985          load gdbserve BOARD=1 PORT=2 BAUD=19200 emacs foo.txt
1986
1987__
1988     On the GDB host machine, connect to your target (*note Connecting
1989     to a remote target: Connecting.).
1990
1991
1992
1993File: gdb.info,  Node: Remote configuration,  Next: remote stub,  Prev: NetWare,  Up: Remote Debugging
1994
1995Remote configuration
1996====================
1997
1998The following configuration options are available when debugging remote
1999programs:
2000
2001`set remote hardware-watchpoint-limit LIMIT'
2002`set remote hardware-breakpoint-limit LIMIT'
2003     Restrict GDB to using LIMIT remote hardware breakpoint or
2004     watchpoints.  A limit of -1, the default, is treated as unlimited.
2005
2006
2007File: gdb.info,  Node: remote stub,  Prev: Remote configuration,  Up: Remote Debugging
2008
2009Implementing a remote stub
2010==========================
2011
2012The stub files provided with GDB implement the target side of the
2013communication protocol, and the GDB side is implemented in the GDB
2014source file `remote.c'.  Normally, you can simply allow these
2015subroutines to communicate, and ignore the details.  (If you're
2016implementing your own stub file, you can still ignore the details: start
2017with one of the existing stub files.  `sparc-stub.c' is the best
2018organized, and therefore the easiest to read.)
2019
2020   To debug a program running on another machine (the debugging
2021"target" machine), you must first arrange for all the usual
2022prerequisites for the program to run by itself.  For example, for a C
2023program, you need:
2024
2025  1. A startup routine to set up the C runtime environment; these
2026     usually have a name like `crt0'.  The startup routine may be
2027     supplied by your hardware supplier, or you may have to write your
2028     own.
2029
2030  2. A C subroutine library to support your program's subroutine calls,
2031     notably managing input and output.
2032
2033  3. A way of getting your program to the other machine--for example, a
2034     download program.  These are often supplied by the hardware
2035     manufacturer, but you may have to write your own from hardware
2036     documentation.
2037
2038   The next step is to arrange for your program to use a serial port to
2039communicate with the machine where GDB is running (the "host" machine).
2040In general terms, the scheme looks like this:
2041
2042_On the host,_
2043     GDB already understands how to use this protocol; when everything
2044     else is set up, you can simply use the `target remote' command
2045     (*note Specifying a Debugging Target: Targets.).
2046
2047_On the target,_
2048     you must link with your program a few special-purpose subroutines
2049     that implement the GDB remote serial protocol.  The file
2050     containing these subroutines is called  a "debugging stub".
2051
2052     On certain remote targets, you can use an auxiliary program
2053     `gdbserver' instead of linking a stub into your program.  *Note
2054     Using the `gdbserver' program: Server, for details.
2055
2056   The debugging stub is specific to the architecture of the remote
2057machine; for example, use `sparc-stub.c' to debug programs on SPARC
2058boards.
2059
2060   These working remote stubs are distributed with GDB:
2061
2062`i386-stub.c'
2063     For Intel 386 and compatible architectures.
2064
2065`m68k-stub.c'
2066     For Motorola 680x0 architectures.
2067
2068`sh-stub.c'
2069     For Renesas SH architectures.
2070
2071`sparc-stub.c'
2072     For SPARC architectures.
2073
2074`sparcl-stub.c'
2075     For Fujitsu SPARCLITE architectures.
2076
2077
2078   The `README' file in the GDB distribution may list other recently
2079added stubs.
2080
2081* Menu:
2082
2083* Stub Contents::       What the stub can do for you
2084* Bootstrapping::       What you must do for the stub
2085* Debug Session::       Putting it all together
2086
2087
2088File: gdb.info,  Node: Stub Contents,  Next: Bootstrapping,  Up: remote stub
2089
2090What the stub can do for you
2091----------------------------
2092
2093The debugging stub for your architecture supplies these three
2094subroutines:
2095
2096`set_debug_traps'
2097     This routine arranges for `handle_exception' to run when your
2098     program stops.  You must call this subroutine explicitly near the
2099     beginning of your program.
2100
2101`handle_exception'
2102     This is the central workhorse, but your program never calls it
2103     explicitly--the setup code arranges for `handle_exception' to run
2104     when a trap is triggered.
2105
2106     `handle_exception' takes control when your program stops during
2107     execution (for example, on a breakpoint), and mediates
2108     communications with GDB on the host machine.  This is where the
2109     communications protocol is implemented; `handle_exception' acts as
2110     the GDB representative on the target machine.  It begins by
2111     sending summary information on the state of your program, then
2112     continues to execute, retrieving and transmitting any information
2113     GDB needs, until you execute a GDB command that makes your program
2114     resume; at that point, `handle_exception' returns control to your
2115     own code on the target machine.
2116
2117`breakpoint'
2118     Use this auxiliary subroutine to make your program contain a
2119     breakpoint.  Depending on the particular situation, this may be
2120     the only way for GDB to get control.  For instance, if your target
2121     machine has some sort of interrupt button, you won't need to call
2122     this; pressing the interrupt button transfers control to
2123     `handle_exception'--in effect, to GDB.  On some machines, simply
2124     receiving characters on the serial port may also trigger a trap;
2125     again, in that situation, you don't need to call `breakpoint' from
2126     your own program--simply running `target remote' from the host GDB
2127     session gets control.
2128
2129     Call `breakpoint' if none of these is true, or if you simply want
2130     to make certain your program stops at a predetermined point for the
2131     start of your debugging session.
2132
2133
2134File: gdb.info,  Node: Bootstrapping,  Next: Debug Session,  Prev: Stub Contents,  Up: remote stub
2135
2136What you must do for the stub
2137-----------------------------
2138
2139The debugging stubs that come with GDB are set up for a particular chip
2140architecture, but they have no information about the rest of your
2141debugging target machine.
2142
2143   First of all you need to tell the stub how to communicate with the
2144serial port.
2145
2146`int getDebugChar()'
2147     Write this subroutine to read a single character from the serial
2148     port.  It may be identical to `getchar' for your target system; a
2149     different name is used to allow you to distinguish the two if you
2150     wish.
2151
2152`void putDebugChar(int)'
2153     Write this subroutine to write a single character to the serial
2154     port.  It may be identical to `putchar' for your target system; a
2155     different name is used to allow you to distinguish the two if you
2156     wish.
2157
2158   If you want GDB to be able to stop your program while it is running,
2159you need to use an interrupt-driven serial driver, and arrange for it
2160to stop when it receives a `^C' (`\003', the control-C character).
2161That is the character which GDB uses to tell the remote system to stop.
2162
2163   Getting the debugging target to return the proper status to GDB
2164probably requires changes to the standard stub; one quick and dirty way
2165is to just execute a breakpoint instruction (the "dirty" part is that
2166GDB reports a `SIGTRAP' instead of a `SIGINT').
2167
2168   Other routines you need to supply are:
2169
2170`void exceptionHandler (int EXCEPTION_NUMBER, void *EXCEPTION_ADDRESS)'
2171     Write this function to install EXCEPTION_ADDRESS in the exception
2172     handling tables.  You need to do this because the stub does not
2173     have any way of knowing what the exception handling tables on your
2174     target system are like (for example, the processor's table might
2175     be in ROM, containing entries which point to a table in RAM).
2176     EXCEPTION_NUMBER is the exception number which should be changed;
2177     its meaning is architecture-dependent (for example, different
2178     numbers might represent divide by zero, misaligned access, etc).
2179     When this exception occurs, control should be transferred directly
2180     to EXCEPTION_ADDRESS, and the processor state (stack, registers,
2181     and so on) should be just as it is when a processor exception
2182     occurs.  So if you want to use a jump instruction to reach
2183     EXCEPTION_ADDRESS, it should be a simple jump, not a jump to
2184     subroutine.
2185
2186     For the 386, EXCEPTION_ADDRESS should be installed as an interrupt
2187     gate so that interrupts are masked while the handler runs.  The
2188     gate should be at privilege level 0 (the most privileged level).
2189     The SPARC and 68k stubs are able to mask interrupts themselves
2190     without help from `exceptionHandler'.
2191
2192`void flush_i_cache()'
2193     On SPARC and SPARCLITE only, write this subroutine to flush the
2194     instruction cache, if any, on your target machine.  If there is no
2195     instruction cache, this subroutine may be a no-op.
2196
2197     On target machines that have instruction caches, GDB requires this
2198     function to make certain that the state of your program is stable.
2199
2200You must also make sure this library routine is available:
2201
2202`void *memset(void *, int, int)'
2203     This is the standard library function `memset' that sets an area of
2204     memory to a known value.  If you have one of the free versions of
2205     `libc.a', `memset' can be found there; otherwise, you must either
2206     obtain it from your hardware manufacturer, or write your own.
2207
2208   If you do not use the GNU C compiler, you may need other standard
2209library subroutines as well; this varies from one stub to another, but
2210in general the stubs are likely to use any of the common library
2211subroutines which `gcc' generates as inline code.
2212
2213
2214File: gdb.info,  Node: Debug Session,  Prev: Bootstrapping,  Up: remote stub
2215
2216Putting it all together
2217-----------------------
2218
2219In summary, when your program is ready to debug, you must follow these
2220steps.
2221
2222  1. Make sure you have defined the supporting low-level routines
2223     (*note What you must do for the stub: Bootstrapping.):
2224          `getDebugChar', `putDebugChar',
2225          `flush_i_cache', `memset', `exceptionHandler'.
2226
2227  2. Insert these lines near the top of your program:
2228
2229          set_debug_traps();
2230          breakpoint();
2231
2232  3. For the 680x0 stub only, you need to provide a variable called
2233     `exceptionHook'.  Normally you just use:
2234
2235          void (*exceptionHook)() = 0;
2236
2237     but if before calling `set_debug_traps', you set it to point to a
2238     function in your program, that function is called when `GDB'
2239     continues after stopping on a trap (for example, bus error).  The
2240     function indicated by `exceptionHook' is called with one
2241     parameter: an `int' which is the exception number.
2242
2243  4. Compile and link together: your program, the GDB debugging stub for
2244     your target architecture, and the supporting subroutines.
2245
2246  5. Make sure you have a serial connection between your target machine
2247     and the GDB host, and identify the serial port on the host.
2248
2249  6. Download your program to your target machine (or get it there by
2250     whatever means the manufacturer provides), and start it.
2251
2252  7. Start GDB on the host, and connect to the target (*note Connecting
2253     to a remote target: Connecting.).
2254
2255
2256
2257File: gdb.info,  Node: Configurations,  Next: Controlling GDB,  Prev: Remote Debugging,  Up: Top
2258
2259Configuration-Specific Information
2260**********************************
2261
2262While nearly all GDB commands are available for all native and cross
2263versions of the debugger, there are some exceptions.  This chapter
2264describes things that are only available in certain configurations.
2265
2266   There are three major categories of configurations: native
2267configurations, where the host and target are the same, embedded
2268operating system configurations, which are usually the same for several
2269different processor architectures, and bare embedded processors, which
2270are quite different from each other.
2271
2272* Menu:
2273
2274* Native::
2275* Embedded OS::
2276* Embedded Processors::
2277* Architectures::
2278
2279
2280File: gdb.info,  Node: Native,  Next: Embedded OS,  Up: Configurations
2281
2282Native
2283======
2284
2285This section describes details specific to particular native
2286configurations.
2287
2288* Menu:
2289
2290* HP-UX::                       HP-UX
2291* BSD libkvm Interface::	Debugging BSD kernel memory images
2292* SVR4 Process Information::    SVR4 process information
2293* DJGPP Native::                Features specific to the DJGPP port
2294* Cygwin Native::		Features specific to the Cygwin port
2295
2296
2297File: gdb.info,  Node: HP-UX,  Next: BSD libkvm Interface,  Up: Native
2298
2299HP-UX
2300-----
2301
2302On HP-UX systems, if you refer to a function or variable name that
2303begins with a dollar sign, GDB searches for a user or system name
2304first, before it searches for a convenience variable.
2305
2306
2307File: gdb.info,  Node: BSD libkvm Interface,  Next: SVR4 Process Information,  Prev: HP-UX,  Up: Native
2308
2309BSD libkvm Interface
2310--------------------
2311
2312BSD-derived systems (FreeBSD/NetBSD/OpenBSD) have a kernel memory
2313interface that provides a uniform interface for accessing kernel virtual
2314memory images, including live systems and crash dumps.  GDB uses this
2315interface to allow you to debug live kernels and kernel crash dumps on
2316many native BSD configurations.  This is implemented as a special `kvm'
2317debugging target.  For debugging a live system, load the currently
2318running kernel into GDB and connect to the `kvm' target:
2319
2320     (gdb) target kvm
2321
2322   For debugging crash dumps, provide the file name of the crash dump
2323as an argument:
2324
2325     (gdb) target kvm /var/crash/bsd.0
2326
2327   Once connected to the `kvm' target, the following commands are
2328available:
2329
2330`kvm pcb'
2331     Set current context from pcb address.
2332
2333`kvm proc'
2334     Set current context from proc address.  This command isn't
2335     available on modern FreeBSD systems.
2336
2337
2338File: gdb.info,  Node: SVR4 Process Information,  Next: DJGPP Native,  Prev: BSD libkvm Interface,  Up: Native
2339
2340SVR4 process information
2341------------------------
2342
2343Many versions of SVR4 provide a facility called `/proc' that can be
2344used to examine the image of a running process using file-system
2345subroutines.  If GDB is configured for an operating system with this
2346facility, the command `info proc' is available to report on several
2347kinds of information about the process running your program.  `info
2348proc' works only on SVR4 systems that include the `procfs' code.  This
2349includes OSF/1 (Digital Unix), Solaris, Irix, and Unixware, but not
2350HP-UX or GNU/Linux, for example.
2351
2352`info proc'
2353     Summarize available information about the process.
2354
2355`info proc mappings'
2356     Report on the address ranges accessible in the program, with
2357     information on whether your program may read, write, or execute
2358     each range.
2359
2360
2361File: gdb.info,  Node: DJGPP Native,  Next: Cygwin Native,  Prev: SVR4 Process Information,  Up: Native
2362
2363Features for Debugging DJGPP Programs
2364-------------------------------------
2365
2366DJGPP is the port of GNU development tools to MS-DOS and MS-Windows.
2367DJGPP programs are 32-bit protected-mode programs that use the "DPMI"
2368(DOS Protected-Mode Interface) API to run on top of real-mode DOS
2369systems and their emulations.
2370
2371   GDB supports native debugging of DJGPP programs, and defines a few
2372commands specific to the DJGPP port.  This subsection describes those
2373commands.
2374
2375`info dos'
2376     This is a prefix of DJGPP-specific commands which print
2377     information about the target system and important OS structures.
2378
2379`info dos sysinfo'
2380     This command displays assorted information about the underlying
2381     platform: the CPU type and features, the OS version and flavor, the
2382     DPMI version, and the available conventional and DPMI memory.
2383
2384`info dos gdt'
2385`info dos ldt'
2386`info dos idt'
2387     These 3 commands display entries from, respectively, Global, Local,
2388     and Interrupt Descriptor Tables (GDT, LDT, and IDT).  The
2389     descriptor tables are data structures which store a descriptor for
2390     each segment that is currently in use.  The segment's selector is
2391     an index into a descriptor table; the table entry for that index
2392     holds the descriptor's base address and limit, and its attributes
2393     and access rights.
2394
2395     A typical DJGPP program uses 3 segments: a code segment, a data
2396     segment (used for both data and the stack), and a DOS segment
2397     (which allows access to DOS/BIOS data structures and absolute
2398     addresses in conventional memory).  However, the DPMI host will
2399     usually define additional segments in order to support the DPMI
2400     environment.
2401
2402     These commands allow to display entries from the descriptor tables.
2403     Without an argument, all entries from the specified table are
2404     displayed.  An argument, which should be an integer expression,
2405     means display a single entry whose index is given by the argument.
2406     For example, here's a convenient way to display information about
2407     the debugged program's data segment:
2408
2409     `(gdb) info dos ldt $ds'
2410     `0x13f: base=0x11970000 limit=0x0009ffff 32-Bit Data (Read/Write, Exp-up)'
2411
2412
2413     This comes in handy when you want to see whether a pointer is
2414     outside the data segment's limit (i.e. "garbled").
2415
2416`info dos pde'
2417`info dos pte'
2418     These two commands display entries from, respectively, the Page
2419     Directory and the Page Tables.  Page Directories and Page Tables
2420     are data structures which control how virtual memory addresses are
2421     mapped into physical addresses.  A Page Table includes an entry
2422     for every page of memory that is mapped into the program's address
2423     space; there may be several Page Tables, each one holding up to
2424     4096 entries.  A Page Directory has up to 4096 entries, one each
2425     for every Page Table that is currently in use.
2426
2427     Without an argument, `info dos pde' displays the entire Page
2428     Directory, and `info dos pte' displays all the entries in all of
2429     the Page Tables.  An argument, an integer expression, given to the
2430     `info dos pde' command means display only that entry from the Page
2431     Directory table.  An argument given to the `info dos pte' command
2432     means display entries from a single Page Table, the one pointed to
2433     by the specified entry in the Page Directory.
2434
2435     These commands are useful when your program uses "DMA" (Direct
2436     Memory Access), which needs physical addresses to program the DMA
2437     controller.
2438
2439     These commands are supported only with some DPMI servers.
2440
2441`info dos address-pte ADDR'
2442     This command displays the Page Table entry for a specified linear
2443     address.  The argument linear address ADDR should already have the
2444     appropriate segment's base address added to it, because this
2445     command accepts addresses which may belong to _any_ segment.  For
2446     example, here's how to display the Page Table entry for the page
2447     where the variable `i' is stored:
2448
2449     `(gdb) info dos address-pte __djgpp_base_address + (char *)&i'
2450     `Page Table entry for address 0x11a00d30:'
2451     `Base=0x02698000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0xd30'
2452
2453
2454     This says that `i' is stored at offset `0xd30' from the page whose
2455     physical base address is `0x02698000', and prints all the
2456     attributes of that page.
2457
2458     Note that you must cast the addresses of variables to a `char *',
2459     since otherwise the value of `__djgpp_base_address', the base
2460     address of all variables and functions in a DJGPP program, will be
2461     added using the rules of C pointer arithmetics: if `i' is declared
2462     an `int', GDB will add 4 times the value of `__djgpp_base_address'
2463     to the address of `i'.
2464
2465     Here's another example, it displays the Page Table entry for the
2466     transfer buffer:
2467
2468     `(gdb) info dos address-pte *((unsigned *)&_go32_info_block + 3)'
2469     `Page Table entry for address 0x29110:'
2470     `Base=0x00029000 Dirty Acc. Not-Cached Write-Back Usr Read-Write +0x110'
2471
2472
2473     (The `+ 3' offset is because the transfer buffer's address is the
2474     3rd member of the `_go32_info_block' structure.)  The output of
2475     this command clearly shows that addresses in conventional memory
2476     are mapped 1:1, i.e. the physical and linear addresses are
2477     identical.
2478
2479     This command is supported only with some DPMI servers.
2480
2481
2482File: gdb.info,  Node: Cygwin Native,  Prev: DJGPP Native,  Up: Native
2483
2484Features for Debugging MS Windows PE executables
2485------------------------------------------------
2486
2487GDB supports native debugging of MS Windows programs, including DLLs
2488with and without symbolic debugging information. There are various
2489additional Cygwin-specific commands, described in this subsection.  The
2490subsubsection *note Non-debug DLL symbols:: describes working with DLLs
2491that have no debugging symbols.
2492
2493`info w32'
2494     This is a prefix of MS Windows specific commands which print
2495     information about the target system and important OS structures.
2496
2497`info w32 selector'
2498     This command displays information returned by the Win32 API
2499     `GetThreadSelectorEntry' function.  It takes an optional argument
2500     that is evaluated to a long value to give the information about
2501     this given selector.  Without argument, this command displays
2502     information about the the six segment registers.
2503
2504`info dll'
2505     This is a Cygwin specific alias of info shared.
2506
2507`dll-symbols'
2508     This command loads symbols from a dll similarly to add-sym command
2509     but without the need to specify a base address.
2510
2511`set new-console MODE'
2512     If MODE is `on' the debuggee will be started in a new console on
2513     next start.  If MODE is `off'i, the debuggee will be started in
2514     the same console as the debugger.
2515
2516`show new-console'
2517     Displays whether a new console is used when the debuggee is
2518     started.
2519
2520`set new-group MODE'
2521     This boolean value controls whether the debuggee should start a
2522     new group or stay in the same group as the debugger.  This affects
2523     the way the Windows OS handles Ctrl-C.
2524
2525`show new-group'
2526     Displays current value of new-group boolean.
2527
2528`set debugevents'
2529     This boolean value adds debug output concerning events seen by the
2530     debugger.
2531
2532`set debugexec'
2533     This boolean value adds debug output concerning execute events
2534     seen by the debugger.
2535
2536`set debugexceptions'
2537     This boolean value adds debug ouptut concerning exception events
2538     seen by the debugger.
2539
2540`set debugmemory'
2541     This boolean value adds debug ouptut concerning memory events seen
2542     by the debugger.
2543
2544`set shell'
2545     This boolean values specifies whether the debuggee is called via a
2546     shell or directly (default value is on).
2547
2548`show shell'
2549     Displays if the debuggee will be started with a shell.
2550
2551
2552* Menu:
2553
2554* Non-debug DLL symbols::  Support for DLLs without debugging symbols
2555
2556
2557File: gdb.info,  Node: Non-debug DLL symbols,  Up: Cygwin Native
2558
2559Support for DLLs without debugging symbols
2560..........................................
2561
2562Very often on windows, some of the DLLs that your program relies on do
2563not include symbolic debugging information (for example,
2564`kernel32.dll'). When GDB doesn't recognize any debugging symbols in a
2565DLL, it relies on the minimal amount of symbolic information contained
2566in the DLL's export table. This subsubsection describes working with
2567such symbols, known internally to GDB as "minimal symbols".
2568
2569   Note that before the debugged program has started execution, no DLLs
2570will have been loaded. The easiest way around this problem is simply to
2571start the program -- either by setting a breakpoint or letting the
2572program run once to completion. It is also possible to force GDB to
2573load a particular DLL before starting the executable -- see the shared
2574library information in *note Files:: or the `dll-symbols' command in
2575*note Cygwin Native::. Currently, explicitly loading symbols from a DLL
2576with no debugging information will cause the symbol names to be
2577duplicated in GDB's lookup table, which may adversely affect symbol
2578lookup performance.
2579
2580DLL name prefixes
2581.................
2582
2583In keeping with the naming conventions used by the Microsoft debugging
2584tools, DLL export symbols are made available with a prefix based on the
2585DLL name, for instance `KERNEL32!CreateFileA'.  The plain name is also
2586entered into the symbol table, so `CreateFileA' is often sufficient. In
2587some cases there will be name clashes within a program (particularly if
2588the executable itself includes full debugging symbols) necessitating
2589the use of the fully qualified name when referring to the contents of
2590the DLL. Use single-quotes around the name to avoid the exclamation
2591mark ("!")  being interpreted as a language operator.
2592
2593   Note that the internal name of the DLL may be all upper-case, even
2594though the file name of the DLL is lower-case, or vice-versa. Since
2595symbols within GDB are _case-sensitive_ this may cause some confusion.
2596If in doubt, try the `info functions' and `info variables' commands or
2597even `maint print msymbols' (see *note Symbols::). Here's an example:
2598
2599     (gdb) info function CreateFileA
2600     All functions matching regular expression "CreateFileA":
2601
2602     Non-debugging symbols:
2603     0x77e885f4  CreateFileA
2604     0x77e885f4  KERNEL32!CreateFileA
2605
2606     (gdb) info function !
2607     All functions matching regular expression "!":
2608
2609     Non-debugging symbols:
2610     0x6100114c  cygwin1!__assert
2611     0x61004034  cygwin1!_dll_crt0@0
2612     0x61004240  cygwin1!dll_crt0(per_process *)
2613     [etc...]
2614
2615Working with minimal symbols
2616............................
2617
2618Symbols extracted from a DLL's export table do not contain very much
2619type information. All that GDB can do is guess whether a symbol refers
2620to a function or variable depending on the linker section that contains
2621the symbol. Also note that the actual contents of the memory contained
2622in a DLL are not available unless the program is running. This means
2623that you cannot examine the contents of a variable or disassemble a
2624function within a DLL without a running program.
2625
2626   Variables are generally treated as pointers and dereferenced
2627automatically. For this reason, it is often necessary to prefix a
2628variable name with the address-of operator ("&") and provide explicit
2629type information in the command. Here's an example of the type of
2630problem:
2631
2632     (gdb) print 'cygwin1!__argv'
2633     $1 = 268572168
2634
2635     (gdb) x 'cygwin1!__argv'
2636     0x10021610:      "\230y\""
2637
2638   And two possible solutions:
2639
2640     (gdb) print ((char **)'cygwin1!__argv')[0]
2641     $2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
2642
2643     (gdb) x/2x &'cygwin1!__argv'
2644     0x610c0aa8 <cygwin1!__argv>:    0x10021608      0x00000000
2645     (gdb) x/x 0x10021608
2646     0x10021608:     0x0022fd98
2647     (gdb) x/s 0x0022fd98
2648     0x22fd98:        "/cygdrive/c/mydirectory/myprogram"
2649
2650   Setting a break point within a DLL is possible even before the
2651program starts execution. However, under these circumstances, GDB can't
2652examine the initial instructions of the function in order to skip the
2653function's frame set-up code. You can work around this by using "*&" to
2654set the breakpoint at a raw memory address:
2655
2656     (gdb) break *&'python22!PyOS_Readline'
2657     Breakpoint 1 at 0x1e04eff0
2658
2659   The author of these extensions is not entirely convinced that
2660setting a break point within a shared DLL like `kernel32.dll' is
2661completely safe.
2662
2663
2664File: gdb.info,  Node: Embedded OS,  Next: Embedded Processors,  Prev: Native,  Up: Configurations
2665
2666Embedded Operating Systems
2667==========================
2668
2669This section describes configurations involving the debugging of
2670embedded operating systems that are available for several different
2671architectures.
2672
2673* Menu:
2674
2675* VxWorks::                     Using GDB with VxWorks
2676
2677   GDB includes the ability to debug programs running on various
2678real-time operating systems.
2679
2680
2681File: gdb.info,  Node: VxWorks,  Up: Embedded OS
2682
2683Using GDB with VxWorks
2684----------------------
2685
2686`target vxworks MACHINENAME'
2687     A VxWorks system, attached via TCP/IP.  The argument MACHINENAME
2688     is the target system's machine name or IP address.
2689
2690
2691   On VxWorks, `load' links FILENAME dynamically on the current target
2692system as well as adding its symbols in GDB.
2693
2694   GDB enables developers to spawn and debug tasks running on networked
2695VxWorks targets from a Unix host.  Already-running tasks spawned from
2696the VxWorks shell can also be debugged.  GDB uses code that runs on
2697both the Unix host and on the VxWorks target.  The program `gdb' is
2698installed and executed on the Unix host.  (It may be installed with the
2699name `vxgdb', to distinguish it from a GDB for debugging programs on
2700the host itself.)
2701
2702`VxWorks-timeout ARGS'
2703     All VxWorks-based targets now support the option `vxworks-timeout'.
2704     This option is set by the user, and  ARGS represents the number of
2705     seconds GDB waits for responses to rpc's.  You might use this if
2706     your VxWorks target is a slow software simulator or is on the far
2707     side of a thin network line.
2708
2709   The following information on connecting to VxWorks was current when
2710this manual was produced; newer releases of VxWorks may use revised
2711procedures.
2712
2713   To use GDB with VxWorks, you must rebuild your VxWorks kernel to
2714include the remote debugging interface routines in the VxWorks library
2715`rdb.a'.  To do this, define `INCLUDE_RDB' in the VxWorks configuration
2716file `configAll.h' and rebuild your VxWorks kernel.  The resulting
2717kernel contains `rdb.a', and spawns the source debugging task
2718`tRdbTask' when VxWorks is booted.  For more information on configuring
2719and remaking VxWorks, see the manufacturer's manual.
2720
2721   Once you have included `rdb.a' in your VxWorks system image and set
2722your Unix execution search path to find GDB, you are ready to run GDB.
2723From your Unix host, run `gdb' (or `vxgdb', depending on your
2724installation).
2725
2726   GDB comes up showing the prompt:
2727
2728     (vxgdb)
2729
2730* Menu:
2731
2732* VxWorks Connection::          Connecting to VxWorks
2733* VxWorks Download::            VxWorks download
2734* VxWorks Attach::              Running tasks
2735
2736
2737File: gdb.info,  Node: VxWorks Connection,  Next: VxWorks Download,  Up: VxWorks
2738
2739Connecting to VxWorks
2740.....................
2741
2742The GDB command `target' lets you connect to a VxWorks target on the
2743network.  To connect to a target whose host name is "`tt'", type:
2744
2745     (vxgdb) target vxworks tt
2746
2747   GDB displays messages like these:
2748
2749     Attaching remote machine across net...
2750     Connected to tt.
2751
2752   GDB then attempts to read the symbol tables of any object modules
2753loaded into the VxWorks target since it was last booted.  GDB locates
2754these files by searching the directories listed in the command search
2755path (*note Your program's environment: Environment.); if it fails to
2756find an object file, it displays a message such as:
2757
2758     prog.o: No such file or directory.
2759
2760   When this happens, add the appropriate directory to the search path
2761with the GDB command `path', and execute the `target' command again.
2762
2763
2764File: gdb.info,  Node: VxWorks Download,  Next: VxWorks Attach,  Prev: VxWorks Connection,  Up: VxWorks
2765
2766VxWorks download
2767................
2768
2769If you have connected to the VxWorks target and you want to debug an
2770object that has not yet been loaded, you can use the GDB `load' command
2771to download a file from Unix to VxWorks incrementally.  The object file
2772given as an argument to the `load' command is actually opened twice:
2773first by the VxWorks target in order to download the code, then by GDB
2774in order to read the symbol table.  This can lead to problems if the
2775current working directories on the two systems differ.  If both systems
2776have NFS mounted the same filesystems, you can avoid these problems by
2777using absolute paths.  Otherwise, it is simplest to set the working
2778directory on both systems to the directory in which the object file
2779resides, and then to reference the file by its name, without any path.
2780For instance, a program `prog.o' may reside in `VXPATH/vw/demo/rdb' in
2781VxWorks and in `HOSTPATH/vw/demo/rdb' on the host.  To load this
2782program, type this on VxWorks:
2783
2784     -> cd "VXPATH/vw/demo/rdb"
2785
2786Then, in GDB, type:
2787
2788     (vxgdb) cd HOSTPATH/vw/demo/rdb
2789     (vxgdb) load prog.o
2790
2791   GDB displays a response similar to this:
2792
2793     Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
2794
2795   You can also use the `load' command to reload an object module after
2796editing and recompiling the corresponding source file.  Note that this
2797makes GDB delete all currently-defined breakpoints, auto-displays, and
2798convenience variables, and to clear the value history.  (This is
2799necessary in order to preserve the integrity of debugger's data
2800structures that reference the target system's symbol table.)
2801
2802
2803File: gdb.info,  Node: VxWorks Attach,  Prev: VxWorks Download,  Up: VxWorks
2804
2805Running tasks
2806.............
2807
2808You can also attach to an existing task using the `attach' command as
2809follows:
2810
2811     (vxgdb) attach TASK
2812
2813where TASK is the VxWorks hexadecimal task ID.  The task can be running
2814or suspended when you attach to it.  Running tasks are suspended at the
2815time of attachment.
2816
2817
2818File: gdb.info,  Node: Embedded Processors,  Next: Architectures,  Prev: Embedded OS,  Up: Configurations
2819
2820Embedded Processors
2821===================
2822
2823This section goes into details specific to particular embedded
2824configurations.
2825
2826* Menu:
2827
2828* ARM::                         ARM
2829* H8/300::                      Renesas H8/300
2830* H8/500::                      Renesas H8/500
2831* M32R/D::                      Renesas M32R/D
2832* M68K::                        Motorola M68K
2833* MIPS Embedded::               MIPS Embedded
2834* OpenRISC 1000::               OpenRisc 1000
2835* PA::                          HP PA Embedded
2836* PowerPC:                      PowerPC
2837* SH::                          Renesas SH
2838* Sparclet::                    Tsqware Sparclet
2839* Sparclite::                   Fujitsu Sparclite
2840* ST2000::                      Tandem ST2000
2841* Z8000::                       Zilog Z8000
2842
2843
2844File: gdb.info,  Node: ARM,  Next: H8/300,  Up: Embedded Processors
2845
2846ARM
2847---
2848
2849`target rdi DEV'
2850     ARM Angel monitor, via RDI library interface to ADP protocol.  You
2851     may use this target to communicate with both boards running the
2852     Angel monitor, or with the EmbeddedICE JTAG debug device.
2853
2854`target rdp DEV'
2855     ARM Demon monitor.
2856
2857
2858
2859File: gdb.info,  Node: H8/300,  Next: H8/500,  Prev: ARM,  Up: Embedded Processors
2860
2861Renesas H8/300
2862--------------
2863
2864`target hms DEV'
2865     A Renesas SH, H8/300, or H8/500 board, attached via serial line to
2866     your host.  Use special commands `device' and `speed' to control
2867     the serial line and the communications speed used.
2868
2869`target e7000 DEV'
2870     E7000 emulator for Renesas H8 and SH.
2871
2872`target sh3 DEV'
2873`target sh3e DEV'
2874     Renesas SH-3 and SH-3E target systems.
2875
2876
2877   When you select remote debugging to a Renesas SH, H8/300, or H8/500
2878board, the `load' command downloads your program to the Renesas board
2879and also opens it as the current executable target for GDB on your host
2880(like the `file' command).
2881
2882   GDB needs to know these things to talk to your Renesas SH, H8/300,
2883or H8/500:
2884
2885  1. that you want to use `target hms', the remote debugging interface
2886     for Renesas microprocessors, or `target e7000', the in-circuit
2887     emulator for the Renesas SH and the Renesas 300H.  (`target hms' is
2888     the default when GDB is configured specifically for the Renesas SH,
2889     H8/300, or H8/500.)
2890
2891  2. what serial device connects your host to your Renesas board (the
2892     first serial device available on your host is the default).
2893
2894  3. what speed to use over the serial device.
2895
2896* Menu:
2897
2898* Renesas Boards::      Connecting to Renesas boards.
2899* Renesas ICE::         Using the E7000 In-Circuit Emulator.
2900* Renesas Special::     Special GDB commands for Renesas micros.
2901
2902
2903File: gdb.info,  Node: Renesas Boards,  Next: Renesas ICE,  Up: H8/300
2904
2905Connecting to Renesas boards
2906............................
2907
2908Use the special `GDB' command `device PORT' if you need to explicitly
2909set the serial device.  The default PORT is the first available port on
2910your host.  This is only necessary on Unix hosts, where it is typically
2911something like `/dev/ttya'.
2912
2913   `GDB' has another special command to set the communications speed:
2914`speed BPS'.  This command also is only used from Unix hosts; on DOS
2915hosts, set the line speed as usual from outside GDB with the DOS `mode'
2916command (for instance, `mode com2:9600,n,8,1,p' for a 9600bps
2917connection).
2918
2919   The `device' and `speed' commands are available only when you use a
2920Unix host to debug your Renesas microprocessor programs.  If you use a
2921DOS host, GDB depends on an auxiliary terminate-and-stay-resident
2922program called `asynctsr' to communicate with the development board
2923through a PC serial port.  You must also use the DOS `mode' command to
2924set up the serial port on the DOS side.
2925
2926   The following sample session illustrates the steps needed to start a
2927program under GDB control on an H8/300.  The example uses a sample
2928H8/300 program called `t.x'.  The procedure is the same for the Renesas
2929SH and the H8/500.
2930
2931   First hook up your development board.  In this example, we use a
2932board attached to serial port `COM2'; if you use a different serial
2933port, substitute its name in the argument of the `mode' command.  When
2934you call `asynctsr', the auxiliary comms program used by the debugger,
2935you give it just the numeric part of the serial port's name; for
2936example, `asyncstr 2' below runs `asyncstr' on `COM2'.
2937
2938     C:\H8300\TEST> asynctsr 2
2939     C:\H8300\TEST> mode com2:9600,n,8,1,p
2940
2941     Resident portion of MODE loaded
2942
2943     COM2: 9600, n, 8, 1, p
2944
2945     _Warning:_ We have noticed a bug in PC-NFS that conflicts with
2946     `asynctsr'.  If you also run PC-NFS on your DOS host, you may need
2947     to disable it, or even boot without it, to use `asynctsr' to
2948     control your development board.
2949
2950   Now that serial communications are set up, and the development board
2951is connected, you can start up GDB.  Call `gdb' with the name of your
2952program as the argument.  `GDB' prompts you, as usual, with the prompt
2953`(gdb)'.  Use two special commands to begin your debugging session:
2954`target hms' to specify cross-debugging to the Renesas board, and the
2955`load' command to download your program to the board.  `load' displays
2956the names of the program's sections, and a `*' for each 2K of data
2957downloaded.  (If you want to refresh GDB data on symbols or on the
2958executable file without downloading, use the GDB commands `file' or
2959`symbol-file'.  These commands, and `load' itself, are described in
2960*Note Commands to specify files: Files.)
2961
2962     (eg-C:\H8300\TEST) gdb t.x
2963     GDB is free software and you are welcome to distribute copies
2964      of it under certain conditions; type "show copying" to see
2965      the conditions.
2966     There is absolutely no warranty for GDB; type "show warranty"
2967     for details.
2968     GDB 6.2.1, Copyright 1992 Free Software Foundation, Inc...
2969     (gdb) target hms
2970     Connected to remote H8/300 HMS system.
2971     (gdb) load t.x
2972     .text   : 0x8000 .. 0xabde ***********
2973     .data   : 0xabde .. 0xad30 *
2974     .stack  : 0xf000 .. 0xf014 *
2975
2976   At this point, you're ready to run or debug your program.  From here
2977on, you can use all the usual GDB commands.  The `break' command sets
2978breakpoints; the `run' command starts your program; `print' or `x'
2979display data; the `continue' command resumes execution after stopping
2980at a breakpoint.  You can use the `help' command at any time to find
2981out more about GDB commands.
2982
2983   Remember, however, that _operating system_ facilities aren't
2984available on your development board; for example, if your program hangs,
2985you can't send an interrupt--but you can press the RESET switch!
2986
2987   Use the RESET button on the development board
2988   * to interrupt your program (don't use `ctl-C' on the DOS host--it
2989     has no way to pass an interrupt signal to the development board);
2990     and
2991
2992   * to return to the GDB command prompt after your program finishes
2993     normally.  The communications protocol provides no other way for
2994     GDB to detect program completion.
2995
2996   In either case, GDB sees the effect of a RESET on the development
2997board as a "normal exit" of your program.
2998
2999
3000File: gdb.info,  Node: Renesas ICE,  Next: Renesas Special,  Prev: Renesas Boards,  Up: H8/300
3001
3002Using the E7000 in-circuit emulator
3003...................................
3004
3005You can use the E7000 in-circuit emulator to develop code for either the
3006Renesas SH or the H8/300H.  Use one of these forms of the `target
3007e7000' command to connect GDB to your E7000:
3008
3009`target e7000 PORT SPEED'
3010     Use this form if your E7000 is connected to a serial port.  The
3011     PORT argument identifies what serial port to use (for example,
3012     `com2').  The third argument is the line speed in bits per second
3013     (for example, `9600').
3014
3015`target e7000 HOSTNAME'
3016     If your E7000 is installed as a host on a TCP/IP network, you can
3017     just specify its hostname; GDB uses `telnet' to connect.
3018
3019
3020File: gdb.info,  Node: Renesas Special,  Prev: Renesas ICE,  Up: H8/300
3021
3022Special GDB commands for Renesas micros
3023.......................................
3024
3025Some GDB commands are available only for the H8/300:
3026
3027`set machine h8300'
3028`set machine h8300h'
3029     Condition GDB for one of the two variants of the H8/300
3030     architecture with `set machine'.  You can use `show machine' to
3031     check which variant is currently in effect.
3032
3033
3034
3035File: gdb.info,  Node: H8/500,  Next: M32R/D,  Prev: H8/300,  Up: Embedded Processors
3036
3037H8/500
3038------
3039
3040`set memory MOD'
3041`show memory'
3042     Specify which H8/500 memory model (MOD) you are using with `set
3043     memory'; check which memory model is in effect with `show memory'.
3044     The accepted values for MOD are `small', `big', `medium', and
3045     `compact'.
3046
3047
3048
3049File: gdb.info,  Node: M32R/D,  Next: M68K,  Prev: H8/500,  Up: Embedded Processors
3050
3051Renesas M32R/D
3052--------------
3053
3054`target m32r DEV'
3055     Renesas M32R/D ROM monitor.
3056
3057`target m32rsdi DEV'
3058     Renesas M32R SDI server, connected via parallel port to the board.
3059
3060
3061
3062File: gdb.info,  Node: M68K,  Next: MIPS Embedded,  Prev: M32R/D,  Up: Embedded Processors
3063
3064M68k
3065----
3066
3067The Motorola m68k configuration includes ColdFire support, and target
3068command for the following ROM monitors.
3069
3070`target abug DEV'
3071     ABug ROM monitor for M68K.
3072
3073`target cpu32bug DEV'
3074     CPU32BUG monitor, running on a CPU32 (M68K) board.
3075
3076`target dbug DEV'
3077     dBUG ROM monitor for Motorola ColdFire.
3078
3079`target est DEV'
3080     EST-300 ICE monitor, running on a CPU32 (M68K) board.
3081
3082`target rom68k DEV'
3083     ROM 68K monitor, running on an M68K IDP board.
3084
3085
3086`target rombug DEV'
3087     ROMBUG ROM monitor for OS/9000.
3088
3089
3090
3091File: gdb.info,  Node: MIPS Embedded,  Next: OpenRISC 1000,  Prev: M68K,  Up: Embedded Processors
3092
3093MIPS Embedded
3094-------------
3095
3096GDB can use the MIPS remote debugging protocol to talk to a MIPS board
3097attached to a serial line.  This is available when you configure GDB
3098with `--target=mips-idt-ecoff'.
3099
3100   Use these GDB commands to specify the connection to your target
3101board:
3102
3103`target mips PORT'
3104     To run a program on the board, start up `gdb' with the name of
3105     your program as the argument.  To connect to the board, use the
3106     command `target mips PORT', where PORT is the name of the serial
3107     port connected to the board.  If the program has not already been
3108     downloaded to the board, you may use the `load' command to
3109     download it.  You can then use all the usual GDB commands.
3110
3111     For example, this sequence connects to the target board through a
3112     serial port, and loads and runs a program called PROG through the
3113     debugger:
3114
3115          host$ gdb PROG
3116          GDB is free software and ...
3117          (gdb) target mips /dev/ttyb
3118          (gdb) load PROG
3119          (gdb) run
3120
3121`target mips HOSTNAME:PORTNUMBER'
3122     On some GDB host configurations, you can specify a TCP connection
3123     (for instance, to a serial line managed by a terminal
3124     concentrator) instead of a serial port, using the syntax
3125     `HOSTNAME:PORTNUMBER'.
3126
3127`target pmon PORT'
3128     PMON ROM monitor.
3129
3130`target ddb PORT'
3131     NEC's DDB variant of PMON for Vr4300.
3132
3133`target lsi PORT'
3134     LSI variant of PMON.
3135
3136`target r3900 DEV'
3137     Densan DVE-R3900 ROM monitor for Toshiba R3900 Mips.
3138
3139`target array DEV'
3140     Array Tech LSI33K RAID controller board.
3141
3142
3143GDB also supports these special commands for MIPS targets:
3144
3145`set processor ARGS'
3146`show processor'
3147     Use the `set processor' command to set the type of MIPS processor
3148     when you want to access processor-type-specific registers.  For
3149     example, `set processor R3041' tells GDB to use the CPU registers
3150     appropriate for the 3041 chip.  Use the `show processor' command
3151     to see what MIPS processor GDB is using.  Use the `info reg'
3152     command to see what registers GDB is using.
3153
3154`set mipsfpu double'
3155`set mipsfpu single'
3156`set mipsfpu none'
3157`show mipsfpu'
3158     If your target board does not support the MIPS floating point
3159     coprocessor, you should use the command `set mipsfpu none' (if you
3160     need this, you may wish to put the command in your GDB init file).
3161     This tells GDB how to find the return value of functions which
3162     return floating point values.  It also allows GDB to avoid saving
3163     the floating point registers when calling functions on the board.
3164     If you are using a floating point coprocessor with only single
3165     precision floating point support, as on the R4650 processor, use
3166     the command `set mipsfpu single'.  The default double precision
3167     floating point coprocessor may be selected using `set mipsfpu
3168     double'.
3169
3170     In previous versions the only choices were double precision or no
3171     floating point, so `set mipsfpu on' will select double precision
3172     and `set mipsfpu off' will select no floating point.
3173
3174     As usual, you can inquire about the `mipsfpu' variable with `show
3175     mipsfpu'.
3176
3177`set remotedebug N'
3178`show remotedebug'
3179     You can see some debugging information about communications with
3180     the board by setting the `remotedebug' variable.  If you set it to
3181     `1' using `set remotedebug 1', every packet is displayed.  If you
3182     set it to `2', every character is displayed.  You can check the
3183     current value at any time with the command `show remotedebug'.
3184
3185`set timeout SECONDS'
3186`set retransmit-timeout SECONDS'
3187`show timeout'
3188`show retransmit-timeout'
3189     You can control the timeout used while waiting for a packet, in
3190     the MIPS remote protocol, with the `set timeout SECONDS' command.
3191     The default is 5 seconds.  Similarly, you can control the timeout
3192     used while waiting for an acknowledgement of a packet with the `set
3193     retransmit-timeout SECONDS' command.  The default is 3 seconds.
3194     You can inspect both values with `show timeout' and `show
3195     retransmit-timeout'.  (These commands are _only_ available when
3196     GDB is configured for `--target=mips-idt-ecoff'.)
3197
3198     The timeout set by `set timeout' does not apply when GDB is
3199     waiting for your program to stop.  In that case, GDB waits forever
3200     because it has no way of knowing how long the program is going to
3201     run before stopping.
3202
3203
3204File: gdb.info,  Node: OpenRISC 1000,  Next: PA,  Prev: MIPS Embedded,  Up: Embedded Processors
3205
3206OpenRISC 1000
3207-------------
3208
3209See OR1k Architecture document (`www.opencores.org') for more
3210information about platform and commands.
3211
3212`target jtag jtag://HOST:PORT'
3213     Connects to remote JTAG server.  JTAG remote server can be either
3214     an or1ksim or JTAG server, connected via parallel port to the
3215     board.
3216
3217     Example: `target jtag jtag://localhost:9999'
3218
3219`or1ksim COMMAND'
3220     If connected to `or1ksim' OpenRISC 1000 Architectural Simulator,
3221     proprietary commands can be executed.
3222
3223`info or1k spr'
3224     Displays spr groups.
3225
3226`info or1k spr GROUP'
3227`info or1k spr GROUPNO'
3228     Displays register names in selected group.
3229
3230`info or1k spr GROUP REGISTER'
3231`info or1k spr REGISTER'
3232`info or1k spr GROUPNO REGISTERNO'
3233`info or1k spr REGISTERNO'
3234     Shows information about specified spr register.
3235
3236`spr GROUP REGISTER VALUE'
3237`spr REGISTER VALUE'
3238`spr GROUPNO REGISTERNO VALUE'
3239`spr REGISTERNO VALUE'
3240     Writes VALUE to specified spr register.
3241
3242   Some implementations of OpenRISC 1000 Architecture also have
3243hardware trace.  It is very similar to GDB trace, except it does not
3244interfere with normal program execution and is thus much faster.
3245Hardware breakpoints/watchpoint triggers can be set using:
3246`$LEA/$LDATA'
3247     Load effective address/data
3248
3249`$SEA/$SDATA'
3250     Store effective address/data
3251
3252`$AEA/$ADATA'
3253     Access effective address ($SEA or $LEA) or data ($SDATA/$LDATA)
3254
3255`$FETCH'
3256     Fetch data
3257
3258   When triggered, it can capture low level data, like: `PC', `LSEA',
3259`LDATA', `SDATA', `READSPR', `WRITESPR', `INSTR'.
3260
3261   `htrace' commands:
3262`hwatch CONDITIONAL'
3263     Set hardware watchpoint on combination of Load/Store Effecive
3264     Address(es) or Data.  For example:
3265
3266     `hwatch ($LEA == my_var) && ($LDATA < 50) || ($SEA == my_var) &&
3267     ($SDATA >= 50)'
3268
3269     `hwatch ($LEA == my_var) && ($LDATA < 50) || ($SEA == my_var) &&
3270     ($SDATA >= 50)'
3271
3272`htrace info'
3273     Display information about current HW trace configuration.
3274
3275`htrace trigger CONDITIONAL'
3276     Set starting criteria for HW trace.
3277
3278`htrace qualifier CONDITIONAL'
3279     Set acquisition qualifier for HW trace.
3280
3281`htrace stop CONDITIONAL'
3282     Set HW trace stopping criteria.
3283
3284`htrace record [DATA]*'
3285     Selects the data to be recorded, when qualifier is met and HW
3286     trace was triggered.
3287
3288`htrace enable'
3289`htrace disable'
3290     Enables/disables the HW trace.
3291
3292`htrace rewind [FILENAME]'
3293     Clears currently recorded trace data.
3294
3295     If filename is specified, new trace file is made and any newly
3296     collected data will be written there.
3297
3298`htrace print [START [LEN]]'
3299     Prints trace buffer, using current record configuration.
3300
3301`htrace mode continuous'
3302     Set continuous trace mode.
3303
3304`htrace mode suspend'
3305     Set suspend trace mode.
3306
3307
3308
3309File: gdb.info,  Node: PowerPC,  Next: SH,  Prev: PA,  Up: Embedded Processors
3310
3311PowerPC
3312-------
3313
3314`target dink32 DEV'
3315     DINK32 ROM monitor.
3316
3317`target ppcbug DEV'
3318
3319`target ppcbug1 DEV'
3320     PPCBUG ROM monitor for PowerPC.
3321
3322`target sds DEV'
3323     SDS monitor, running on a PowerPC board (such as Motorola's ADS).
3324
3325
3326
3327File: gdb.info,  Node: PA,  Next: PowerPC,  Prev: OpenRISC 1000,  Up: Embedded Processors
3328
3329HP PA Embedded
3330--------------
3331
3332`target op50n DEV'
3333     OP50N monitor, running on an OKI HPPA board.
3334
3335`target w89k DEV'
3336     W89K monitor, running on a Winbond HPPA board.
3337
3338
3339
3340File: gdb.info,  Node: SH,  Next: Sparclet,  Prev: PowerPC,  Up: Embedded Processors
3341
3342Renesas SH
3343----------
3344
3345`target hms DEV'
3346     A Renesas SH board attached via serial line to your host.  Use
3347     special commands `device' and `speed' to control the serial line
3348     and the communications speed used.
3349
3350`target e7000 DEV'
3351     E7000 emulator for Renesas SH.
3352
3353`target sh3 DEV'
3354
3355`target sh3e DEV'
3356     Renesas SH-3 and SH-3E target systems.
3357
3358
3359
3360File: gdb.info,  Node: Sparclet,  Next: Sparclite,  Prev: SH,  Up: Embedded Processors
3361
3362Tsqware Sparclet
3363----------------
3364
3365GDB enables developers to debug tasks running on Sparclet targets from
3366a Unix host.  GDB uses code that runs on both the Unix host and on the
3367Sparclet target.  The program `gdb' is installed and executed on the
3368Unix host.
3369
3370`remotetimeout ARGS'
3371     GDB supports the option `remotetimeout'.  This option is set by
3372     the user, and  ARGS represents the number of seconds GDB waits for
3373     responses.
3374
3375   When compiling for debugging, include the options `-g' to get debug
3376information and `-Ttext' to relocate the program to where you wish to
3377load it on the target.  You may also want to add the options `-n' or
3378`-N' in order to reduce the size of the sections.  Example:
3379
3380     sparclet-aout-gcc prog.c -Ttext 0x12010000 -g -o prog -N
3381
3382   You can use `objdump' to verify that the addresses are what you
3383intended:
3384
3385     sparclet-aout-objdump --headers --syms prog
3386
3387   Once you have set your Unix execution search path to find GDB, you
3388are ready to run GDB.  From your Unix host, run `gdb' (or
3389`sparclet-aout-gdb', depending on your installation).
3390
3391   GDB comes up showing the prompt:
3392
3393     (gdbslet)
3394
3395* Menu:
3396
3397* Sparclet File::                Setting the file to debug
3398* Sparclet Connection::          Connecting to Sparclet
3399* Sparclet Download::            Sparclet download
3400* Sparclet Execution::           Running and debugging
3401
3402
3403File: gdb.info,  Node: Sparclet File,  Next: Sparclet Connection,  Up: Sparclet
3404
3405Setting file to debug
3406.....................
3407
3408The GDB command `file' lets you choose with program to debug.
3409
3410     (gdbslet) file prog
3411
3412   GDB then attempts to read the symbol table of `prog'.  GDB locates
3413the file by searching the directories listed in the command search path.
3414If the file was compiled with debug information (option "-g"), source
3415files will be searched as well.  GDB locates the source files by
3416searching the directories listed in the directory search path (*note
3417Your program's environment: Environment.).  If it fails to find a file,
3418it displays a message such as:
3419
3420     prog: No such file or directory.
3421
3422   When this happens, add the appropriate directories to the search
3423paths with the GDB commands `path' and `dir', and execute the `target'
3424command again.
3425
3426
3427File: gdb.info,  Node: Sparclet Connection,  Next: Sparclet Download,  Prev: Sparclet File,  Up: Sparclet
3428
3429Connecting to Sparclet
3430......................
3431
3432The GDB command `target' lets you connect to a Sparclet target.  To
3433connect to a target on serial port "`ttya'", type:
3434
3435     (gdbslet) target sparclet /dev/ttya
3436     Remote target sparclet connected to /dev/ttya
3437     main () at ../prog.c:3
3438
3439   GDB displays messages like these:
3440
3441     Connected to ttya.
3442
3443
3444File: gdb.info,  Node: Sparclet Download,  Next: Sparclet Execution,  Prev: Sparclet Connection,  Up: Sparclet
3445
3446Sparclet download
3447.................
3448
3449Once connected to the Sparclet target, you can use the GDB `load'
3450command to download the file from the host to the target.  The file
3451name and load offset should be given as arguments to the `load' command.
3452Since the file format is aout, the program must be loaded to the
3453starting address.  You can use `objdump' to find out what this value
3454is.  The load offset is an offset which is added to the VMA (virtual
3455memory address) of each of the file's sections.  For instance, if the
3456program `prog' was linked to text address 0x1201000, with data at
34570x12010160 and bss at 0x12010170, in GDB, type:
3458
3459     (gdbslet) load prog 0x12010000
3460     Loading section .text, size 0xdb0 vma 0x12010000
3461
3462   If the code is loaded at a different address then what the program
3463was linked to, you may need to use the `section' and `add-symbol-file'
3464commands to tell GDB where to map the symbol table.
3465
3466
3467File: gdb.info,  Node: Sparclet Execution,  Prev: Sparclet Download,  Up: Sparclet
3468
3469Running and debugging
3470.....................
3471
3472You can now begin debugging the task using GDB's execution control
3473commands, `b', `step', `run', etc.  See the GDB manual for the list of
3474commands.
3475
3476     (gdbslet) b main
3477     Breakpoint 1 at 0x12010000: file prog.c, line 3.
3478     (gdbslet) run
3479     Starting program: prog
3480     Breakpoint 1, main (argc=1, argv=0xeffff21c) at prog.c:3
3481     3        char *symarg = 0;
3482     (gdbslet) step
3483     4        char *execarg = "hello!";
3484     (gdbslet)
3485
3486
3487File: gdb.info,  Node: Sparclite,  Next: ST2000,  Prev: Sparclet,  Up: Embedded Processors
3488
3489Fujitsu Sparclite
3490-----------------
3491
3492`target sparclite DEV'
3493     Fujitsu sparclite boards, used only for the purpose of loading.
3494     You must use an additional command to debug the program.  For
3495     example: target remote DEV using GDB standard remote protocol.
3496
3497
3498
3499File: gdb.info,  Node: ST2000,  Next: Z8000,  Prev: Sparclite,  Up: Embedded Processors
3500
3501Tandem ST2000
3502-------------
3503
3504GDB may be used with a Tandem ST2000 phone switch, running Tandem's
3505STDBUG protocol.
3506
3507   To connect your ST2000 to the host system, see the manufacturer's
3508manual.  Once the ST2000 is physically attached, you can run:
3509
3510     target st2000 DEV SPEED
3511
3512to establish it as your debugging environment.  DEV is normally the
3513name of a serial device, such as `/dev/ttya', connected to the ST2000
3514via a serial line.  You can instead specify DEV as a TCP connection
3515(for example, to a serial line attached via a terminal concentrator)
3516using the syntax `HOSTNAME:PORTNUMBER'.
3517
3518   The `load' and `attach' commands are _not_ defined for this target;
3519you must load your program into the ST2000 as you normally would for
3520standalone operation.  GDB reads debugging information (such as
3521symbols) from a separate, debugging version of the program available on
3522your host computer.
3523
3524   These auxiliary GDB commands are available to help you with the
3525ST2000 environment:
3526
3527`st2000 COMMAND'
3528     Send a COMMAND to the STDBUG monitor.  See the manufacturer's
3529     manual for available commands.
3530
3531`connect'
3532     Connect the controlling terminal to the STDBUG command monitor.
3533     When you are done interacting with STDBUG, typing either of two
3534     character sequences gets you back to the GDB command prompt:
3535     `<RET>~.' (Return, followed by tilde and period) or `<RET>~<C-d>'
3536     (Return, followed by tilde and control-D).
3537
3538
3539File: gdb.info,  Node: Z8000,  Prev: ST2000,  Up: Embedded Processors
3540
3541Zilog Z8000
3542-----------
3543
3544When configured for debugging Zilog Z8000 targets, GDB includes a Z8000
3545simulator.
3546
3547   For the Z8000 family, `target sim' simulates either the Z8002 (the
3548unsegmented variant of the Z8000 architecture) or the Z8001 (the
3549segmented variant).  The simulator recognizes which architecture is
3550appropriate by inspecting the object code.
3551
3552`target sim ARGS'
3553     Debug programs on a simulated CPU.  If the simulator supports setup
3554     options, specify them via ARGS.
3555
3556After specifying this target, you can debug programs for the simulated
3557CPU in the same style as programs for your host computer; use the
3558`file' command to load a new program image, the `run' command to run
3559your program, and so on.
3560
3561   As well as making available all the usual machine registers (*note
3562Registers: Registers.), the Z8000 simulator provides three additional
3563items of information as specially named registers:
3564
3565`cycles'
3566     Counts clock-ticks in the simulator.
3567
3568`insts'
3569     Counts instructions run in the simulator.
3570
3571`time'
3572     Execution time in 60ths of a second.
3573
3574
3575   You can refer to these values in GDB expressions with the usual
3576conventions; for example, `b fputc if $cycles>5000' sets a conditional
3577breakpoint that suspends only after at least 5000 simulated clock ticks.
3578
3579
3580File: gdb.info,  Node: Architectures,  Prev: Embedded Processors,  Up: Configurations
3581
3582Architectures
3583=============
3584
3585This section describes characteristics of architectures that affect all
3586uses of GDB with the architecture, both native and cross.
3587
3588* Menu:
3589
3590* A29K::
3591* Alpha::
3592* MIPS::
3593
3594
3595File: gdb.info,  Node: A29K,  Next: Alpha,  Up: Architectures
3596
3597A29K
3598----
3599
3600`set rstack_high_address ADDRESS'
3601     On AMD 29000 family processors, registers are saved in a separate
3602     "register stack".  There is no way for GDB to determine the extent
3603     of this stack.  Normally, GDB just assumes that the stack is
3604     "large enough".  This may result in GDB referencing memory
3605     locations that do not exist.  If necessary, you can get around
3606     this problem by specifying the ending address of the register
3607     stack with the `set rstack_high_address' command.  The argument
3608     should be an address, which you probably want to precede with `0x'
3609     to specify in hexadecimal.
3610
3611`show rstack_high_address'
3612     Display the current limit of the register stack, on AMD 29000
3613     family processors.
3614
3615
3616
3617File: gdb.info,  Node: Alpha,  Next: MIPS,  Prev: A29K,  Up: Architectures
3618
3619Alpha
3620-----
3621
3622See the following section.
3623
3624
3625File: gdb.info,  Node: MIPS,  Prev: Alpha,  Up: Architectures
3626
3627MIPS
3628----
3629
3630Alpha- and MIPS-based computers use an unusual stack frame, which
3631sometimes requires GDB to search backward in the object code to find
3632the beginning of a function.
3633
3634   To improve response time (especially for embedded applications, where
3635GDB may be restricted to a slow serial line for this search) you may
3636want to limit the size of this search, using one of these commands:
3637
3638`set heuristic-fence-post LIMIT'
3639     Restrict GDB to examining at most LIMIT bytes in its search for
3640     the beginning of a function.  A value of 0 (the default) means
3641     there is no limit.  However, except for 0, the larger the limit
3642     the more bytes `heuristic-fence-post' must search and therefore
3643     the longer it takes to run.
3644
3645`show heuristic-fence-post'
3646     Display the current limit.
3647
3648These commands are available _only_ when GDB is configured for
3649debugging programs on Alpha or MIPS processors.
3650
3651
3652File: gdb.info,  Node: Controlling GDB,  Next: Sequences,  Prev: Configurations,  Up: Top
3653
3654Controlling GDB
3655***************
3656
3657You can alter the way GDB interacts with you by using the `set'
3658command.  For commands controlling how GDB displays data, see *Note
3659Print settings: Print Settings.  Other settings are described here.
3660
3661* Menu:
3662
3663* Prompt::                      Prompt
3664* Editing::                     Command editing
3665* History::                     Command history
3666* Screen Size::                 Screen size
3667* Numbers::                     Numbers
3668* ABI::                         Configuring the current ABI
3669* Messages/Warnings::           Optional warnings and messages
3670* Debugging Output::            Optional messages about internal happenings
3671
3672
3673File: gdb.info,  Node: Prompt,  Next: Editing,  Up: Controlling GDB
3674
3675Prompt
3676======
3677
3678GDB indicates its readiness to read a command by printing a string
3679called the "prompt".  This string is normally `(gdb)'.  You can change
3680the prompt string with the `set prompt' command.  For instance, when
3681debugging GDB with GDB, it is useful to change the prompt in one of the
3682GDB sessions so that you can always tell which one you are talking to.
3683
3684   _Note:_  `set prompt' does not add a space for you after the prompt
3685you set.  This allows you to set a prompt which ends in a space or a
3686prompt that does not.
3687
3688`set prompt NEWPROMPT'
3689     Directs GDB to use NEWPROMPT as its prompt string henceforth.
3690
3691`show prompt'
3692     Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
3693
3694
3695File: gdb.info,  Node: Editing,  Next: History,  Prev: Prompt,  Up: Controlling GDB
3696
3697Command editing
3698===============
3699
3700GDB reads its input commands via the "readline" interface.  This GNU
3701library provides consistent behavior for programs which provide a
3702command line interface to the user.  Advantages are GNU Emacs-style or
3703"vi"-style inline editing of commands, `csh'-like history substitution,
3704and a storage and recall of command history across debugging sessions.
3705
3706   You may control the behavior of command line editing in GDB with the
3707command `set'.
3708
3709`set editing'
3710`set editing on'
3711     Enable command line editing (enabled by default).
3712
3713`set editing off'
3714     Disable command line editing.
3715
3716`show editing'
3717     Show whether command line editing is enabled.
3718
3719
3720File: gdb.info,  Node: History,  Next: Screen Size,  Prev: Editing,  Up: Controlling GDB
3721
3722Command history
3723===============
3724
3725GDB can keep track of the commands you type during your debugging
3726sessions, so that you can be certain of precisely what happened.  Use
3727these commands to manage the GDB command history facility.
3728
3729`set history filename FNAME'
3730     Set the name of the GDB command history file to FNAME.  This is
3731     the file where GDB reads an initial command history list, and
3732     where it writes the command history from this session when it
3733     exits.  You can access this list through history expansion or
3734     through the history command editing characters listed below.  This
3735     file defaults to the value of the environment variable
3736     `GDBHISTFILE', or to `./.gdb_history' (`./_gdb_history' on MS-DOS)
3737     if this variable is not set.
3738
3739`set history save'
3740`set history save on'
3741     Record command history in a file, whose name may be specified with
3742     the `set history filename' command.  By default, this option is
3743     disabled.
3744
3745`set history save off'
3746     Stop recording command history in a file.
3747
3748`set history size SIZE'
3749     Set the number of commands which GDB keeps in its history list.
3750     This defaults to the value of the environment variable `HISTSIZE',
3751     or to 256 if this variable is not set.
3752
3753   History expansion assigns special meaning to the character `!'.
3754
3755   Since `!' is also the logical not operator in C, history expansion
3756is off by default. If you decide to enable history expansion with the
3757`set history expansion on' command, you may sometimes need to follow
3758`!' (when it is used as logical not, in an expression) with a space or
3759a tab to prevent it from being expanded.  The readline history
3760facilities do not attempt substitution on the strings `!=' and `!(',
3761even when history expansion is enabled.
3762
3763   The commands to control history expansion are:
3764
3765`set history expansion on'
3766`set history expansion'
3767     Enable history expansion.  History expansion is off by default.
3768
3769`set history expansion off'
3770     Disable history expansion.
3771
3772     The readline code comes with more complete documentation of
3773     editing and history expansion features.  Users unfamiliar with GNU
3774     Emacs or `vi' may wish to read it.
3775
3776`show history'
3777`show history filename'
3778`show history save'
3779`show history size'
3780`show history expansion'
3781     These commands display the state of the GDB history parameters.
3782     `show history' by itself displays all four states.
3783
3784`show commands'
3785     Display the last ten commands in the command history.
3786
3787`show commands N'
3788     Print ten commands centered on command number N.
3789
3790`show commands +'
3791     Print ten commands just after the commands last printed.
3792
3793
3794File: gdb.info,  Node: Screen Size,  Next: Numbers,  Prev: History,  Up: Controlling GDB
3795
3796Screen size
3797===========
3798
3799Certain commands to GDB may produce large amounts of information output
3800to the screen.  To help you read all of it, GDB pauses and asks you for
3801input at the end of each page of output.  Type <RET> when you want to
3802continue the output, or `q' to discard the remaining output.  Also, the
3803screen width setting determines when to wrap lines of output.
3804Depending on what is being printed, GDB tries to break the line at a
3805readable place, rather than simply letting it overflow onto the
3806following line.
3807
3808   Normally GDB knows the size of the screen from the terminal driver
3809software.  For example, on Unix GDB uses the termcap data base together
3810with the value of the `TERM' environment variable and the `stty rows'
3811and `stty cols' settings.  If this is not correct, you can override it
3812with the `set height' and `set width' commands:
3813
3814`set height LPP'
3815`show height'
3816`set width CPL'
3817`show width'
3818     These `set' commands specify a screen height of LPP lines and a
3819     screen width of CPL characters.  The associated `show' commands
3820     display the current settings.
3821
3822     If you specify a height of zero lines, GDB does not pause during
3823     output no matter how long the output is.  This is useful if output
3824     is to a file or to an editor buffer.
3825
3826     Likewise, you can specify `set width 0' to prevent GDB from
3827     wrapping its output.
3828
3829
3830File: gdb.info,  Node: Numbers,  Next: ABI,  Prev: Screen Size,  Up: Controlling GDB
3831
3832Numbers
3833=======
3834
3835You can always enter numbers in octal, decimal, or hexadecimal in GDB
3836by the usual conventions: octal numbers begin with `0', decimal numbers
3837end with `.', and hexadecimal numbers begin with `0x'.  Numbers that
3838begin with none of these are, by default, entered in base 10; likewise,
3839the default display for numbers--when no particular format is
3840specified--is base 10.  You can change the default base for both input
3841and output with the `set radix' command.
3842
3843`set input-radix BASE'
3844     Set the default base for numeric input.  Supported choices for
3845     BASE are decimal 8, 10, or 16.  BASE must itself be specified
3846     either unambiguously or using the current default radix; for
3847     example, any of
3848
3849          set radix 012
3850          set radix 10.
3851          set radix 0xa
3852
3853     sets the base to decimal.  On the other hand, `set radix 10'
3854     leaves the radix unchanged no matter what it was.
3855
3856`set output-radix BASE'
3857     Set the default base for numeric display.  Supported choices for
3858     BASE are decimal 8, 10, or 16.  BASE must itself be specified
3859     either unambiguously or using the current default radix.
3860
3861`show input-radix'
3862     Display the current default base for numeric input.
3863
3864`show output-radix'
3865     Display the current default base for numeric display.
3866
3867
3868File: gdb.info,  Node: ABI,  Next: Messages/Warnings,  Prev: Numbers,  Up: Controlling GDB
3869
3870Configuring the current ABI
3871===========================
3872
3873GDB can determine the "ABI" (Application Binary Interface) of your
3874application automatically.  However, sometimes you need to override its
3875conclusions.  Use these commands to manage GDB's view of the current
3876ABI.
3877
3878   One GDB configuration can debug binaries for multiple operating
3879system targets, either via remote debugging or native emulation.  GDB
3880will autodetect the "OS ABI" (Operating System ABI) in use, but you can
3881override its conclusion using the `set osabi' command.  One example
3882where this is useful is in debugging of binaries which use an alternate
3883C library (e.g. UCLIBC for GNU/Linux) which does not have the same
3884identifying marks that the standard C library for your platform
3885provides.
3886
3887`show osabi'
3888     Show the OS ABI currently in use.
3889
3890`set osabi'
3891     With no argument, show the list of registered available OS ABI's.
3892
3893`set osabi ABI'
3894     Set the current OS ABI to ABI.
3895
3896   Generally, the way that an argument of type `float' is passed to a
3897function depends on whether the function is prototyped.  For a
3898prototyped (i.e. ANSI/ISO style) function, `float' arguments are passed
3899unchanged, according to the architecture's convention for `float'.  For
3900unprototyped (i.e. K&R style) functions, `float' arguments are first
3901promoted to type `double' and then passed.
3902
3903   Unfortunately, some forms of debug information do not reliably
3904indicate whether a function is prototyped.  If GDB calls a function
3905that is not marked as prototyped, it consults `set
3906coerce-float-to-double'.
3907
3908`set coerce-float-to-double'
3909`set coerce-float-to-double on'
3910     Arguments of type `float' will be promoted to `double' when passed
3911     to an unprototyped function.  This is the default setting.
3912
3913`set coerce-float-to-double off'
3914     Arguments of type `float' will be passed directly to unprototyped
3915     functions.
3916
3917   GDB needs to know the ABI used for your program's C++ objects.  The
3918correct C++ ABI depends on which C++ compiler was used to build your
3919application.  GDB only fully supports programs with a single C++ ABI;
3920if your program contains code using multiple C++ ABI's or if GDB can
3921not identify your program's ABI correctly, you can tell GDB which ABI
3922to use.  Currently supported ABI's include "gnu-v2", for `g++' versions
3923before 3.0, "gnu-v3", for `g++' versions 3.0 and later, and "hpaCC" for
3924the HP ANSI C++ compiler.  Other C++ compilers may use the "gnu-v2" or
3925"gnu-v3" ABI's as well.  The default setting is "auto".
3926
3927`show cp-abi'
3928     Show the C++ ABI currently in use.
3929
3930`set cp-abi'
3931     With no argument, show the list of supported C++ ABI's.
3932
3933`set cp-abi ABI'
3934`set cp-abi auto'
3935     Set the current C++ ABI to ABI, or return to automatic detection.
3936
3937
3938File: gdb.info,  Node: Messages/Warnings,  Next: Debugging Output,  Prev: ABI,  Up: Controlling GDB
3939
3940Optional warnings and messages
3941==============================
3942
3943By default, GDB is silent about its inner workings.  If you are running
3944on a slow machine, you may want to use the `set verbose' command.  This
3945makes GDB tell you when it does a lengthy internal operation, so you
3946will not think it has crashed.
3947
3948   Currently, the messages controlled by `set verbose' are those which
3949announce that the symbol table for a source file is being read; see
3950`symbol-file' in *Note Commands to specify files: Files.
3951
3952`set verbose on'
3953     Enables GDB output of certain informational messages.
3954
3955`set verbose off'
3956     Disables GDB output of certain informational messages.
3957
3958`show verbose'
3959     Displays whether `set verbose' is on or off.
3960
3961   By default, if GDB encounters bugs in the symbol table of an object
3962file, it is silent; but if you are debugging a compiler, you may find
3963this information useful (*note Errors reading symbol files: Symbol
3964Errors.).
3965
3966`set complaints LIMIT'
3967     Permits GDB to output LIMIT complaints about each type of unusual
3968     symbols before becoming silent about the problem.  Set LIMIT to
3969     zero to suppress all complaints; set it to a large number to
3970     prevent complaints from being suppressed.
3971
3972`show complaints'
3973     Displays how many symbol complaints GDB is permitted to produce.
3974
3975
3976   By default, GDB is cautious, and asks what sometimes seems to be a
3977lot of stupid questions to confirm certain commands.  For example, if
3978you try to run a program which is already running:
3979
3980     (gdb) run
3981     The program being debugged has been started already.
3982     Start it from the beginning? (y or n)
3983
3984   If you are willing to unflinchingly face the consequences of your own
3985commands, you can disable this "feature":
3986
3987`set confirm off'
3988     Disables confirmation requests.
3989
3990`set confirm on'
3991     Enables confirmation requests (the default).
3992
3993`show confirm'
3994     Displays state of confirmation requests.
3995
3996
3997
3998File: gdb.info,  Node: Debugging Output,  Prev: Messages/Warnings,  Up: Controlling GDB
3999
4000Optional messages about internal happenings
4001===========================================
4002
4003`set debug arch'
4004     Turns on or off display of gdbarch debugging info. The default is
4005     off
4006
4007`show debug arch'
4008     Displays the current state of displaying gdbarch debugging info.
4009
4010`set debug event'
4011     Turns on or off display of GDB event debugging info. The default
4012     is off.
4013
4014`show debug event'
4015     Displays the current state of displaying GDB event debugging info.
4016
4017`set debug expression'
4018     Turns on or off display of GDB expression debugging info. The
4019     default is off.
4020
4021`show debug expression'
4022     Displays the current state of displaying GDB expression debugging
4023     info.
4024
4025`set debug frame'
4026     Turns on or off display of GDB frame debugging info.  The default
4027     is off.
4028
4029`show debug frame'
4030     Displays the current state of displaying GDB frame debugging info.
4031
4032`set debug observer'
4033     Turns on or off display of GDB observer debugging.  This includes
4034     info such as the notification of observable events.
4035
4036`show debug observer'
4037     Displays the current state of observer debugging.
4038
4039`set debug overload'
4040     Turns on or off display of GDB C++ overload debugging info. This
4041     includes info such as ranking of functions, etc. The default is
4042     off.
4043
4044`show debug overload'
4045     Displays the current state of displaying GDB C++ overload
4046     debugging info.
4047
4048`set debug remote'
4049     Turns on or off display of reports on all packets sent back and
4050     forth across the serial line to the remote machine.  The info is
4051     printed on the GDB standard output stream. The default is off.
4052
4053`show debug remote'
4054     Displays the state of display of remote packets.
4055
4056`set debug serial'
4057     Turns on or off display of GDB serial debugging info. The default
4058     is off.
4059
4060`show debug serial'
4061     Displays the current state of displaying GDB serial debugging info.
4062
4063`set debug target'
4064     Turns on or off display of GDB target debugging info. This info
4065     includes what is going on at the target level of GDB, as it
4066     happens. The default is 0.  Set it to 1 to track events, and to 2
4067     to also track the value of large memory transfers.  Changes to
4068     this flag do not take effect until the next time you connect to a
4069     target or use the `run' command.
4070
4071`show debug target'
4072     Displays the current state of displaying GDB target debugging info.
4073
4074`set debug varobj'
4075     Turns on or off display of GDB variable object debugging info. The
4076     default is off.
4077
4078`show debug varobj'
4079     Displays the current state of displaying GDB variable object
4080     debugging info.
4081
4082
4083File: gdb.info,  Node: Sequences,  Next: TUI,  Prev: Controlling GDB,  Up: Top
4084
4085Canned Sequences of Commands
4086****************************
4087
4088Aside from breakpoint commands (*note Breakpoint command lists: Break
4089Commands.), GDB provides two ways to store sequences of commands for
4090execution as a unit: user-defined commands and command files.
4091
4092* Menu:
4093
4094* Define::                      User-defined commands
4095* Hooks::                       User-defined command hooks
4096* Command Files::               Command files
4097* Output::                      Commands for controlled output
4098
4099
4100File: gdb.info,  Node: Define,  Next: Hooks,  Up: Sequences
4101
4102User-defined commands
4103=====================
4104
4105A "user-defined command" is a sequence of GDB commands to which you
4106assign a new name as a command.  This is done with the `define'
4107command.  User commands may accept up to 10 arguments separated by
4108whitespace.  Arguments are accessed within the user command via
4109$ARG0...$ARG9.  A trivial example:
4110
4111     define adder
4112       print $arg0 + $arg1 + $arg2
4113
4114To execute the command use:
4115
4116     adder 1 2 3
4117
4118This defines the command `adder', which prints the sum of its three
4119arguments.  Note the arguments are text substitutions, so they may
4120reference variables, use complex expressions, or even perform inferior
4121functions calls.
4122
4123`define COMMANDNAME'
4124     Define a command named COMMANDNAME.  If there is already a command
4125     by that name, you are asked to confirm that you want to redefine
4126     it.
4127
4128     The definition of the command is made up of other GDB command
4129     lines, which are given following the `define' command.  The end of
4130     these commands is marked by a line containing `end'.
4131
4132`if'
4133     Takes a single argument, which is an expression to evaluate.  It
4134     is followed by a series of commands that are executed only if the
4135     expression is true (nonzero).  There can then optionally be a line
4136     `else', followed by a series of commands that are only executed if
4137     the expression was false.  The end of the list is marked by a line
4138     containing `end'.
4139
4140`while'
4141     The syntax is similar to `if': the command takes a single argument,
4142     which is an expression to evaluate, and must be followed by the
4143     commands to execute, one per line, terminated by an `end'.  The
4144     commands are executed repeatedly as long as the expression
4145     evaluates to true.
4146
4147`document COMMANDNAME'
4148     Document the user-defined command COMMANDNAME, so that it can be
4149     accessed by `help'.  The command COMMANDNAME must already be
4150     defined.  This command reads lines of documentation just as
4151     `define' reads the lines of the command definition, ending with
4152     `end'.  After the `document' command is finished, `help' on command
4153     COMMANDNAME displays the documentation you have written.
4154
4155     You may use the `document' command again to change the
4156     documentation of a command.  Redefining the command with `define'
4157     does not change the documentation.
4158
4159`help user-defined'
4160     List all user-defined commands, with the first line of the
4161     documentation (if any) for each.
4162
4163`show user'
4164`show user COMMANDNAME'
4165     Display the GDB commands used to define COMMANDNAME (but not its
4166     documentation).  If no COMMANDNAME is given, display the
4167     definitions for all user-defined commands.
4168
4169`show max-user-call-depth'
4170`set max-user-call-depth'
4171     The value of `max-user-call-depth' controls how many recursion
4172     levels are allowed in user-defined commands before GDB suspects an
4173     infinite recursion and aborts the command.
4174
4175
4176   When user-defined commands are executed, the commands of the
4177definition are not printed.  An error in any command stops execution of
4178the user-defined command.
4179
4180   If used interactively, commands that would ask for confirmation
4181proceed without asking when used inside a user-defined command.  Many
4182GDB commands that normally print messages to say what they are doing
4183omit the messages when used in a user-defined command.
4184
4185
4186File: gdb.info,  Node: Hooks,  Next: Command Files,  Prev: Define,  Up: Sequences
4187
4188User-defined command hooks
4189==========================
4190
4191You may define "hooks", which are a special kind of user-defined
4192command.  Whenever you run the command `foo', if the user-defined
4193command `hook-foo' exists, it is executed (with no arguments) before
4194that command.
4195
4196   A hook may also be defined which is run after the command you
4197executed.  Whenever you run the command `foo', if the user-defined
4198command `hookpost-foo' exists, it is executed (with no arguments) after
4199that command.  Post-execution hooks may exist simultaneously with
4200pre-execution hooks, for the same command.
4201
4202   It is valid for a hook to call the command which it hooks.  If this
4203occurs, the hook is not re-executed, thereby avoiding infinte recursion.
4204
4205   In addition, a pseudo-command, `stop' exists.  Defining
4206(`hook-stop') makes the associated commands execute every time
4207execution stops in your program: before breakpoint commands are run,
4208displays are printed, or the stack frame is printed.
4209
4210   For example, to ignore `SIGALRM' signals while single-stepping, but
4211treat them normally during normal execution, you could define:
4212
4213     define hook-stop
4214     handle SIGALRM nopass
4215     end
4216
4217     define hook-run
4218     handle SIGALRM pass
4219     end
4220
4221     define hook-continue
4222     handle SIGLARM pass
4223     end
4224
4225   As a further example, to hook at the begining and end of the `echo'
4226command, and to add extra text to the beginning and end of the message,
4227you could define:
4228
4229     define hook-echo
4230     echo <<<---
4231     end
4232
4233     define hookpost-echo
4234     echo --->>>\n
4235     end
4236
4237     (gdb) echo Hello World
4238     <<<---Hello World--->>>
4239     (gdb)
4240
4241   You can define a hook for any single-word command in GDB, but not
4242for command aliases; you should define a hook for the basic command
4243name, e.g.  `backtrace' rather than `bt'.  If an error occurs during
4244the execution of your hook, execution of GDB commands stops and GDB
4245issues a prompt (before the command that you actually typed had a
4246chance to run).
4247
4248   If you try to define a hook which does not match any known command,
4249you get a warning from the `define' command.
4250
4251
4252File: gdb.info,  Node: Command Files,  Next: Output,  Prev: Hooks,  Up: Sequences
4253
4254Command files
4255=============
4256
4257A command file for GDB is a file of lines that are GDB commands.
4258Comments (lines starting with `#') may also be included.  An empty line
4259in a command file does nothing; it does not mean to repeat the last
4260command, as it would from the terminal.
4261
4262   When you start GDB, it automatically executes commands from its
4263"init files", normally called `.gdbinit'(1).  During startup, GDB does
4264the following:
4265
4266  1. Reads the init file (if any) in your home directory(2).
4267
4268  2. Processes command line options and operands.
4269
4270  3. Reads the init file (if any) in the current working directory.
4271
4272  4. Reads command files specified by the `-x' option.
4273
4274   The init file in your home directory can set options (such as `set
4275complaints') that affect subsequent processing of command line options
4276and operands.  Init files are not executed if you use the `-nx' option
4277(*note Choosing modes: Mode Options.).
4278
4279   On some configurations of GDB, the init file is known by a different
4280name (these are typically environments where a specialized form of GDB
4281may need to coexist with other forms, hence a different name for the
4282specialized version's init file).  These are the environments with
4283special init file names:
4284
4285   * VxWorks (Wind River Systems real-time OS): `.vxgdbinit'
4286
4287   * OS68K (Enea Data Systems real-time OS): `.os68gdbinit'
4288
4289   * ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit'
4290
4291   You can also request the execution of a command file with the
4292`source' command:
4293
4294`source FILENAME'
4295     Execute the command file FILENAME.
4296
4297   The lines in a command file are executed sequentially.  They are not
4298printed as they are executed.  An error in any command terminates
4299execution of the command file and control is returned to the console.
4300
4301   Commands that would ask for confirmation if used interactively
4302proceed without asking when used in a command file.  Many GDB commands
4303that normally print messages to say what they are doing omit the
4304messages when called from command files.
4305
4306   GDB also accepts command input from standard input.  In this mode,
4307normal output goes to standard output and error output goes to standard
4308error.  Errors in a command file supplied on standard input do not
4309terminate execution of the command file -- execution continues with the
4310next command.
4311
4312     gdb < cmds > log 2>&1
4313
4314   (The syntax above will vary depending on the shell used.) This
4315example will execute commands from the file `cmds'. All output and
4316errors would be directed to `log'.
4317
4318   ---------- Footnotes ----------
4319
4320   (1) The DJGPP port of GDB uses the name `gdb.ini' instead, due to the
4321limitations of file names imposed by DOS filesystems.
4322
4323   (2) On DOS/Windows systems, the home directory is the one pointed to
4324by the `HOME' environment variable.
4325
4326
4327File: gdb.info,  Node: Output,  Prev: Command Files,  Up: Sequences
4328
4329Commands for controlled output
4330==============================
4331
4332During the execution of a command file or a user-defined command, normal
4333GDB output is suppressed; the only output that appears is what is
4334explicitly printed by the commands in the definition.  This section
4335describes three commands useful for generating exactly the output you
4336want.
4337
4338`echo TEXT'
4339     Print TEXT.  Nonprinting characters can be included in TEXT using
4340     C escape sequences, such as `\n' to print a newline.  *No newline
4341     is printed unless you specify one.* In addition to the standard C
4342     escape sequences, a backslash followed by a space stands for a
4343     space.  This is useful for displaying a string with spaces at the
4344     beginning or the end, since leading and trailing spaces are
4345     otherwise trimmed from all arguments.  To print ` and foo = ', use
4346     the command `echo \ and foo = \ '.
4347
4348     A backslash at the end of TEXT can be used, as in C, to continue
4349     the command onto subsequent lines.  For example,
4350
4351          echo This is some text\n\
4352          which is continued\n\
4353          onto several lines.\n
4354
4355     produces the same output as
4356
4357          echo This is some text\n
4358          echo which is continued\n
4359          echo onto several lines.\n
4360
4361`output EXPRESSION'
4362     Print the value of EXPRESSION and nothing but that value: no
4363     newlines, no `$NN = '.  The value is not entered in the value
4364     history either.  *Note Expressions: Expressions, for more
4365     information on expressions.
4366
4367`output/FMT EXPRESSION'
4368     Print the value of EXPRESSION in format FMT.  You can use the same
4369     formats as for `print'.  *Note Output formats: Output Formats, for
4370     more information.
4371
4372`printf STRING, EXPRESSIONS...'
4373     Print the values of the EXPRESSIONS under the control of STRING.
4374     The EXPRESSIONS are separated by commas and may be either numbers
4375     or pointers.  Their values are printed as specified by STRING,
4376     exactly as if your program were to execute the C subroutine
4377
4378          printf (STRING, EXPRESSIONS...);
4379
4380     For example, you can print two values in hex like this:
4381
4382          printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
4383
4384     The only backslash-escape sequences that you can use in the format
4385     string are the simple ones that consist of backslash followed by a
4386     letter.
4387
4388
4389File: gdb.info,  Node: Interpreters,  Next: Emacs,  Prev: TUI,  Up: Top
4390
4391Command Interpreters
4392********************
4393
4394GDB supports multiple command interpreters, and some command
4395infrastructure to allow users or user interface writers to switch
4396between interpreters or run commands in other interpreters.
4397
4398   GDB currently supports two command interpreters, the console
4399interpreter (sometimes called the command-line interpreter or CLI) and
4400the machine interface interpreter (or GDB/MI).  This manual describes
4401both of these interfaces in great detail.
4402
4403   By default, GDB will start with the console interpreter.  However,
4404the user may choose to start GDB with another interpreter by specifying
4405the `-i' or `--interpreter' startup options.  Defined interpreters
4406include:
4407
4408`console'
4409     The traditional console or command-line interpreter.  This is the
4410     most often used interpreter with GDB. With no interpreter
4411     specified at runtime, GDB will use this interpreter.
4412
4413`mi'
4414     The newest GDB/MI interface (currently `mi2').  Used primarily by
4415     programs wishing to use GDB as a backend for a debugger GUI or an
4416     IDE.  For more information, see *Note The GDB/MI Interface: GDB/MI.
4417
4418`mi2'
4419     The current GDB/MI interface.
4420
4421`mi1'
4422     The GDB/MI interface included in GDB 5.1, 5.2, and 5.3.
4423
4424
4425   The interpreter being used by GDB may not be dynamically switched at
4426runtime.  Although possible, this could lead to a very precarious
4427situation.  Consider an IDE using GDB/MI.  If a user enters the command
4428"interpreter-set console" in a console view, GDB would switch to using
4429the console interpreter, rendering the IDE inoperable!
4430
4431   Although you may only choose a single interpreter at startup, you
4432may execute commands in any interpreter from the current interpreter
4433using the appropriate command.  If you are running the console
4434interpreter, simply use the `interpreter-exec' command:
4435
4436     interpreter-exec mi "-data-list-register-names"
4437
4438   GDB/MI has a similar command, although it is only available in
4439versions of GDB which support GDB/MI version 2 (or greater).
4440
4441
4442File: gdb.info,  Node: TUI,  Next: Interpreters,  Prev: Sequences,  Up: Top
4443
4444GDB Text User Interface
4445***********************
4446
4447* Menu:
4448
4449* TUI Overview::                TUI overview
4450* TUI Keys::                    TUI key bindings
4451* TUI Single Key Mode::         TUI single key mode
4452* TUI Commands::                TUI specific commands
4453* TUI Configuration::           TUI configuration variables
4454
4455   The GDB Text User Interface, TUI in short, is a terminal interface
4456which uses the `curses' library to show the source file, the assembly
4457output, the program registers and GDB commands in separate text windows.
4458
4459   The TUI is enabled by invoking GDB using either `gdbtui' or `gdb
4460-tui'.
4461
4462
4463File: gdb.info,  Node: TUI Overview,  Next: TUI Keys,  Up: TUI
4464
4465TUI overview
4466============
4467
4468The TUI has two display modes that can be switched while GDB runs:
4469
4470   * A curses (or TUI) mode in which it displays several text windows
4471     on the terminal.
4472
4473   * A standard mode which corresponds to the GDB configured without
4474     the TUI.
4475
4476   In the TUI mode, GDB can display several text window on the terminal:
4477
4478_command_
4479     This window is the GDB command window with the GDB prompt and the
4480     GDB outputs.  The GDB input is still managed using readline but
4481     through the TUI.  The _command_ window is always visible.
4482
4483_source_
4484     The source window shows the source file of the program.  The
4485     current line as well as active breakpoints are displayed in this
4486     window.
4487
4488_assembly_
4489     The assembly window shows the disassembly output of the program.
4490
4491_register_
4492     This window shows the processor registers.  It detects when a
4493     register is changed and when this is the case, registers that have
4494     changed are highlighted.
4495
4496
4497   The source and assembly windows show the current program position by
4498highlighting the current line and marking them with the `>' marker.
4499Breakpoints are also indicated with two markers.  A first one indicates
4500the breakpoint type:
4501
4502`B'
4503     Breakpoint which was hit at least once.
4504
4505`b'
4506     Breakpoint which was never hit.
4507
4508`H'
4509     Hardware breakpoint which was hit at least once.
4510
4511`h'
4512     Hardware breakpoint which was never hit.
4513
4514
4515   The second marker indicates whether the breakpoint is enabled or not:
4516
4517`+'
4518     Breakpoint is enabled.
4519
4520`-'
4521     Breakpoint is disabled.
4522
4523
4524   The source, assembly and register windows are attached to the thread
4525and the frame position.  They are updated when the current thread
4526changes, when the frame changes or when the program counter changes.
4527These three windows are arranged by the TUI according to several
4528layouts.  The layout defines which of these three windows are visible.
4529The following layouts are available:
4530
4531   * source
4532
4533   * assembly
4534
4535   * source and assembly
4536
4537   * source and registers
4538
4539   * assembly and registers
4540
4541
4542   On top of the command window a status line gives various information
4543concerning the current process begin debugged.  The status line is
4544updated when the information it shows changes.  The following fields
4545are displayed:
4546
4547_target_
4548     Indicates the current gdb target (*note Specifying a Debugging
4549     Target: Targets.).
4550
4551_process_
4552     Gives information about the current process or thread number.
4553     When no process is being debugged, this field is set to `No
4554     process'.
4555
4556_function_
4557     Gives the current function name for the selected frame.  The name
4558     is demangled if demangling is turned on (*note Print Settings::).
4559     When there is no symbol corresponding to the current program
4560     counter the string `??' is displayed.
4561
4562_line_
4563     Indicates the current line number for the selected frame.  When
4564     the current line number is not known the string `??' is displayed.
4565
4566_pc_
4567     Indicates the current program counter address.
4568
4569
4570
4571File: gdb.info,  Node: TUI Keys,  Next: TUI Single Key Mode,  Prev: TUI Overview,  Up: TUI
4572
4573TUI Key Bindings
4574================
4575
4576The TUI installs several key bindings in the readline keymaps (*note
4577Command Line Editing::).  They allow to leave or enter in the TUI mode
4578or they operate directly on the TUI layout and windows.  The TUI also
4579provides a _SingleKey_ keymap which binds several keys directly to GDB
4580commands.  The following key bindings are installed for both TUI mode
4581and the GDB standard mode.
4582
4583`C-x C-a'
4584`C-x a'
4585`C-x A'
4586     Enter or leave the TUI mode.  When the TUI mode is left, the
4587     curses window management is left and GDB operates using its
4588     standard mode writing on the terminal directly.  When the TUI mode
4589     is entered, the control is given back to the curses windows.  The
4590     screen is then refreshed.
4591
4592`C-x 1'
4593     Use a TUI layout with only one window.  The layout will either be
4594     `source' or `assembly'.  When the TUI mode is not active, it will
4595     switch to the TUI mode.
4596
4597     Think of this key binding as the Emacs `C-x 1' binding.
4598
4599`C-x 2'
4600     Use a TUI layout with at least two windows.  When the current
4601     layout shows already two windows, a next layout with two windows
4602     is used.  When a new layout is chosen, one window will always be
4603     common to the previous layout and the new one.
4604
4605     Think of it as the Emacs `C-x 2' binding.
4606
4607`C-x o'
4608     Change the active window.  The TUI associates several key bindings
4609     (like scrolling and arrow keys) to the active window. This command
4610     gives the focus to the next TUI window.
4611
4612     Think of it as the Emacs `C-x o' binding.
4613
4614`C-x s'
4615     Use the TUI _SingleKey_ keymap that binds single key to gdb
4616     commands (*note TUI Single Key Mode::).
4617
4618
4619   The following key bindings are handled only by the TUI mode:
4620
4621<PgUp>
4622     Scroll the active window one page up.
4623
4624<PgDn>
4625     Scroll the active window one page down.
4626
4627<Up>
4628     Scroll the active window one line up.
4629
4630<Down>
4631     Scroll the active window one line down.
4632
4633<Left>
4634     Scroll the active window one column left.
4635
4636<Right>
4637     Scroll the active window one column right.
4638
4639<C-L>
4640     Refresh the screen.
4641
4642
4643   In the TUI mode, the arrow keys are used by the active window for
4644scrolling.  This means they are available for readline when the active
4645window is the command window.  When the command window does not have
4646the focus, it is necessary to use other readline key bindings such as
4647<C-p>, <C-n>, <C-b> and <C-f>.
4648
4649
4650File: gdb.info,  Node: TUI Single Key Mode,  Next: TUI Commands,  Prev: TUI Keys,  Up: TUI
4651
4652TUI Single Key Mode
4653===================
4654
4655The TUI provides a _SingleKey_ mode in which it installs a particular
4656key binding in the readline keymaps to connect single keys to some gdb
4657commands.
4658
4659`c'
4660     continue
4661
4662`d'
4663     down
4664
4665`f'
4666     finish
4667
4668`n'
4669     next
4670
4671`q'
4672     exit the _SingleKey_ mode.
4673
4674`r'
4675     run
4676
4677`s'
4678     step
4679
4680`u'
4681     up
4682
4683`v'
4684     info locals
4685
4686`w'
4687     where
4688
4689
4690   Other keys temporarily switch to the GDB command prompt.  The key
4691that was pressed is inserted in the editing buffer so that it is
4692possible to type most GDB commands without interaction with the TUI
4693_SingleKey_ mode.  Once the command is entered the TUI _SingleKey_ mode
4694is restored.  The only way to permanently leave this mode is by hitting
4695<q> or `<C-x> <s>'.
4696
4697
4698File: gdb.info,  Node: TUI Commands,  Next: TUI Configuration,  Prev: TUI Single Key Mode,  Up: TUI
4699
4700TUI specific commands
4701=====================
4702
4703The TUI has specific commands to control the text windows.  These
4704commands are always available, that is they do not depend on the
4705current terminal mode in which GDB runs.  When GDB is in the standard
4706mode, using these commands will automatically switch in the TUI mode.
4707
4708`info win'
4709     List and give the size of all displayed windows.
4710
4711`layout next'
4712     Display the next layout.
4713
4714`layout prev'
4715     Display the previous layout.
4716
4717`layout src'
4718     Display the source window only.
4719
4720`layout asm'
4721     Display the assembly window only.
4722
4723`layout split'
4724     Display the source and assembly window.
4725
4726`layout regs'
4727     Display the register window together with the source or assembly
4728     window.
4729
4730`focus next | prev | src | asm | regs | split'
4731     Set the focus to the named window.  This command allows to change
4732     the active window so that scrolling keys can be affected to
4733     another window.
4734
4735`refresh'
4736     Refresh the screen.  This is similar to using <C-L> key.
4737
4738`tui reg float'
4739     Show the floating point registers in the register window.
4740
4741`tui reg general'
4742     Show the general registers in the register window.
4743
4744`tui reg next'
4745     Show the next register group.  The list of register groups as well
4746     as their order is target specific.  The predefined register groups
4747     are the following: `general', `float', `system', `vector', `all',
4748     `save', `restore'.
4749
4750`tui reg system'
4751     Show the system registers in the register window.
4752
4753`update'
4754     Update the source window and the current execution point.
4755
4756`winheight NAME +COUNT'
4757`winheight NAME -COUNT'
4758     Change the height of the window NAME by COUNT lines.  Positive
4759     counts increase the height, while negative counts decrease it.
4760
4761
4762
4763File: gdb.info,  Node: TUI Configuration,  Prev: TUI Commands,  Up: TUI
4764
4765TUI configuration variables
4766===========================
4767
4768The TUI has several configuration variables that control the appearance
4769of windows on the terminal.
4770
4771`set tui border-kind KIND'
4772     Select the border appearance for the source, assembly and register
4773     windows.  The possible values are the following:
4774    `space'
4775          Use a space character to draw the border.
4776
4777    `ascii'
4778          Use ascii characters + - and | to draw the border.
4779
4780    `acs'
4781          Use the Alternate Character Set to draw the border.  The
4782          border is drawn using character line graphics if the terminal
4783          supports them.
4784
4785
4786`set tui active-border-mode MODE'
4787     Select the attributes to display the border of the active window.
4788     The possible values are `normal', `standout', `reverse', `half',
4789     `half-standout', `bold' and `bold-standout'.
4790
4791`set tui border-mode MODE'
4792     Select the attributes to display the border of other windows.  The
4793     MODE can be one of the following:
4794    `normal'
4795          Use normal attributes to display the border.
4796
4797    `standout'
4798          Use standout mode.
4799
4800    `reverse'
4801          Use reverse video mode.
4802
4803    `half'
4804          Use half bright mode.
4805
4806    `half-standout'
4807          Use half bright and standout mode.
4808
4809    `bold'
4810          Use extra bright or bold mode.
4811
4812    `bold-standout'
4813          Use extra bright or bold and standout mode.
4814
4815
4816
4817
4818File: gdb.info,  Node: Emacs,  Next: Annotations,  Prev: Interpreters,  Up: Top
4819
4820Using GDB under GNU Emacs
4821*************************
4822
4823A special interface allows you to use GNU Emacs to view (and edit) the
4824source files for the program you are debugging with GDB.
4825
4826   To use this interface, use the command `M-x gdb' in Emacs.  Give the
4827executable file you want to debug as an argument.  This command starts
4828GDB as a subprocess of Emacs, with input and output through a newly
4829created Emacs buffer.
4830
4831   Using GDB under Emacs is just like using GDB normally except for two
4832things:
4833
4834   * All "terminal" input and output goes through the Emacs buffer.
4835
4836   This applies both to GDB commands and their output, and to the input
4837and output done by the program you are debugging.
4838
4839   This is useful because it means that you can copy the text of
4840previous commands and input them again; you can even use parts of the
4841output in this way.
4842
4843   All the facilities of Emacs' Shell mode are available for interacting
4844with your program.  In particular, you can send signals the usual
4845way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
4846
4847   * GDB displays source code through Emacs.
4848
4849   Each time GDB displays a stack frame, Emacs automatically finds the
4850source file for that frame and puts an arrow (`=>') at the left margin
4851of the current line.  Emacs uses a separate buffer for source display,
4852and splits the screen to show both your GDB session and the source.
4853
4854   Explicit GDB `list' or search commands still produce output as
4855usual, but you probably have no reason to use them from Emacs.
4856
4857   If you specify an absolute file name when prompted for the `M-x gdb'
4858argument, then Emacs sets your current working directory to where your
4859program resides.  If you only specify the file name, then Emacs sets
4860your current working directory to to the directory associated with the
4861previous buffer.  In this case, GDB may find your program by searching
4862your environment's `PATH' variable, but on some operating systems it
4863might not find the source.  So, although the GDB input and output
4864session proceeds normally, the auxiliary buffer does not display the
4865current source and line of execution.
4866
4867   The initial working directory of GDB is printed on the top line of
4868the GDB I/O buffer and this serves as a default for the commands that
4869specify files for GDB to operate on.  *Note Commands to specify files:
4870Files.
4871
4872   By default, `M-x gdb' calls the program called `gdb'.  If you need
4873to call GDB by a different name (for example, if you keep several
4874configurations around, with different names) you can customize the
4875Emacs variable `gud-gdb-command-name' to run the one you want.
4876
4877   In the GDB I/O buffer, you can use these special Emacs commands in
4878addition to the standard Shell mode commands:
4879
4880`C-h m'
4881     Describe the features of Emacs' GDB Mode.
4882
4883`C-c C-s'
4884     Execute to another source line, like the GDB `step' command; also
4885     update the display window to show the current file and location.
4886
4887`C-c C-n'
4888     Execute to next source line in this function, skipping all function
4889     calls, like the GDB `next' command.  Then update the display window
4890     to show the current file and location.
4891
4892`C-c C-i'
4893     Execute one instruction, like the GDB `stepi' command; update
4894     display window accordingly.
4895
4896`C-c C-f'
4897     Execute until exit from the selected stack frame, like the GDB
4898     `finish' command.
4899
4900`C-c C-r'
4901     Continue execution of your program, like the GDB `continue'
4902     command.
4903
4904`C-c <'
4905     Go up the number of frames indicated by the numeric argument
4906     (*note Numeric Arguments: (Emacs)Arguments.), like the GDB `up'
4907     command.
4908
4909`C-c >'
4910     Go down the number of frames indicated by the numeric argument,
4911     like the GDB `down' command.
4912
4913   In any source file, the Emacs command `C-x SPC' (`gud-break') tells
4914GDB to set a breakpoint on the source line point is on.
4915
4916   If you type `M-x speedbar', then Emacs displays a separate frame
4917which shows a backtrace when the GDB I/O buffer is current.  Move point
4918to any frame in the stack and type <RET> to make it become the current
4919frame and display the associated source in the source buffer.
4920Alternatively, click `Mouse-2' to make the selected frame become the
4921current one.
4922
4923   If you accidentally delete the source-display buffer, an easy way to
4924get it back is to type the command `f' in the GDB buffer, to request a
4925frame display; when you run under Emacs, this recreates the source
4926buffer if necessary to show you the context of the current frame.
4927
4928   The source files displayed in Emacs are in ordinary Emacs buffers
4929which are visiting the source files in the usual way.  You can edit the
4930files with these buffers if you wish; but keep in mind that GDB
4931communicates with Emacs in terms of line numbers.  If you add or delete
4932lines from the text, the line numbers that GDB knows cease to
4933correspond properly with the code.
4934
4935   The description given here is for GNU Emacs version 21.3 and a more
4936detailed description of its interaction with GDB is given in the Emacs
4937manual (*note Debuggers: (Emacs)Debuggers.).
4938
4939
4940File: gdb.info,  Node: GDB/MI,  Next: GDB Bugs,  Prev: Annotations,  Up: Top
4941
4942The GDB/MI Interface
4943********************
4944
4945Function and Purpose
4946====================
4947
4948GDB/MI is a line based machine oriented text interface to GDB.  It is
4949specifically intended to support the development of systems which use
4950the debugger as just one small component of a larger system.
4951
4952   This chapter is a specification of the GDB/MI interface.  It is
4953written in the form of a reference manual.
4954
4955   Note that GDB/MI is still under construction, so some of the
4956features described below are incomplete and subject to change.
4957
4958Notation and Terminology
4959========================
4960
4961This chapter uses the following notation:
4962
4963   * `|' separates two alternatives.
4964
4965   * `[ SOMETHING ]' indicates that SOMETHING is optional: it may or
4966     may not be given.
4967
4968   * `( GROUP )*' means that GROUP inside the parentheses may repeat
4969     zero or more times.
4970
4971   * `( GROUP )+' means that GROUP inside the parentheses may repeat
4972     one or more times.
4973
4974   * `"STRING"' means a literal STRING.
4975
4976Acknowledgments
4977===============
4978
4979In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
4980Elena Zannoni.
4981
4982* Menu:
4983
4984* GDB/MI Command Syntax::
4985* GDB/MI Compatibility with CLI::
4986* GDB/MI Output Records::
4987* GDB/MI Command Description Format::
4988* GDB/MI Breakpoint Table Commands::
4989* GDB/MI Data Manipulation::
4990* GDB/MI Program Control::
4991* GDB/MI Miscellaneous Commands::
4992* GDB/MI Stack Manipulation::
4993* GDB/MI Symbol Query::
4994* GDB/MI Target Manipulation::
4995* GDB/MI Thread Commands::
4996* GDB/MI Tracepoint Commands::
4997* GDB/MI Variable Objects::
4998
4999
5000File: gdb.info,  Node: GDB/MI Command Syntax,  Next: GDB/MI Compatibility with CLI,  Up: GDB/MI
5001
5002GDB/MI Command Syntax
5003=====================
5004
5005* Menu:
5006
5007* GDB/MI Input Syntax::
5008* GDB/MI Output Syntax::
5009* GDB/MI Simple Examples::
5010
5011
5012File: gdb.info,  Node: GDB/MI Input Syntax,  Next: GDB/MI Output Syntax,  Up: GDB/MI Command Syntax
5013
5014GDB/MI Input Syntax
5015-------------------
5016
5017`COMMAND ==>'
5018     `CLI-COMMAND | MI-COMMAND'
5019
5020`CLI-COMMAND ==>'
5021     `[ TOKEN ] CLI-COMMAND NL', where CLI-COMMAND is any existing GDB
5022     CLI command.
5023
5024`MI-COMMAND ==>'
5025     `[ TOKEN ] "-" OPERATION ( " " OPTION )* `[' " --" `]' ( " "
5026     PARAMETER )* NL'
5027
5028`TOKEN ==>'
5029     "any sequence of digits"
5030
5031`OPTION ==>'
5032     `"-" PARAMETER [ " " PARAMETER ]'
5033
5034`PARAMETER ==>'
5035     `NON-BLANK-SEQUENCE | C-STRING'
5036
5037`OPERATION ==>'
5038     _any of the operations described in this chapter_
5039
5040`NON-BLANK-SEQUENCE ==>'
5041     _anything, provided it doesn't contain special characters such as
5042     "-", NL, """ and of course " "_
5043
5044`C-STRING ==>'
5045     `""" SEVEN-BIT-ISO-C-STRING-CONTENT """'
5046
5047`NL ==>'
5048     `CR | CR-LF'
5049
5050Notes:
5051
5052   * The CLI commands are still handled by the MI interpreter; their
5053     output is described below.
5054
5055   * The `TOKEN', when present, is passed back when the command
5056     finishes.
5057
5058   * Some MI commands accept optional arguments as part of the parameter
5059     list.  Each option is identified by a leading `-' (dash) and may be
5060     followed by an optional argument parameter.  Options occur first
5061     in the parameter list and can be delimited from normal parameters
5062     using `--' (this is useful when some parameters begin with a dash).
5063
5064   Pragmatics:
5065
5066   * We want easy access to the existing CLI syntax (for debugging).
5067
5068   * We want it to be easy to spot a MI operation.
5069
5070
5071File: gdb.info,  Node: GDB/MI Output Syntax,  Next: GDB/MI Simple Examples,  Prev: GDB/MI Input Syntax,  Up: GDB/MI Command Syntax
5072
5073GDB/MI Output Syntax
5074--------------------
5075
5076The output from GDB/MI consists of zero or more out-of-band records
5077followed, optionally, by a single result record.  This result record is
5078for the most recent command.  The sequence of output records is
5079terminated by `(gdb)'.
5080
5081   If an input command was prefixed with a `TOKEN' then the
5082corresponding output for that command will also be prefixed by that same
5083TOKEN.
5084
5085`OUTPUT ==>'
5086     `( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
5087
5088`RESULT-RECORD ==>'
5089     ` [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
5090
5091`OUT-OF-BAND-RECORD ==>'
5092     `ASYNC-RECORD | STREAM-RECORD'
5093
5094`ASYNC-RECORD ==>'
5095     `EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
5096
5097`EXEC-ASYNC-OUTPUT ==>'
5098     `[ TOKEN ] "*" ASYNC-OUTPUT'
5099
5100`STATUS-ASYNC-OUTPUT ==>'
5101     `[ TOKEN ] "+" ASYNC-OUTPUT'
5102
5103`NOTIFY-ASYNC-OUTPUT ==>'
5104     `[ TOKEN ] "=" ASYNC-OUTPUT'
5105
5106`ASYNC-OUTPUT ==>'
5107     `ASYNC-CLASS ( "," RESULT )* NL'
5108
5109`RESULT-CLASS ==>'
5110     `"done" | "running" | "connected" | "error" | "exit"'
5111
5112`ASYNC-CLASS ==>'
5113     `"stopped" | OTHERS' (where OTHERS will be added depending on the
5114     needs--this is still in development).
5115
5116`RESULT ==>'
5117     ` VARIABLE "=" VALUE'
5118
5119`VARIABLE ==>'
5120     ` STRING '
5121
5122`VALUE ==>'
5123     ` CONST | TUPLE | LIST '
5124
5125`CONST ==>'
5126     `C-STRING'
5127
5128`TUPLE ==>'
5129     ` "{}" | "{" RESULT ( "," RESULT )* "}" '
5130
5131`LIST ==>'
5132     ` "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )*
5133     "]" '
5134
5135`STREAM-RECORD ==>'
5136     `CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
5137
5138`CONSOLE-STREAM-OUTPUT ==>'
5139     `"~" C-STRING'
5140
5141`TARGET-STREAM-OUTPUT ==>'
5142     `"@" C-STRING'
5143
5144`LOG-STREAM-OUTPUT ==>'
5145     `"&" C-STRING'
5146
5147`NL ==>'
5148     `CR | CR-LF'
5149
5150`TOKEN ==>'
5151     _any sequence of digits_.
5152
5153Notes:
5154
5155   * All output sequences end in a single line containing a period.
5156
5157   * The `TOKEN' is from the corresponding request.  If an execution
5158     command is interrupted by the `-exec-interrupt' command, the TOKEN
5159     associated with the `*stopped' message is the one of the original
5160     execution command, not the one of the interrupt command.
5161
5162   * STATUS-ASYNC-OUTPUT contains on-going status information about the
5163     progress of a slow operation.  It can be discarded.  All status
5164     output is prefixed by `+'.
5165
5166   * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
5167     (stopped, started, disappeared).  All async output is prefixed by
5168     `*'.
5169
5170   * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
5171     client should handle (e.g., a new breakpoint information).  All
5172     notify output is prefixed by `='.
5173
5174   * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
5175     the console.  It is the textual response to a CLI command.  All
5176     the console output is prefixed by `~'.
5177
5178   * TARGET-STREAM-OUTPUT is the output produced by the target program.
5179     All the target output is prefixed by `@'.
5180
5181   * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
5182     instance messages that should be displayed as part of an error
5183     log.  All the log output is prefixed by `&'.
5184
5185   * New GDB/MI commands should only output LISTS containing VALUES.
5186
5187
5188   *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
5189about the various output records.
5190
5191
5192File: gdb.info,  Node: GDB/MI Simple Examples,  Prev: GDB/MI Output Syntax,  Up: GDB/MI Command Syntax
5193
5194Simple Examples of GDB/MI Interaction
5195-------------------------------------
5196
5197This subsection presents several simple examples of interaction using
5198the GDB/MI interface.  In these examples, `->' means that the following
5199line is passed to GDB/MI as input, while `<-' means the output received
5200from GDB/MI.
5201
5202Target Stop
5203...........
5204
5205Here's an example of stopping the inferior process:
5206
5207     -> -stop
5208     <- (gdb)
5209
5210and later:
5211
5212     <- *stop,reason="stop",address="0x123",source="a.c:123"
5213     <- (gdb)
5214
5215Simple CLI Command
5216..................
5217
5218Here's an example of a simple CLI command being passed through GDB/MI
5219and on to the CLI.
5220
5221     -> print 1+2
5222     <- &"print 1+2\n"
5223     <- ~"$1 = 3\n"
5224     <- ^done
5225     <- (gdb)
5226
5227Command With Side Effects
5228.........................
5229
5230     -> -symbol-file xyz.exe
5231     <- *breakpoint,nr="3",address="0x123",source="a.c:123"
5232     <- (gdb)
5233
5234A Bad Command
5235.............
5236
5237Here's what happens if you pass a non-existent command:
5238
5239     -> -rubbish
5240     <- ^error,msg="Undefined MI command: rubbish"
5241     <- (gdb)
5242
5243
5244File: gdb.info,  Node: GDB/MI Compatibility with CLI,  Next: GDB/MI Output Records,  Prev: GDB/MI Command Syntax,  Up: GDB/MI
5245
5246GDB/MI Compatibility with CLI
5247=============================
5248
5249To help users familiar with GDB's existing CLI interface, GDB/MI
5250accepts existing CLI commands.  As specified by the syntax, such
5251commands can be directly entered into the GDB/MI interface and GDB will
5252respond.
5253
5254   This mechanism is provided as an aid to developers of GDB/MI clients
5255and not as a reliable interface into the CLI.  Since the command is
5256being interpreteted in an environment that assumes GDB/MI behaviour,
5257the exact output of such commands is likely to end up being an
5258un-supported hybrid of GDB/MI and CLI output.
5259
5260
5261File: gdb.info,  Node: GDB/MI Output Records,  Next: GDB/MI Command Description Format,  Prev: GDB/MI Compatibility with CLI,  Up: GDB/MI
5262
5263GDB/MI Output Records
5264=====================
5265
5266* Menu:
5267
5268* GDB/MI Result Records::
5269* GDB/MI Stream Records::
5270* GDB/MI Out-of-band Records::
5271
5272
5273File: gdb.info,  Node: GDB/MI Result Records,  Next: GDB/MI Stream Records,  Up: GDB/MI Output Records
5274
5275GDB/MI Result Records
5276---------------------
5277
5278In addition to a number of out-of-band notifications, the response to a
5279GDB/MI command includes one of the following result indications:
5280
5281`"^done" [ "," RESULTS ]'
5282     The synchronous operation was successful, `RESULTS' are the return
5283     values.
5284
5285`"^running"'
5286     The asynchronous operation was successfully started.  The target is
5287     running.
5288
5289`"^error" "," C-STRING'
5290     The operation failed.  The `C-STRING' contains the corresponding
5291     error message.
5292
5293
5294File: gdb.info,  Node: GDB/MI Stream Records,  Next: GDB/MI Out-of-band Records,  Prev: GDB/MI Result Records,  Up: GDB/MI Output Records
5295
5296GDB/MI Stream Records
5297---------------------
5298
5299GDB internally maintains a number of output streams: the console, the
5300target, and the log.  The output intended for each of these streams is
5301funneled through the GDB/MI interface using "stream records".
5302
5303   Each stream record begins with a unique "prefix character" which
5304identifies its stream (*note GDB/MI Output Syntax: GDB/MI Output
5305Syntax.).  In addition to the prefix, each stream record contains a
5306`STRING-OUTPUT'.  This is either raw text (with an implicit new line)
5307or a quoted C string (which does not contain an implicit newline).
5308
5309`"~" STRING-OUTPUT'
5310     The console output stream contains text that should be displayed
5311     in the CLI console window.  It contains the textual responses to
5312     CLI commands.
5313
5314`"@" STRING-OUTPUT'
5315     The target output stream contains any textual output from the
5316     running target.
5317
5318`"&" STRING-OUTPUT'
5319     The log stream contains debugging messages being produced by GDB's
5320     internals.
5321
5322
5323File: gdb.info,  Node: GDB/MI Out-of-band Records,  Prev: GDB/MI Stream Records,  Up: GDB/MI Output Records
5324
5325GDB/MI Out-of-band Records
5326--------------------------
5327
5328"Out-of-band" records are used to notify the GDB/MI client of
5329additional changes that have occurred.  Those changes can either be a
5330consequence of GDB/MI (e.g., a breakpoint modified) or a result of
5331target activity (e.g., target stopped).
5332
5333   The following is a preliminary list of possible out-of-band records.
5334
5335`"*" "stop"'
5336
5337
5338File: gdb.info,  Node: GDB/MI Command Description Format,  Next: GDB/MI Breakpoint Table Commands,  Prev: GDB/MI Output Records,  Up: GDB/MI
5339
5340GDB/MI Command Description Format
5341=================================
5342
5343The remaining sections describe blocks of commands.  Each block of
5344commands is laid out in a fashion similar to this section.
5345
5346   Note the the line breaks shown in the examples are here only for
5347readability.  They don't appear in the real output.  Also note that the
5348commands with a non-available example (N.A.) are not yet implemented.
5349
5350Motivation
5351----------
5352
5353The motivation for this collection of commands.
5354
5355Introduction
5356------------
5357
5358A brief introduction to this collection of commands as a whole.
5359
5360Commands
5361--------
5362
5363For each command in the block, the following is described:
5364
5365Synopsis
5366........
5367
5368      -command ARGS...
5369
5370GDB Command
5371...........
5372
5373The corresponding GDB CLI command.
5374
5375Result
5376......
5377
5378Out-of-band
5379...........
5380
5381Notes
5382.....
5383
5384Example
5385.......
5386
5387
5388File: gdb.info,  Node: GDB/MI Breakpoint Table Commands,  Next: GDB/MI Data Manipulation,  Prev: GDB/MI Command Description Format,  Up: GDB/MI
5389
5390GDB/MI Breakpoint table commands
5391================================
5392
5393This section documents GDB/MI commands for manipulating breakpoints.
5394
5395The `-break-after' Command
5396--------------------------
5397
5398Synopsis
5399........
5400
5401      -break-after NUMBER COUNT
5402
5403   The breakpoint number NUMBER is not in effect until it has been hit
5404COUNT times.  To see how this is reflected in the output of the
5405`-break-list' command, see the description of the `-break-list' command
5406below.
5407
5408GDB Command
5409...........
5410
5411The corresponding GDB command is `ignore'.
5412
5413Example
5414.......
5415
5416     (gdb)
5417     -break-insert main
5418     ^done,bkpt={number="1",addr="0x000100d0",file="hello.c",line="5"}
5419     (gdb)
5420     -break-after 1 3
5421     ~
5422     ^done
5423     (gdb)
5424     -break-list
5425     ^done,BreakpointTable={nr_rows="1",nr_cols="6",
5426     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5427     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5428     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5429     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5430     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5431     {width="40",alignment="2",col_name="what",colhdr="What"}],
5432     body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5433     addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
5434     ignore="3"}]}
5435     (gdb)
5436
5437The `-break-condition' Command
5438------------------------------
5439
5440Synopsis
5441........
5442
5443      -break-condition NUMBER EXPR
5444
5445   Breakpoint NUMBER will stop the program only if the condition in
5446EXPR is true.  The condition becomes part of the `-break-list' output
5447(see the description of the `-break-list' command below).
5448
5449GDB Command
5450...........
5451
5452The corresponding GDB command is `condition'.
5453
5454Example
5455.......
5456
5457     (gdb)
5458     -break-condition 1 1
5459     ^done
5460     (gdb)
5461     -break-list
5462     ^done,BreakpointTable={nr_rows="1",nr_cols="6",
5463     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5464     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5465     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5466     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5467     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5468     {width="40",alignment="2",col_name="what",colhdr="What"}],
5469     body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5470     addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
5471     times="0",ignore="3"}]}
5472     (gdb)
5473
5474The `-break-delete' Command
5475---------------------------
5476
5477Synopsis
5478........
5479
5480      -break-delete ( BREAKPOINT )+
5481
5482   Delete the breakpoint(s) whose number(s) are specified in the
5483argument list.  This is obviously reflected in the breakpoint list.
5484
5485GDB command
5486...........
5487
5488The corresponding GDB command is `delete'.
5489
5490Example
5491.......
5492
5493     (gdb)
5494     -break-delete 1
5495     ^done
5496     (gdb)
5497     -break-list
5498     ^done,BreakpointTable={nr_rows="0",nr_cols="6",
5499     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5500     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5501     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5502     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5503     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5504     {width="40",alignment="2",col_name="what",colhdr="What"}],
5505     body=[]}
5506     (gdb)
5507
5508The `-break-disable' Command
5509----------------------------
5510
5511Synopsis
5512........
5513
5514      -break-disable ( BREAKPOINT )+
5515
5516   Disable the named BREAKPOINT(s).  The field `enabled' in the break
5517list is now set to `n' for the named BREAKPOINT(s).
5518
5519GDB Command
5520...........
5521
5522The corresponding GDB command is `disable'.
5523
5524Example
5525.......
5526
5527     (gdb)
5528     -break-disable 2
5529     ^done
5530     (gdb)
5531     -break-list
5532     ^done,BreakpointTable={nr_rows="1",nr_cols="6",
5533     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5534     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5535     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5536     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5537     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5538     {width="40",alignment="2",col_name="what",colhdr="What"}],
5539     body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="n",
5540     addr="0x000100d0",func="main",file="hello.c",line="5",times="0"}]}
5541     (gdb)
5542
5543The `-break-enable' Command
5544---------------------------
5545
5546Synopsis
5547........
5548
5549      -break-enable ( BREAKPOINT )+
5550
5551   Enable (previously disabled) BREAKPOINT(s).
5552
5553GDB Command
5554...........
5555
5556The corresponding GDB command is `enable'.
5557
5558Example
5559.......
5560
5561     (gdb)
5562     -break-enable 2
5563     ^done
5564     (gdb)
5565     -break-list
5566     ^done,BreakpointTable={nr_rows="1",nr_cols="6",
5567     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5568     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5569     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5570     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5571     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5572     {width="40",alignment="2",col_name="what",colhdr="What"}],
5573     body=[bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
5574     addr="0x000100d0",func="main",file="hello.c",line="5",times="0"}]}
5575     (gdb)
5576
5577The `-break-info' Command
5578-------------------------
5579
5580Synopsis
5581........
5582
5583      -break-info BREAKPOINT
5584
5585   Get information about a single breakpoint.
5586
5587GDB command
5588...........
5589
5590The corresponding GDB command is `info break BREAKPOINT'.
5591
5592Example
5593.......
5594
5595N.A.
5596
5597The `-break-insert' Command
5598---------------------------
5599
5600Synopsis
5601........
5602
5603      -break-insert [ -t ] [ -h ] [ -r ]
5604         [ -c CONDITION ] [ -i IGNORE-COUNT ]
5605         [ -p THREAD ] [ LINE | ADDR ]
5606
5607If specified, LINE, can be one of:
5608
5609   * function
5610
5611   * filename:linenum
5612
5613   * filename:function
5614
5615   * *address
5616
5617   The possible optional parameters of this command are:
5618
5619`-t'
5620     Insert a tempoary breakpoint.
5621
5622`-h'
5623     Insert a hardware breakpoint.
5624
5625`-c CONDITION'
5626     Make the breakpoint conditional on CONDITION.
5627
5628`-i IGNORE-COUNT'
5629     Initialize the IGNORE-COUNT.
5630
5631`-r'
5632     Insert a regular breakpoint in all the functions whose names match
5633     the given regular expression.  Other flags are not applicable to
5634     regular expresson.
5635
5636Result
5637......
5638
5639The result is in the form:
5640
5641      ^done,bkptno="NUMBER",func="FUNCNAME",
5642       file="FILENAME",line="LINENO"
5643
5644where NUMBER is the GDB number for this breakpoint, FUNCNAME is the
5645name of the function where the breakpoint was inserted, FILENAME is the
5646name of the source file which contains this function, and LINENO is the
5647source line number within that file.
5648
5649   Note: this format is open to change.
5650
5651GDB Command
5652...........
5653
5654The corresponding GDB commands are `break', `tbreak', `hbreak',
5655`thbreak', and `rbreak'.
5656
5657Example
5658.......
5659
5660     (gdb)
5661     -break-insert main
5662     ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
5663     (gdb)
5664     -break-insert -t foo
5665     ^done,bkpt={number="2",addr="0x00010774",file="recursive2.c",line="11"}
5666     (gdb)
5667     -break-list
5668     ^done,BreakpointTable={nr_rows="2",nr_cols="6",
5669     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5670     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5671     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5672     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5673     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5674     {width="40",alignment="2",col_name="what",colhdr="What"}],
5675     body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5676     addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"},
5677     bkpt={number="2",type="breakpoint",disp="del",enabled="y",
5678     addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"}]}
5679     (gdb)
5680     -break-insert -r foo.*
5681     ~int foo(int, int);
5682     ^done,bkpt={number="3",addr="0x00010774",file="recursive2.c",line="11"}
5683     (gdb)
5684
5685The `-break-list' Command
5686-------------------------
5687
5688Synopsis
5689........
5690
5691      -break-list
5692
5693   Displays the list of inserted breakpoints, showing the following
5694fields:
5695
5696`Number'
5697     number of the breakpoint
5698
5699`Type'
5700     type of the breakpoint: `breakpoint' or `watchpoint'
5701
5702`Disposition'
5703     should the breakpoint be deleted or disabled when it is hit: `keep'
5704     or `nokeep'
5705
5706`Enabled'
5707     is the breakpoint enabled or no: `y' or `n'
5708
5709`Address'
5710     memory location at which the breakpoint is set
5711
5712`What'
5713     logical location of the breakpoint, expressed by function name,
5714     file name, line number
5715
5716`Times'
5717     number of times the breakpoint has been hit
5718
5719   If there are no breakpoints or watchpoints, the `BreakpointTable'
5720`body' field is an empty list.
5721
5722GDB Command
5723...........
5724
5725The corresponding GDB command is `info break'.
5726
5727Example
5728.......
5729
5730     (gdb)
5731     -break-list
5732     ^done,BreakpointTable={nr_rows="2",nr_cols="6",
5733     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5734     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5735     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5736     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5737     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5738     {width="40",alignment="2",col_name="what",colhdr="What"}],
5739     body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5740     addr="0x000100d0",func="main",file="hello.c",line="5",times="0"},
5741     bkpt={number="2",type="breakpoint",disp="keep",enabled="y",
5742     addr="0x00010114",func="foo",file="hello.c",line="13",times="0"}]}
5743     (gdb)
5744
5745   Here's an example of the result when there are no breakpoints:
5746
5747     (gdb)
5748     -break-list
5749     ^done,BreakpointTable={nr_rows="0",nr_cols="6",
5750     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5751     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5752     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5753     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5754     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5755     {width="40",alignment="2",col_name="what",colhdr="What"}],
5756     body=[]}
5757     (gdb)
5758
5759The `-break-watch' Command
5760--------------------------
5761
5762Synopsis
5763........
5764
5765      -break-watch [ -a | -r ]
5766
5767   Create a watchpoint.  With the `-a' option it will create an
5768"access" watchpoint, i.e. a watchpoint that triggers either on a read
5769from or on a write to the memory location.  With the `-r' option, the
5770watchpoint created is a "read" watchpoint, i.e. it will trigger only
5771when the memory location is accessed for reading.  Without either of
5772the options, the watchpoint created is a regular watchpoint, i.e. it
5773will trigger when the memory location is accessed for writing.  *Note
5774Setting watchpoints: Set Watchpoints.
5775
5776   Note that `-break-list' will report a single list of watchpoints and
5777breakpoints inserted.
5778
5779GDB Command
5780...........
5781
5782The corresponding GDB commands are `watch', `awatch', and `rwatch'.
5783
5784Example
5785.......
5786
5787Setting a watchpoint on a variable in the `main' function:
5788
5789     (gdb)
5790     -break-watch x
5791     ^done,wpt={number="2",exp="x"}
5792     (gdb)
5793     -exec-continue
5794     ^running
5795     ^done,reason="watchpoint-trigger",wpt={number="2",exp="x"},
5796     value={old="-268439212",new="55"},
5797     frame={func="main",args=[],file="recursive2.c",line="5"}
5798     (gdb)
5799
5800   Setting a watchpoint on a variable local to a function.  GDB will
5801stop the program execution twice: first for the variable changing
5802value, then for the watchpoint going out of scope.
5803
5804     (gdb)
5805     -break-watch C
5806     ^done,wpt={number="5",exp="C"}
5807     (gdb)
5808     -exec-continue
5809     ^running
5810     ^done,reason="watchpoint-trigger",
5811     wpt={number="5",exp="C"},value={old="-276895068",new="3"},
5812     frame={func="callee4",args=[],
5813     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
5814     (gdb)
5815     -exec-continue
5816     ^running
5817     ^done,reason="watchpoint-scope",wpnum="5",
5818     frame={func="callee3",args=[{name="strarg",
5819     value="0x11940 \"A string argument.\""}],
5820     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
5821     (gdb)
5822
5823   Listing breakpoints and watchpoints, at different points in the
5824program execution.  Note that once the watchpoint goes out of scope, it
5825is deleted.
5826
5827     (gdb)
5828     -break-watch C
5829     ^done,wpt={number="2",exp="C"}
5830     (gdb)
5831     -break-list
5832     ^done,BreakpointTable={nr_rows="2",nr_cols="6",
5833     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5834     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5835     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5836     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5837     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5838     {width="40",alignment="2",col_name="what",colhdr="What"}],
5839     body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5840     addr="0x00010734",func="callee4",
5841     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"},
5842     bkpt={number="2",type="watchpoint",disp="keep",
5843     enabled="y",addr="",what="C",times="0"}]}
5844     (gdb)
5845     -exec-continue
5846     ^running
5847     ^done,reason="watchpoint-trigger",wpt={number="2",exp="C"},
5848     value={old="-276895068",new="3"},
5849     frame={func="callee4",args=[],
5850     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"}
5851     (gdb)
5852     -break-list
5853     ^done,BreakpointTable={nr_rows="2",nr_cols="6",
5854     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5855     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5856     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5857     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5858     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5859     {width="40",alignment="2",col_name="what",colhdr="What"}],
5860     body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5861     addr="0x00010734",func="callee4",
5862     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"},
5863     bkpt={number="2",type="watchpoint",disp="keep",
5864     enabled="y",addr="",what="C",times="-5"}]}
5865     (gdb)
5866     -exec-continue
5867     ^running
5868     ^done,reason="watchpoint-scope",wpnum="2",
5869     frame={func="callee3",args=[{name="strarg",
5870     value="0x11940 \"A string argument.\""}],
5871     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
5872     (gdb)
5873     -break-list
5874     ^done,BreakpointTable={nr_rows="1",nr_cols="6",
5875     hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},
5876     {width="14",alignment="-1",col_name="type",colhdr="Type"},
5877     {width="4",alignment="-1",col_name="disp",colhdr="Disp"},
5878     {width="3",alignment="-1",col_name="enabled",colhdr="Enb"},
5879     {width="10",alignment="-1",col_name="addr",colhdr="Address"},
5880     {width="40",alignment="2",col_name="what",colhdr="What"}],
5881     body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
5882     addr="0x00010734",func="callee4",
5883     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"}]}
5884     (gdb)
5885
5886
5887File: gdb.info,  Node: GDB/MI Data Manipulation,  Next: GDB/MI Program Control,  Prev: GDB/MI Breakpoint Table Commands,  Up: GDB/MI
5888
5889GDB/MI Data Manipulation
5890========================
5891
5892This section describes the GDB/MI commands that manipulate data:
5893examine memory and registers, evaluate expressions, etc.
5894
5895The `-data-disassemble' Command
5896-------------------------------
5897
5898Synopsis
5899........
5900
5901      -data-disassemble
5902         [ -s START-ADDR -e END-ADDR ]
5903       | [ -f FILENAME -l LINENUM [ -n LINES ] ]
5904       -- MODE
5905
5906Where:
5907
5908`START-ADDR'
5909     is the beginning address (or `$pc')
5910
5911`END-ADDR'
5912     is the end address
5913
5914`FILENAME'
5915     is the name of the file to disassemble
5916
5917`LINENUM'
5918     is the line number to disassemble around
5919
5920`LINES'
5921     is the the number of disassembly lines to be produced.  If it is
5922     -1, the whole function will be disassembled, in case no END-ADDR is
5923     specified.  If END-ADDR is specified as a non-zero value, and
5924     LINES is lower than the number of disassembly lines between
5925     START-ADDR and END-ADDR, only LINES lines are displayed; if LINES
5926     is higher than the number of lines between START-ADDR and
5927     END-ADDR, only the lines up to END-ADDR are displayed.
5928
5929`MODE'
5930     is either 0 (meaning only disassembly) or 1 (meaning mixed source
5931     and disassembly).
5932
5933Result
5934......
5935
5936The output for each instruction is composed of four fields:
5937
5938   * Address
5939
5940   * Func-name
5941
5942   * Offset
5943
5944   * Instruction
5945
5946   Note that whatever included in the instruction field, is not
5947manipulated directely by GDB/MI, i.e. it is not possible to adjust its
5948format.
5949
5950GDB Command
5951...........
5952
5953There's no direct mapping from this command to the CLI.
5954
5955Example
5956.......
5957
5958Disassemble from the current value of `$pc' to `$pc + 20':
5959
5960     (gdb)
5961     -data-disassemble -s $pc -e "$pc + 20" -- 0
5962     ^done,
5963     asm_insns=[
5964     {address="0x000107c0",func-name="main",offset="4",
5965     inst="mov  2, %o0"},
5966     {address="0x000107c4",func-name="main",offset="8",
5967     inst="sethi  %hi(0x11800), %o2"},
5968     {address="0x000107c8",func-name="main",offset="12",
5969     inst="or  %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"},
5970     {address="0x000107cc",func-name="main",offset="16",
5971     inst="sethi  %hi(0x11800), %o2"},
5972     {address="0x000107d0",func-name="main",offset="20",
5973     inst="or  %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"}]
5974     (gdb)
5975
5976   Disassemble the whole `main' function.  Line 32 is part of `main'.
5977
5978     -data-disassemble -f basics.c -l 32 -- 0
5979     ^done,asm_insns=[
5980     {address="0x000107bc",func-name="main",offset="0",
5981     inst="save  %sp, -112, %sp"},
5982     {address="0x000107c0",func-name="main",offset="4",
5983     inst="mov   2, %o0"},
5984     {address="0x000107c4",func-name="main",offset="8",
5985     inst="sethi %hi(0x11800), %o2"},
5986     [...]
5987     {address="0x0001081c",func-name="main",offset="96",inst="ret "},
5988     {address="0x00010820",func-name="main",offset="100",inst="restore "}]
5989     (gdb)
5990
5991   Disassemble 3 instructions from the start of `main':
5992
5993     (gdb)
5994     -data-disassemble -f basics.c -l 32 -n 3 -- 0
5995     ^done,asm_insns=[
5996     {address="0x000107bc",func-name="main",offset="0",
5997     inst="save  %sp, -112, %sp"},
5998     {address="0x000107c0",func-name="main",offset="4",
5999     inst="mov  2, %o0"},
6000     {address="0x000107c4",func-name="main",offset="8",
6001     inst="sethi  %hi(0x11800), %o2"}]
6002     (gdb)
6003
6004   Disassemble 3 instructions from the start of `main' in mixed mode:
6005
6006     (gdb)
6007     -data-disassemble -f basics.c -l 32 -n 3 -- 1
6008     ^done,asm_insns=[
6009     src_and_asm_line={line="31",
6010     file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
6011       testsuite/gdb.mi/basics.c",line_asm_insn=[
6012     {address="0x000107bc",func-name="main",offset="0",
6013     inst="save  %sp, -112, %sp"}]},
6014     src_and_asm_line={line="32",
6015     file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
6016       testsuite/gdb.mi/basics.c",line_asm_insn=[
6017     {address="0x000107c0",func-name="main",offset="4",
6018     inst="mov  2, %o0"},
6019     {address="0x000107c4",func-name="main",offset="8",
6020     inst="sethi  %hi(0x11800), %o2"}]}]
6021     (gdb)
6022
6023The `-data-evaluate-expression' Command
6024---------------------------------------
6025
6026Synopsis
6027........
6028
6029      -data-evaluate-expression EXPR
6030
6031   Evaluate EXPR as an expression.  The expression could contain an
6032inferior function call.  The function call will execute synchronously.
6033If the expression contains spaces, it must be enclosed in double quotes.
6034
6035GDB Command
6036...........
6037
6038The corresponding GDB commands are `print', `output', and `call'.  In
6039`gdbtk' only, there's a corresponding `gdb_eval' command.
6040
6041Example
6042.......
6043
6044In the following example, the numbers that precede the commands are the
6045"tokens" described in *Note GDB/MI Command Syntax: GDB/MI Command
6046Syntax.  Notice how GDB/MI returns the same tokens in its output.
6047
6048     211-data-evaluate-expression A
6049     211^done,value="1"
6050     (gdb)
6051     311-data-evaluate-expression &A
6052     311^done,value="0xefffeb7c"
6053     (gdb)
6054     411-data-evaluate-expression A+3
6055     411^done,value="4"
6056     (gdb)
6057     511-data-evaluate-expression "A + 3"
6058     511^done,value="4"
6059     (gdb)
6060
6061The `-data-list-changed-registers' Command
6062------------------------------------------
6063
6064Synopsis
6065........
6066
6067      -data-list-changed-registers
6068
6069   Display a list of the registers that have changed.
6070
6071GDB Command
6072...........
6073
6074GDB doesn't have a direct analog for this command; `gdbtk' has the
6075corresponding command `gdb_changed_register_list'.
6076
6077Example
6078.......
6079
6080On a PPC MBX board:
6081
6082     (gdb)
6083     -exec-continue
6084     ^running
6085
6086     (gdb)
6087     *stopped,reason="breakpoint-hit",bkptno="1",frame={func="main",
6088     args=[],file="try.c",line="5"}
6089     (gdb)
6090     -data-list-changed-registers
6091     ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
6092     "10","11","13","14","15","16","17","18","19","20","21","22","23",
6093     "24","25","26","27","28","30","31","64","65","66","67","69"]
6094     (gdb)
6095
6096The `-data-list-register-names' Command
6097---------------------------------------
6098
6099Synopsis
6100........
6101
6102      -data-list-register-names [ ( REGNO )+ ]
6103
6104   Show a list of register names for the current target.  If no
6105arguments are given, it shows a list of the names of all the registers.
6106If integer numbers are given as arguments, it will print a list of the
6107names of the registers corresponding to the arguments.  To ensure
6108consistency between a register name and its number, the output list may
6109include empty register names.
6110
6111GDB Command
6112...........
6113
6114GDB does not have a command which corresponds to
6115`-data-list-register-names'.  In `gdbtk' there is a corresponding
6116command `gdb_regnames'.
6117
6118Example
6119.......
6120
6121For the PPC MBX board:
6122     (gdb)
6123     -data-list-register-names
6124     ^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
6125     "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
6126     "r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
6127     "r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
6128     "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
6129     "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
6130     "", "pc","ps","cr","lr","ctr","xer"]
6131     (gdb)
6132     -data-list-register-names 1 2 3
6133     ^done,register-names=["r1","r2","r3"]
6134     (gdb)
6135
6136The `-data-list-register-values' Command
6137----------------------------------------
6138
6139Synopsis
6140........
6141
6142      -data-list-register-values FMT [ ( REGNO )*]
6143
6144   Display the registers' contents.  FMT is the format according to
6145which the registers' contents are to be returned, followed by an
6146optional list of numbers specifying the registers to display.  A
6147missing list of numbers indicates that the contents of all the
6148registers must be returned.
6149
6150   Allowed formats for FMT are:
6151
6152`x'
6153     Hexadecimal
6154
6155`o'
6156     Octal
6157
6158`t'
6159     Binary
6160
6161`d'
6162     Decimal
6163
6164`r'
6165     Raw
6166
6167`N'
6168     Natural
6169
6170GDB Command
6171...........
6172
6173The corresponding GDB commands are `info reg', `info all-reg', and (in
6174`gdbtk') `gdb_fetch_registers'.
6175
6176Example
6177.......
6178
6179For a PPC MBX board (note: line breaks are for readability only, they
6180don't appear in the actual output):
6181
6182     (gdb)
6183     -data-list-register-values r 64 65
6184     ^done,register-values=[{number="64",value="0xfe00a300"},
6185     {number="65",value="0x00029002"}]
6186     (gdb)
6187     -data-list-register-values x
6188     ^done,register-values=[{number="0",value="0xfe0043c8"},
6189     {number="1",value="0x3fff88"},{number="2",value="0xfffffffe"},
6190     {number="3",value="0x0"},{number="4",value="0xa"},
6191     {number="5",value="0x3fff68"},{number="6",value="0x3fff58"},
6192     {number="7",value="0xfe011e98"},{number="8",value="0x2"},
6193     {number="9",value="0xfa202820"},{number="10",value="0xfa202808"},
6194     {number="11",value="0x1"},{number="12",value="0x0"},
6195     {number="13",value="0x4544"},{number="14",value="0xffdfffff"},
6196     {number="15",value="0xffffffff"},{number="16",value="0xfffffeff"},
6197     {number="17",value="0xefffffed"},{number="18",value="0xfffffffe"},
6198     {number="19",value="0xffffffff"},{number="20",value="0xffffffff"},
6199     {number="21",value="0xffffffff"},{number="22",value="0xfffffff7"},
6200     {number="23",value="0xffffffff"},{number="24",value="0xffffffff"},
6201     {number="25",value="0xffffffff"},{number="26",value="0xfffffffb"},
6202     {number="27",value="0xffffffff"},{number="28",value="0xf7bfffff"},
6203     {number="29",value="0x0"},{number="30",value="0xfe010000"},
6204     {number="31",value="0x0"},{number="32",value="0x0"},
6205     {number="33",value="0x0"},{number="34",value="0x0"},
6206     {number="35",value="0x0"},{number="36",value="0x0"},
6207     {number="37",value="0x0"},{number="38",value="0x0"},
6208     {number="39",value="0x0"},{number="40",value="0x0"},
6209     {number="41",value="0x0"},{number="42",value="0x0"},
6210     {number="43",value="0x0"},{number="44",value="0x0"},
6211     {number="45",value="0x0"},{number="46",value="0x0"},
6212     {number="47",value="0x0"},{number="48",value="0x0"},
6213     {number="49",value="0x0"},{number="50",value="0x0"},
6214     {number="51",value="0x0"},{number="52",value="0x0"},
6215     {number="53",value="0x0"},{number="54",value="0x0"},
6216     {number="55",value="0x0"},{number="56",value="0x0"},
6217     {number="57",value="0x0"},{number="58",value="0x0"},
6218     {number="59",value="0x0"},{number="60",value="0x0"},
6219     {number="61",value="0x0"},{number="62",value="0x0"},
6220     {number="63",value="0x0"},{number="64",value="0xfe00a300"},
6221     {number="65",value="0x29002"},{number="66",value="0x202f04b5"},
6222     {number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
6223     {number="69",value="0x20002b03"}]
6224     (gdb)
6225
6226The `-data-read-memory' Command
6227-------------------------------
6228
6229Synopsis
6230........
6231
6232      -data-read-memory [ -o BYTE-OFFSET ]
6233        ADDRESS WORD-FORMAT WORD-SIZE
6234        NR-ROWS NR-COLS [ ASCHAR ]
6235
6236where:
6237
6238`ADDRESS'
6239     An expression specifying the address of the first memory word to be
6240     read.  Complex expressions containing embedded white space should
6241     be quoted using the C convention.
6242
6243`WORD-FORMAT'
6244     The format to be used to print the memory words.  The notation is
6245     the same as for GDB's `print' command (*note Output formats:
6246     Output Formats.).
6247
6248`WORD-SIZE'
6249     The size of each memory word in bytes.
6250
6251`NR-ROWS'
6252     The number of rows in the output table.
6253
6254`NR-COLS'
6255     The number of columns in the output table.
6256
6257`ASCHAR'
6258     If present, indicates that each row should include an ASCII dump.
6259     The value of ASCHAR is used as a padding character when a byte is
6260     not a member of the printable ASCII character set (printable ASCII
6261     characters are those whose code is between 32 and 126,
6262     inclusively).
6263
6264`BYTE-OFFSET'
6265     An offset to add to the ADDRESS before fetching memory.
6266
6267   This command displays memory contents as a table of NR-ROWS by
6268NR-COLS words, each word being WORD-SIZE bytes.  In total, `NR-ROWS *
6269NR-COLS * WORD-SIZE' bytes are read (returned as `total-bytes').
6270Should less than the requested number of bytes be returned by the
6271target, the missing words are identified using `N/A'.  The number of
6272bytes read from the target is returned in `nr-bytes' and the starting
6273address used to read memory in `addr'.
6274
6275   The address of the next/previous row or page is available in
6276`next-row' and `prev-row', `next-page' and `prev-page'.
6277
6278GDB Command
6279...........
6280
6281The corresponding GDB command is `x'.  `gdbtk' has `gdb_get_mem' memory
6282read command.
6283
6284Example
6285.......
6286
6287Read six bytes of memory starting at `bytes+6' but then offset by `-6'
6288bytes.  Format as three rows of two columns.  One byte per word.
6289Display each word in hex.
6290
6291     (gdb)
6292     9-data-read-memory -o -6 -- bytes+6 x 1 3 2
6293     9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
6294     next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
6295     prev-page="0x0000138a",memory=[
6296     {addr="0x00001390",data=["0x00","0x01"]},
6297     {addr="0x00001392",data=["0x02","0x03"]},
6298     {addr="0x00001394",data=["0x04","0x05"]}]
6299     (gdb)
6300
6301   Read two bytes of memory starting at address `shorts + 64' and
6302display as a single word formatted in decimal.
6303
6304     (gdb)
6305     5-data-read-memory shorts+64 d 2 1 1
6306     5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
6307     next-row="0x00001512",prev-row="0x0000150e",
6308     next-page="0x00001512",prev-page="0x0000150e",memory=[
6309     {addr="0x00001510",data=["128"]}]
6310     (gdb)
6311
6312   Read thirty two bytes of memory starting at `bytes+16' and format as
6313eight rows of four columns.  Include a string encoding with `x' used as
6314the non-printable character.
6315
6316     (gdb)
6317     4-data-read-memory bytes+16 x 1 8 4 x
6318     4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
6319     next-row="0x000013c0",prev-row="0x0000139c",
6320     next-page="0x000013c0",prev-page="0x00001380",memory=[
6321     {addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"},
6322     {addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"},
6323     {addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"},
6324     {addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"},
6325     {addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"},
6326     {addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"},
6327     {addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"},
6328     {addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"}]
6329     (gdb)
6330
6331The `-display-delete' Command
6332-----------------------------
6333
6334Synopsis
6335........
6336
6337      -display-delete NUMBER
6338
6339   Delete the display NUMBER.
6340
6341GDB Command
6342...........
6343
6344The corresponding GDB command is `delete display'.
6345
6346Example
6347.......
6348
6349N.A.
6350
6351The `-display-disable' Command
6352------------------------------
6353
6354Synopsis
6355........
6356
6357      -display-disable NUMBER
6358
6359   Disable display NUMBER.
6360
6361GDB Command
6362...........
6363
6364The corresponding GDB command is `disable display'.
6365
6366Example
6367.......
6368
6369N.A.
6370
6371The `-display-enable' Command
6372-----------------------------
6373
6374Synopsis
6375........
6376
6377      -display-enable NUMBER
6378
6379   Enable display NUMBER.
6380
6381GDB Command
6382...........
6383
6384The corresponding GDB command is `enable display'.
6385
6386Example
6387.......
6388
6389N.A.
6390
6391The `-display-insert' Command
6392-----------------------------
6393
6394Synopsis
6395........
6396
6397      -display-insert EXPRESSION
6398
6399   Display EXPRESSION every time the program stops.
6400
6401GDB Command
6402...........
6403
6404The corresponding GDB command is `display'.
6405
6406Example
6407.......
6408
6409N.A.
6410
6411The `-display-list' Command
6412---------------------------
6413
6414Synopsis
6415........
6416
6417      -display-list
6418
6419   List the displays.  Do not show the current values.
6420
6421GDB Command
6422...........
6423
6424The corresponding GDB command is `info display'.
6425
6426Example
6427.......
6428
6429N.A.
6430
6431The `-environment-cd' Command
6432-----------------------------
6433
6434Synopsis
6435........
6436
6437      -environment-cd PATHDIR
6438
6439   Set GDB's working directory.
6440
6441GDB Command
6442...........
6443
6444The corresponding GDB command is `cd'.
6445
6446Example
6447.......
6448
6449     (gdb)
6450     -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
6451     ^done
6452     (gdb)
6453
6454The `-environment-directory' Command
6455------------------------------------
6456
6457Synopsis
6458........
6459
6460      -environment-directory [ -r ] [ PATHDIR ]+
6461
6462   Add directories PATHDIR to beginning of search path for source files.
6463If the `-r' option is used, the search path is reset to the default
6464search path.  If directories PATHDIR are supplied in addition to the
6465`-r' option, the search path is first reset and then addition occurs as
6466normal.  Multiple directories may be specified, separated by blanks.
6467Specifying multiple directories in a single command results in the
6468directories added to the beginning of the search path in the same order
6469they were presented in the command.  If blanks are needed as part of a
6470directory name, double-quotes should be used around the name.  In the
6471command output, the path will show up separated by the system
6472directory-separator character.  The directory-seperator character must
6473not be used in any directory name.  If no directories are specified,
6474the current search path is displayed.
6475
6476GDB Command
6477...........
6478
6479The corresponding GDB command is `dir'.
6480
6481Example
6482.......
6483
6484     (gdb)
6485     -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
6486     ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
6487     (gdb)
6488     -environment-directory ""
6489     ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
6490     (gdb)
6491     -environment-directory -r /home/jjohnstn/src/gdb /usr/src
6492     ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
6493     (gdb)
6494     -environment-directory -r
6495     ^done,source-path="$cdir:$cwd"
6496     (gdb)
6497
6498The `-environment-path' Command
6499-------------------------------
6500
6501Synopsis
6502........
6503
6504      -environment-path [ -r ] [ PATHDIR ]+
6505
6506   Add directories PATHDIR to beginning of search path for object files.
6507If the `-r' option is used, the search path is reset to the original
6508search path that existed at gdb start-up.  If directories PATHDIR are
6509supplied in addition to the `-r' option, the search path is first reset
6510and then addition occurs as normal.  Multiple directories may be
6511specified, separated by blanks.  Specifying multiple directories in a
6512single command results in the directories added to the beginning of the
6513search path in the same order they were presented in the command.  If
6514blanks are needed as part of a directory name, double-quotes should be
6515used around the name.  In the command output, the path will show up
6516separated by the system directory-separator character.  The
6517directory-seperator character must not be used in any directory name.
6518If no directories are specified, the current path is displayed.
6519
6520GDB Command
6521...........
6522
6523The corresponding GDB command is `path'.
6524
6525Example
6526.......
6527
6528     (gdb)
6529     -environment-path
6530     ^done,path="/usr/bin"
6531     (gdb)
6532     -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
6533     ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
6534     (gdb)
6535     -environment-path -r /usr/local/bin
6536     ^done,path="/usr/local/bin:/usr/bin"
6537     (gdb)
6538
6539The `-environment-pwd' Command
6540------------------------------
6541
6542Synopsis
6543........
6544
6545      -environment-pwd
6546
6547   Show the current working directory.
6548
6549GDB command
6550...........
6551
6552The corresponding GDB command is `pwd'.
6553
6554Example
6555.......
6556
6557     (gdb)
6558     -environment-pwd
6559     ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
6560     (gdb)
6561
6562
6563File: gdb.info,  Node: GDB/MI Program Control,  Next: GDB/MI Miscellaneous Commands,  Prev: GDB/MI Data Manipulation,  Up: GDB/MI
6564
6565GDB/MI Program control
6566======================
6567
6568Program termination
6569...................
6570
6571As a result of execution, the inferior program can run to completion, if
6572it doesn't encounter any breakpoints.  In this case the output will
6573include an exit code, if the program has exited exceptionally.
6574
6575Examples
6576........
6577
6578Program exited normally:
6579
6580     (gdb)
6581     -exec-run
6582     ^running
6583     (gdb)
6584     x = 55
6585     *stopped,reason="exited-normally"
6586     (gdb)
6587
6588Program exited exceptionally:
6589
6590     (gdb)
6591     -exec-run
6592     ^running
6593     (gdb)
6594     x = 55
6595     *stopped,reason="exited",exit-code="01"
6596     (gdb)
6597
6598   Another way the program can terminate is if it receives a signal
6599such as `SIGINT'.  In this case, GDB/MI displays this:
6600
6601     (gdb)
6602     *stopped,reason="exited-signalled",signal-name="SIGINT",
6603     signal-meaning="Interrupt"
6604
6605The `-exec-abort' Command
6606-------------------------
6607
6608Synopsis
6609........
6610
6611      -exec-abort
6612
6613   Kill the inferior running program.
6614
6615GDB Command
6616...........
6617
6618The corresponding GDB command is `kill'.
6619
6620Example
6621.......
6622
6623N.A.
6624
6625The `-exec-arguments' Command
6626-----------------------------
6627
6628Synopsis
6629........
6630
6631      -exec-arguments ARGS
6632
6633   Set the inferior program arguments, to be used in the next
6634`-exec-run'.
6635
6636GDB Command
6637...........
6638
6639The corresponding GDB command is `set args'.
6640
6641Example
6642.......
6643
6644Don't have one around.
6645
6646The `-exec-continue' Command
6647----------------------------
6648
6649Synopsis
6650........
6651
6652      -exec-continue
6653
6654   Asynchronous command.  Resumes the execution of the inferior program
6655until a breakpoint is encountered, or until the inferior exits.
6656
6657GDB Command
6658...........
6659
6660The corresponding GDB corresponding is `continue'.
6661
6662Example
6663.......
6664
6665     -exec-continue
6666     ^running
6667     (gdb)
6668     @Hello world
6669     *stopped,reason="breakpoint-hit",bkptno="2",frame={func="foo",args=[],
6670     file="hello.c",line="13"}
6671     (gdb)
6672
6673The `-exec-finish' Command
6674--------------------------
6675
6676Synopsis
6677........
6678
6679      -exec-finish
6680
6681   Asynchronous command.  Resumes the execution of the inferior program
6682until the current function is exited.  Displays the results returned by
6683the function.
6684
6685GDB Command
6686...........
6687
6688The corresponding GDB command is `finish'.
6689
6690Example
6691.......
6692
6693Function returning `void'.
6694
6695     -exec-finish
6696     ^running
6697     (gdb)
6698     @hello from foo
6699     *stopped,reason="function-finished",frame={func="main",args=[],
6700     file="hello.c",line="7"}
6701     (gdb)
6702
6703   Function returning other than `void'.  The name of the internal GDB
6704variable storing the result is printed, together with the value itself.
6705
6706     -exec-finish
6707     ^running
6708     (gdb)
6709     *stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
6710     args=[{name="a",value="1"],{name="b",value="9"}},
6711     file="recursive2.c",line="14"},
6712     gdb-result-var="$1",return-value="0"
6713     (gdb)
6714
6715The `-exec-interrupt' Command
6716-----------------------------
6717
6718Synopsis
6719........
6720
6721      -exec-interrupt
6722
6723   Asynchronous command.  Interrupts the background execution of the
6724target.  Note how the token associated with the stop message is the one
6725for the execution command that has been interrupted.  The token for the
6726interrupt itself only appears in the `^done' output.  If the user is
6727trying to interrupt a non-running program, an error message will be
6728printed.
6729
6730GDB Command
6731...........
6732
6733The corresponding GDB command is `interrupt'.
6734
6735Example
6736.......
6737
6738     (gdb)
6739     111-exec-continue
6740     111^running
6741
6742     (gdb)
6743     222-exec-interrupt
6744     222^done
6745     (gdb)
6746     111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
6747     frame={addr="0x00010140",func="foo",args=[],file="try.c",line="13"}
6748     (gdb)
6749
6750     (gdb)
6751     -exec-interrupt
6752     ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
6753     (gdb)
6754
6755The `-exec-next' Command
6756------------------------
6757
6758Synopsis
6759........
6760
6761      -exec-next
6762
6763   Asynchronous command.  Resumes execution of the inferior program,
6764stopping when the beginning of the next source line is reached.
6765
6766GDB Command
6767...........
6768
6769The corresponding GDB command is `next'.
6770
6771Example
6772.......
6773
6774     -exec-next
6775     ^running
6776     (gdb)
6777     *stopped,reason="end-stepping-range",line="8",file="hello.c"
6778     (gdb)
6779
6780The `-exec-next-instruction' Command
6781------------------------------------
6782
6783Synopsis
6784........
6785
6786      -exec-next-instruction
6787
6788   Asynchronous command.  Executes one machine instruction.  If the
6789instruction is a function call continues until the function returns.  If
6790the program stops at an instruction in the middle of a source line, the
6791address will be printed as well.
6792
6793GDB Command
6794...........
6795
6796The corresponding GDB command is `nexti'.
6797
6798Example
6799.......
6800
6801     (gdb)
6802     -exec-next-instruction
6803     ^running
6804
6805     (gdb)
6806     *stopped,reason="end-stepping-range",
6807     addr="0x000100d4",line="5",file="hello.c"
6808     (gdb)
6809
6810The `-exec-return' Command
6811--------------------------
6812
6813Synopsis
6814........
6815
6816      -exec-return
6817
6818   Makes current function return immediately.  Doesn't execute the
6819inferior.  Displays the new current frame.
6820
6821GDB Command
6822...........
6823
6824The corresponding GDB command is `return'.
6825
6826Example
6827.......
6828
6829     (gdb)
6830     200-break-insert callee4
6831     200^done,bkpt={number="1",addr="0x00010734",
6832     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
6833     (gdb)
6834     000-exec-run
6835     000^running
6836     (gdb)
6837     000*stopped,reason="breakpoint-hit",bkptno="1",
6838     frame={func="callee4",args=[],
6839     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
6840     (gdb)
6841     205-break-delete
6842     205^done
6843     (gdb)
6844     111-exec-return
6845     111^done,frame={level="0",func="callee3",
6846     args=[{name="strarg",
6847     value="0x11940 \"A string argument.\""}],
6848     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
6849     (gdb)
6850
6851The `-exec-run' Command
6852-----------------------
6853
6854Synopsis
6855........
6856
6857      -exec-run
6858
6859   Asynchronous command.  Starts execution of the inferior from the
6860beginning.  The inferior executes until either a breakpoint is
6861encountered or the program exits.
6862
6863GDB Command
6864...........
6865
6866The corresponding GDB command is `run'.
6867
6868Example
6869.......
6870
6871     (gdb)
6872     -break-insert main
6873     ^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
6874     (gdb)
6875     -exec-run
6876     ^running
6877     (gdb)
6878     *stopped,reason="breakpoint-hit",bkptno="1",
6879     frame={func="main",args=[],file="recursive2.c",line="4"}
6880     (gdb)
6881
6882The `-exec-show-arguments' Command
6883----------------------------------
6884
6885Synopsis
6886........
6887
6888      -exec-show-arguments
6889
6890   Print the arguments of the program.
6891
6892GDB Command
6893...........
6894
6895The corresponding GDB command is `show args'.
6896
6897Example
6898.......
6899
6900N.A.
6901
6902The `-exec-step' Command
6903------------------------
6904
6905Synopsis
6906........
6907
6908      -exec-step
6909
6910   Asynchronous command.  Resumes execution of the inferior program,
6911stopping when the beginning of the next source line is reached, if the
6912next source line is not a function call.  If it is, stop at the first
6913instruction of the called function.
6914
6915GDB Command
6916...........
6917
6918The corresponding GDB command is `step'.
6919
6920Example
6921.......
6922
6923Stepping into a function:
6924
6925     -exec-step
6926     ^running
6927     (gdb)
6928     *stopped,reason="end-stepping-range",
6929     frame={func="foo",args=[{name="a",value="10"},
6930     {name="b",value="0"}],file="recursive2.c",line="11"}
6931     (gdb)
6932
6933   Regular stepping:
6934
6935     -exec-step
6936     ^running
6937     (gdb)
6938     *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
6939     (gdb)
6940
6941The `-exec-step-instruction' Command
6942------------------------------------
6943
6944Synopsis
6945........
6946
6947      -exec-step-instruction
6948
6949   Asynchronous command.  Resumes the inferior which executes one
6950machine instruction.  The output, once GDB has stopped, will vary
6951depending on whether we have stopped in the middle of a source line or
6952not.  In the former case, the address at which the program stopped will
6953be printed as well.
6954
6955GDB Command
6956...........
6957
6958The corresponding GDB command is `stepi'.
6959
6960Example
6961.......
6962
6963     (gdb)
6964     -exec-step-instruction
6965     ^running
6966
6967     (gdb)
6968     *stopped,reason="end-stepping-range",
6969     frame={func="foo",args=[],file="try.c",line="10"}
6970     (gdb)
6971     -exec-step-instruction
6972     ^running
6973
6974     (gdb)
6975     *stopped,reason="end-stepping-range",
6976     frame={addr="0x000100f4",func="foo",args=[],file="try.c",line="10"}
6977     (gdb)
6978
6979The `-exec-until' Command
6980-------------------------
6981
6982Synopsis
6983........
6984
6985      -exec-until [ LOCATION ]
6986
6987   Asynchronous command.  Executes the inferior until the LOCATION
6988specified in the argument is reached.  If there is no argument, the
6989inferior executes until a source line greater than the current one is
6990reached.  The reason for stopping in this case will be
6991`location-reached'.
6992
6993GDB Command
6994...........
6995
6996The corresponding GDB command is `until'.
6997
6998Example
6999.......
7000
7001     (gdb)
7002     -exec-until recursive2.c:6
7003     ^running
7004     (gdb)
7005     x = 55
7006     *stopped,reason="location-reached",frame={func="main",args=[],
7007     file="recursive2.c",line="6"}
7008     (gdb)
7009
7010The `-file-exec-and-symbols' Command
7011------------------------------------
7012
7013Synopsis
7014........
7015
7016      -file-exec-and-symbols FILE
7017
7018   Specify the executable file to be debugged.  This file is the one
7019from which the symbol table is also read.  If no file is specified, the
7020command clears the executable and symbol information.  If breakpoints
7021are set when using this command with no arguments, GDB will produce
7022error messages.  Otherwise, no output is produced, except a completion
7023notification.
7024
7025GDB Command
7026...........
7027
7028The corresponding GDB command is `file'.
7029
7030Example
7031.......
7032
7033     (gdb)
7034     -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
7035     ^done
7036     (gdb)
7037
7038The `-file-exec-file' Command
7039-----------------------------
7040
7041Synopsis
7042........
7043
7044      -file-exec-file FILE
7045
7046   Specify the executable file to be debugged.  Unlike
7047`-file-exec-and-symbols', the symbol table is _not_ read from this
7048file.  If used without argument, GDB clears the information about the
7049executable file.  No output is produced, except a completion
7050notification.
7051
7052GDB Command
7053...........
7054
7055The corresponding GDB command is `exec-file'.
7056
7057Example
7058.......
7059
7060     (gdb)
7061     -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
7062     ^done
7063     (gdb)
7064
7065The `-file-list-exec-sections' Command
7066--------------------------------------
7067
7068Synopsis
7069........
7070
7071      -file-list-exec-sections
7072
7073   List the sections of the current executable file.
7074
7075GDB Command
7076...........
7077
7078The GDB command `info file' shows, among the rest, the same information
7079as this command.  `gdbtk' has a corresponding command `gdb_load_info'.
7080
7081Example
7082.......
7083
7084N.A.
7085
7086The `-file-list-exec-source-file' Command
7087-----------------------------------------
7088
7089Synopsis
7090........
7091
7092      -file-list-exec-source-file
7093
7094   List the line number, the current source file, and the absolute path
7095to the current source file for the current executable.
7096
7097GDB Command
7098...........
7099
7100There's no GDB command which directly corresponds to this one.
7101
7102Example
7103.......
7104
7105     (gdb)
7106     123-file-list-exec-source-file
7107     123^done,line="1",file="foo.c",fullname="/home/bar/foo.c"
7108     (gdb)
7109
7110The `-file-list-exec-source-files' Command
7111------------------------------------------
7112
7113Synopsis
7114........
7115
7116      -file-list-exec-source-files
7117
7118   List the source files for the current executable.
7119
7120   It will always output the filename, but only when GDB can find the
7121absolute file name of a source file, will it output the fullname.
7122
7123GDB Command
7124...........
7125
7126There's no GDB command which directly corresponds to this one.  `gdbtk'
7127has an analogous command `gdb_listfiles'.
7128
7129Example
7130.......
7131
7132     (gdb)
7133     -file-list-exec-source-files
7134     ^done,files=[
7135     {file=foo.c,fullname=/home/foo.c},
7136     {file=/home/bar.c,fullname=/home/bar.c},
7137     {file=gdb_could_not_find_fullpath.c}]
7138     (gdb)
7139
7140The `-file-list-shared-libraries' Command
7141-----------------------------------------
7142
7143Synopsis
7144........
7145
7146      -file-list-shared-libraries
7147
7148   List the shared libraries in the program.
7149
7150GDB Command
7151...........
7152
7153The corresponding GDB command is `info shared'.
7154
7155Example
7156.......
7157
7158N.A.
7159
7160The `-file-list-symbol-files' Command
7161-------------------------------------
7162
7163Synopsis
7164........
7165
7166      -file-list-symbol-files
7167
7168   List symbol files.
7169
7170GDB Command
7171...........
7172
7173The corresponding GDB command is `info file' (part of it).
7174
7175Example
7176.......
7177
7178N.A.
7179
7180The `-file-symbol-file' Command
7181-------------------------------
7182
7183Synopsis
7184........
7185
7186      -file-symbol-file FILE
7187
7188   Read symbol table info from the specified FILE argument.  When used
7189without arguments, clears GDB's symbol table info.  No output is
7190produced, except for a completion notification.
7191
7192GDB Command
7193...........
7194
7195The corresponding GDB command is `symbol-file'.
7196
7197Example
7198.......
7199
7200     (gdb)
7201     -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
7202     ^done
7203     (gdb)
7204
7205
7206File: gdb.info,  Node: GDB/MI Miscellaneous Commands,  Next: GDB/MI Stack Manipulation,  Prev: GDB/MI Program Control,  Up: GDB/MI
7207
7208Miscellaneous GDB commands in GDB/MI
7209====================================
7210
7211The `-gdb-exit' Command
7212-----------------------
7213
7214Synopsis
7215........
7216
7217      -gdb-exit
7218
7219   Exit GDB immediately.
7220
7221GDB Command
7222...........
7223
7224Approximately corresponds to `quit'.
7225
7226Example
7227.......
7228
7229     (gdb)
7230     -gdb-exit
7231
7232The `-gdb-set' Command
7233----------------------
7234
7235Synopsis
7236........
7237
7238      -gdb-set
7239
7240   Set an internal GDB variable.
7241
7242GDB Command
7243...........
7244
7245The corresponding GDB command is `set'.
7246
7247Example
7248.......
7249
7250     (gdb)
7251     -gdb-set $foo=3
7252     ^done
7253     (gdb)
7254
7255The `-gdb-show' Command
7256-----------------------
7257
7258Synopsis
7259........
7260
7261      -gdb-show
7262
7263   Show the current value of a GDB variable.
7264
7265GDB command
7266...........
7267
7268The corresponding GDB command is `show'.
7269
7270Example
7271.......
7272
7273     (gdb)
7274     -gdb-show annotate
7275     ^done,value="0"
7276     (gdb)
7277
7278The `-gdb-version' Command
7279--------------------------
7280
7281Synopsis
7282........
7283
7284      -gdb-version
7285
7286   Show version information for GDB.  Used mostly in testing.
7287
7288GDB Command
7289...........
7290
7291There's no equivalent GDB command.  GDB by default shows this
7292information when you start an interactive session.
7293
7294Example
7295.......
7296
7297     (gdb)
7298     -gdb-version
7299     ~GNU gdb 5.2.1
7300     ~Copyright 2000 Free Software Foundation, Inc.
7301     ~GDB is free software, covered by the GNU General Public License, and
7302     ~you are welcome to change it and/or distribute copies of it under
7303     ~ certain conditions.
7304     ~Type "show copying" to see the conditions.
7305     ~There is absolutely no warranty for GDB.  Type "show warranty" for
7306     ~ details.
7307     ~This GDB was configured as
7308      "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
7309     ^done
7310     (gdb)
7311
7312The `-interpreter-exec' Command
7313-------------------------------
7314
7315Synopsis
7316--------
7317
7318     -interpreter-exec INTERPRETER COMMAND
7319
7320   Execute the specified COMMAND in the given INTERPRETER.
7321
7322GDB Command
7323-----------
7324
7325The corresponding GDB command is `interpreter-exec'.
7326
7327Example
7328-------
7329
7330     (gdb)
7331     -interpreter-exec console "break main"
7332     &"During symbol reading, couldn't parse type; debugger out of date?.\n"
7333     &"During symbol reading, bad structure-type format.\n"
7334     ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
7335     ^done
7336     (gdb)
7337
7338
7339File: gdb.info,  Node: GDB/MI Stack Manipulation,  Next: GDB/MI Symbol Query,  Prev: GDB/MI Miscellaneous Commands,  Up: GDB/MI
7340
7341GDB/MI Stack Manipulation Commands
7342==================================
7343
7344The `-stack-info-frame' Command
7345-------------------------------
7346
7347Synopsis
7348........
7349
7350      -stack-info-frame
7351
7352   Get info on the current frame.
7353
7354GDB Command
7355...........
7356
7357The corresponding GDB command is `info frame' or `frame' (without
7358arguments).
7359
7360Example
7361.......
7362
7363N.A.
7364
7365The `-stack-info-depth' Command
7366-------------------------------
7367
7368Synopsis
7369........
7370
7371      -stack-info-depth [ MAX-DEPTH ]
7372
7373   Return the depth of the stack.  If the integer argument MAX-DEPTH is
7374specified, do not count beyond MAX-DEPTH frames.
7375
7376GDB Command
7377...........
7378
7379There's no equivalent GDB command.
7380
7381Example
7382.......
7383
7384For a stack with frame levels 0 through 11:
7385
7386     (gdb)
7387     -stack-info-depth
7388     ^done,depth="12"
7389     (gdb)
7390     -stack-info-depth 4
7391     ^done,depth="4"
7392     (gdb)
7393     -stack-info-depth 12
7394     ^done,depth="12"
7395     (gdb)
7396     -stack-info-depth 11
7397     ^done,depth="11"
7398     (gdb)
7399     -stack-info-depth 13
7400     ^done,depth="12"
7401     (gdb)
7402
7403The `-stack-list-arguments' Command
7404-----------------------------------
7405
7406Synopsis
7407........
7408
7409      -stack-list-arguments SHOW-VALUES
7410         [ LOW-FRAME HIGH-FRAME ]
7411
7412   Display a list of the arguments for the frames between LOW-FRAME and
7413HIGH-FRAME (inclusive).  If LOW-FRAME and HIGH-FRAME are not provided,
7414list the arguments for the whole call stack.
7415
7416   The SHOW-VALUES argument must have a value of 0 or 1.  A value of 0
7417means that only the names of the arguments are listed, a value of 1
7418means that both names and values of the arguments are printed.
7419
7420GDB Command
7421...........
7422
7423GDB does not have an equivalent command.  `gdbtk' has a `gdb_get_args'
7424command which partially overlaps with the functionality of
7425`-stack-list-arguments'.
7426
7427Example
7428.......
7429
7430     (gdb)
7431     -stack-list-frames
7432     ^done,
7433     stack=[
7434     frame={level="0",addr="0x00010734",func="callee4",
7435     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"},
7436     frame={level="1",addr="0x0001076c",func="callee3",
7437     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"},
7438     frame={level="2",addr="0x0001078c",func="callee2",
7439     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"},
7440     frame={level="3",addr="0x000107b4",func="callee1",
7441     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"},
7442     frame={level="4",addr="0x000107e0",func="main",
7443     file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"}]
7444     (gdb)
7445     -stack-list-arguments 0
7446     ^done,
7447     stack-args=[
7448     frame={level="0",args=[]},
7449     frame={level="1",args=[name="strarg"]},
7450     frame={level="2",args=[name="intarg",name="strarg"]},
7451     frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
7452     frame={level="4",args=[]}]
7453     (gdb)
7454     -stack-list-arguments 1
7455     ^done,
7456     stack-args=[
7457     frame={level="0",args=[]},
7458     frame={level="1",
7459      args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
7460     frame={level="2",args=[
7461     {name="intarg",value="2"},
7462     {name="strarg",value="0x11940 \"A string argument.\""}]},
7463     {frame={level="3",args=[
7464     {name="intarg",value="2"},
7465     {name="strarg",value="0x11940 \"A string argument.\""},
7466     {name="fltarg",value="3.5"}]},
7467     frame={level="4",args=[]}]
7468     (gdb)
7469     -stack-list-arguments 0 2 2
7470     ^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
7471     (gdb)
7472     -stack-list-arguments 1 2 2
7473     ^done,stack-args=[frame={level="2",
7474     args=[{name="intarg",value="2"},
7475     {name="strarg",value="0x11940 \"A string argument.\""}]}]
7476     (gdb)
7477
7478The `-stack-list-frames' Command
7479--------------------------------
7480
7481Synopsis
7482........
7483
7484      -stack-list-frames [ LOW-FRAME HIGH-FRAME ]
7485
7486   List the frames currently on the stack.  For each frame it displays
7487the following info:
7488
7489`LEVEL'
7490     The frame number, 0 being the topmost frame, i.e. the innermost
7491     function.
7492
7493`ADDR'
7494     The `$pc' value for that frame.
7495
7496`FUNC'
7497     Function name.
7498
7499`FILE'
7500     File name of the source file where the function lives.
7501
7502`LINE'
7503     Line number corresponding to the `$pc'.
7504
7505   If invoked without arguments, this command prints a backtrace for the
7506whole stack.  If given two integer arguments, it shows the frames whose
7507levels are between the two arguments (inclusive).  If the two arguments
7508are equal, it shows the single frame at the corresponding level.
7509
7510GDB Command
7511...........
7512
7513The corresponding GDB commands are `backtrace' and `where'.
7514
7515Example
7516.......
7517
7518Full stack backtrace:
7519
7520     (gdb)
7521     -stack-list-frames
7522     ^done,stack=
7523     [frame={level="0",addr="0x0001076c",func="foo",
7524       file="recursive2.c",line="11"},
7525     frame={level="1",addr="0x000107a4",func="foo",
7526       file="recursive2.c",line="14"},
7527     frame={level="2",addr="0x000107a4",func="foo",
7528       file="recursive2.c",line="14"},
7529     frame={level="3",addr="0x000107a4",func="foo",
7530       file="recursive2.c",line="14"},
7531     frame={level="4",addr="0x000107a4",func="foo",
7532       file="recursive2.c",line="14"},
7533     frame={level="5",addr="0x000107a4",func="foo",
7534       file="recursive2.c",line="14"},
7535     frame={level="6",addr="0x000107a4",func="foo",
7536       file="recursive2.c",line="14"},
7537     frame={level="7",addr="0x000107a4",func="foo",
7538       file="recursive2.c",line="14"},
7539     frame={level="8",addr="0x000107a4",func="foo",
7540       file="recursive2.c",line="14"},
7541     frame={level="9",addr="0x000107a4",func="foo",
7542       file="recursive2.c",line="14"},
7543     frame={level="10",addr="0x000107a4",func="foo",
7544       file="recursive2.c",line="14"},
7545     frame={level="11",addr="0x00010738",func="main",
7546       file="recursive2.c",line="4"}]
7547     (gdb)
7548
7549   Show frames between LOW_FRAME and HIGH_FRAME:
7550
7551     (gdb)
7552     -stack-list-frames 3 5
7553     ^done,stack=
7554     [frame={level="3",addr="0x000107a4",func="foo",
7555       file="recursive2.c",line="14"},
7556     frame={level="4",addr="0x000107a4",func="foo",
7557       file="recursive2.c",line="14"},
7558     frame={level="5",addr="0x000107a4",func="foo",
7559       file="recursive2.c",line="14"}]
7560     (gdb)
7561
7562   Show a single frame:
7563
7564     (gdb)
7565     -stack-list-frames 3 3
7566     ^done,stack=
7567     [frame={level="3",addr="0x000107a4",func="foo",
7568       file="recursive2.c",line="14"}]
7569     (gdb)
7570
7571The `-stack-list-locals' Command
7572--------------------------------
7573
7574Synopsis
7575........
7576
7577      -stack-list-locals PRINT-VALUES
7578
7579   Display the local variable names for the current frame.  With an
7580argument of 0 or `--no-values', prints only the names of the variables.
7581With argument of 1 or `--all-values', prints also their values.  With
7582argument of 2 or `--simple-values', prints the name, type and value for
7583simple data types and the name and type for arrays, structures and
7584unions.  In this last case, the idea is that the user can see the value
7585of simple data types immediately and he can create variable objects for
7586other data types if he wishes to explore their values in more detail.
7587
7588GDB Command
7589...........
7590
7591`info locals' in GDB, `gdb_get_locals' in `gdbtk'.
7592
7593Example
7594.......
7595
7596     (gdb)
7597     -stack-list-locals 0
7598     ^done,locals=[name="A",name="B",name="C"]
7599     (gdb)
7600     -stack-list-locals --all-values
7601     ^done,locals=[{name="A",value="1"},{name="B",value="2"},
7602       {name="C",value="{1, 2, 3}"}]
7603     -stack-list-locals --simple-values
7604     ^done,locals=[{name="A",type="int",value="1"},
7605       {name="B",type="int",value="2"},{name="C",type="int [3]"}]
7606     (gdb)
7607
7608The `-stack-select-frame' Command
7609---------------------------------
7610
7611Synopsis
7612........
7613
7614      -stack-select-frame FRAMENUM
7615
7616   Change the current frame.  Select a different frame FRAMENUM on the
7617stack.
7618
7619GDB Command
7620...........
7621
7622The corresponding GDB commands are `frame', `up', `down',
7623`select-frame', `up-silent', and `down-silent'.
7624
7625Example
7626.......
7627
7628     (gdb)
7629     -stack-select-frame 2
7630     ^done
7631     (gdb)
7632
7633
7634File: gdb.info,  Node: GDB/MI Symbol Query,  Next: GDB/MI Target Manipulation,  Prev: GDB/MI Stack Manipulation,  Up: GDB/MI
7635
7636GDB/MI Symbol Query Commands
7637============================
7638
7639The `-symbol-info-address' Command
7640----------------------------------
7641
7642Synopsis
7643........
7644
7645      -symbol-info-address SYMBOL
7646
7647   Describe where SYMBOL is stored.
7648
7649GDB Command
7650...........
7651
7652The corresponding GDB command is `info address'.
7653
7654Example
7655.......
7656
7657N.A.
7658
7659The `-symbol-info-file' Command
7660-------------------------------
7661
7662Synopsis
7663........
7664
7665      -symbol-info-file
7666
7667   Show the file for the symbol.
7668
7669GDB Command
7670...........
7671
7672There's no equivalent GDB command.  `gdbtk' has `gdb_find_file'.
7673
7674Example
7675.......
7676
7677N.A.
7678
7679The `-symbol-info-function' Command
7680-----------------------------------
7681
7682Synopsis
7683........
7684
7685      -symbol-info-function
7686
7687   Show which function the symbol lives in.
7688
7689GDB Command
7690...........
7691
7692`gdb_get_function' in `gdbtk'.
7693
7694Example
7695.......
7696
7697N.A.
7698
7699The `-symbol-info-line' Command
7700-------------------------------
7701
7702Synopsis
7703........
7704
7705      -symbol-info-line
7706
7707   Show the core addresses of the code for a source line.
7708
7709GDB Command
7710...........
7711
7712The corresponding GDB command is `info line'.  `gdbtk' has the
7713`gdb_get_line' and `gdb_get_file' commands.
7714
7715Example
7716.......
7717
7718N.A.
7719
7720The `-symbol-info-symbol' Command
7721---------------------------------
7722
7723Synopsis
7724........
7725
7726      -symbol-info-symbol ADDR
7727
7728   Describe what symbol is at location ADDR.
7729
7730GDB Command
7731...........
7732
7733The corresponding GDB command is `info symbol'.
7734
7735Example
7736.......
7737
7738N.A.
7739
7740The `-symbol-list-functions' Command
7741------------------------------------
7742
7743Synopsis
7744........
7745
7746      -symbol-list-functions
7747
7748   List the functions in the executable.
7749
7750GDB Command
7751...........
7752
7753`info functions' in GDB, `gdb_listfunc' and `gdb_search' in `gdbtk'.
7754
7755Example
7756.......
7757
7758N.A.
7759
7760The `-symbol-list-lines' Command
7761--------------------------------
7762
7763Synopsis
7764........
7765
7766      -symbol-list-lines FILENAME
7767
7768   Print the list of lines that contain code and their associated
7769program addresses for the given source filename.  The entries are
7770sorted in ascending PC order.
7771
7772GDB Command
7773...........
7774
7775There is no corresponding GDB command.
7776
7777Example
7778.......
7779
7780     (gdb)
7781     -symbol-list-lines basics.c
7782     ^done,lines=[{pc="0x08048554",line="7"},{pc="0x0804855a",line="8"}]
7783     (gdb)
7784
7785The `-symbol-list-types' Command
7786--------------------------------
7787
7788Synopsis
7789........
7790
7791      -symbol-list-types
7792
7793   List all the type names.
7794
7795GDB Command
7796...........
7797
7798The corresponding commands are `info types' in GDB, `gdb_search' in
7799`gdbtk'.
7800
7801Example
7802.......
7803
7804N.A.
7805
7806The `-symbol-list-variables' Command
7807------------------------------------
7808
7809Synopsis
7810........
7811
7812      -symbol-list-variables
7813
7814   List all the global and static variable names.
7815
7816GDB Command
7817...........
7818
7819`info variables' in GDB, `gdb_search' in `gdbtk'.
7820
7821Example
7822.......
7823
7824N.A.
7825
7826The `-symbol-locate' Command
7827----------------------------
7828
7829Synopsis
7830........
7831
7832      -symbol-locate
7833
7834GDB Command
7835...........
7836
7837`gdb_loc' in `gdbtk'.
7838
7839Example
7840.......
7841
7842N.A.
7843
7844The `-symbol-type' Command
7845--------------------------
7846
7847Synopsis
7848........
7849
7850      -symbol-type VARIABLE
7851
7852   Show type of VARIABLE.
7853
7854GDB Command
7855...........
7856
7857The corresponding GDB command is `ptype', `gdbtk' has
7858`gdb_obj_variable'.
7859
7860Example
7861.......
7862
7863N.A.
7864
7865
7866File: gdb.info,  Node: GDB/MI Target Manipulation,  Next: GDB/MI Thread Commands,  Prev: GDB/MI Symbol Query,  Up: GDB/MI
7867
7868GDB/MI Target Manipulation Commands
7869===================================
7870
7871The `-target-attach' Command
7872----------------------------
7873
7874Synopsis
7875........
7876
7877      -target-attach PID | FILE
7878
7879   Attach to a process PID or a file FILE outside of GDB.
7880
7881GDB command
7882...........
7883
7884The corresponding GDB command is `attach'.
7885
7886Example
7887.......
7888
7889N.A.
7890
7891The `-target-compare-sections' Command
7892--------------------------------------
7893
7894Synopsis
7895........
7896
7897      -target-compare-sections [ SECTION ]
7898
7899   Compare data of section SECTION on target to the exec file.  Without
7900the argument, all sections are compared.
7901
7902GDB Command
7903...........
7904
7905The GDB equivalent is `compare-sections'.
7906
7907Example
7908.......
7909
7910N.A.
7911
7912The `-target-detach' Command
7913----------------------------
7914
7915Synopsis
7916........
7917
7918      -target-detach
7919
7920   Disconnect from the remote target.  There's no output.
7921
7922GDB command
7923...........
7924
7925The corresponding GDB command is `detach'.
7926
7927Example
7928.......
7929
7930     (gdb)
7931     -target-detach
7932     ^done
7933     (gdb)
7934
7935The `-target-disconnect' Command
7936--------------------------------
7937
7938Synopsis
7939........
7940
7941      -target-disconnect
7942
7943   Disconnect from the remote target.  There's no output.
7944
7945GDB command
7946...........
7947
7948The corresponding GDB command is `disconnect'.
7949
7950Example
7951.......
7952
7953     (gdb)
7954     -target-disconnect
7955     ^done
7956     (gdb)
7957
7958The `-target-download' Command
7959------------------------------
7960
7961Synopsis
7962........
7963
7964      -target-download
7965
7966   Loads the executable onto the remote target.  It prints out an
7967update message every half second, which includes the fields:
7968
7969`section'
7970     The name of the section.
7971
7972`section-sent'
7973     The size of what has been sent so far for that section.
7974
7975`section-size'
7976     The size of the section.
7977
7978`total-sent'
7979     The total size of what was sent so far (the current and the
7980     previous sections).
7981
7982`total-size'
7983     The size of the overall executable to download.
7984
7985Each message is sent as status record (*note GDB/MI Output Syntax:
7986GDB/MI Output Syntax.).
7987
7988   In addition, it prints the name and size of the sections, as they are
7989downloaded.  These messages include the following fields:
7990
7991`section'
7992     The name of the section.
7993
7994`section-size'
7995     The size of the section.
7996
7997`total-size'
7998     The size of the overall executable to download.
7999
8000At the end, a summary is printed.
8001
8002GDB Command
8003...........
8004
8005The corresponding GDB command is `load'.
8006
8007Example
8008.......
8009
8010Note: each status message appears on a single line.  Here the messages
8011have been broken down so that they can fit onto a page.
8012
8013     (gdb)
8014     -target-download
8015     +download,{section=".text",section-size="6668",total-size="9880"}
8016     +download,{section=".text",section-sent="512",section-size="6668",
8017     total-sent="512",total-size="9880"}
8018     +download,{section=".text",section-sent="1024",section-size="6668",
8019     total-sent="1024",total-size="9880"}
8020     +download,{section=".text",section-sent="1536",section-size="6668",
8021     total-sent="1536",total-size="9880"}
8022     +download,{section=".text",section-sent="2048",section-size="6668",
8023     total-sent="2048",total-size="9880"}
8024     +download,{section=".text",section-sent="2560",section-size="6668",
8025     total-sent="2560",total-size="9880"}
8026     +download,{section=".text",section-sent="3072",section-size="6668",
8027     total-sent="3072",total-size="9880"}
8028     +download,{section=".text",section-sent="3584",section-size="6668",
8029     total-sent="3584",total-size="9880"}
8030     +download,{section=".text",section-sent="4096",section-size="6668",
8031     total-sent="4096",total-size="9880"}
8032     +download,{section=".text",section-sent="4608",section-size="6668",
8033     total-sent="4608",total-size="9880"}
8034     +download,{section=".text",section-sent="5120",section-size="6668",
8035     total-sent="5120",total-size="9880"}
8036     +download,{section=".text",section-sent="5632",section-size="6668",
8037     total-sent="5632",total-size="9880"}
8038     +download,{section=".text",section-sent="6144",section-size="6668",
8039     total-sent="6144",total-size="9880"}
8040     +download,{section=".text",section-sent="6656",section-size="6668",
8041     total-sent="6656",total-size="9880"}
8042     +download,{section=".init",section-size="28",total-size="9880"}
8043     +download,{section=".fini",section-size="28",total-size="9880"}
8044     +download,{section=".data",section-size="3156",total-size="9880"}
8045     +download,{section=".data",section-sent="512",section-size="3156",
8046     total-sent="7236",total-size="9880"}
8047     +download,{section=".data",section-sent="1024",section-size="3156",
8048     total-sent="7748",total-size="9880"}
8049     +download,{section=".data",section-sent="1536",section-size="3156",
8050     total-sent="8260",total-size="9880"}
8051     +download,{section=".data",section-sent="2048",section-size="3156",
8052     total-sent="8772",total-size="9880"}
8053     +download,{section=".data",section-sent="2560",section-size="3156",
8054     total-sent="9284",total-size="9880"}
8055     +download,{section=".data",section-sent="3072",section-size="3156",
8056     total-sent="9796",total-size="9880"}
8057     ^done,address="0x10004",load-size="9880",transfer-rate="6586",
8058     write-rate="429"
8059     (gdb)
8060
8061The `-target-exec-status' Command
8062---------------------------------
8063
8064Synopsis
8065........
8066
8067      -target-exec-status
8068
8069   Provide information on the state of the target (whether it is
8070running or not, for instance).
8071
8072GDB Command
8073...........
8074
8075There's no equivalent GDB command.
8076
8077Example
8078.......
8079
8080N.A.
8081
8082The `-target-list-available-targets' Command
8083--------------------------------------------
8084
8085Synopsis
8086........
8087
8088      -target-list-available-targets
8089
8090   List the possible targets to connect to.
8091
8092GDB Command
8093...........
8094
8095The corresponding GDB command is `help target'.
8096
8097Example
8098.......
8099
8100N.A.
8101
8102The `-target-list-current-targets' Command
8103------------------------------------------
8104
8105Synopsis
8106........
8107
8108      -target-list-current-targets
8109
8110   Describe the current target.
8111
8112GDB Command
8113...........
8114
8115The corresponding information is printed by `info file' (among other
8116things).
8117
8118Example
8119.......
8120
8121N.A.
8122
8123The `-target-list-parameters' Command
8124-------------------------------------
8125
8126Synopsis
8127........
8128
8129      -target-list-parameters
8130
8131GDB Command
8132...........
8133
8134No equivalent.
8135
8136Example
8137.......
8138
8139N.A.
8140
8141The `-target-select' Command
8142----------------------------
8143
8144Synopsis
8145........
8146
8147      -target-select TYPE PARAMETERS ...
8148
8149   Connect GDB to the remote target.  This command takes two args:
8150
8151`TYPE'
8152     The type of target, for instance `async', `remote', etc.
8153
8154`PARAMETERS'
8155     Device names, host names and the like.  *Note Commands for
8156     managing targets: Target Commands, for more details.
8157
8158   The output is a connection notification, followed by the address at
8159which the target program is, in the following form:
8160
8161     ^connected,addr="ADDRESS",func="FUNCTION NAME",
8162       args=[ARG LIST]
8163
8164GDB Command
8165...........
8166
8167The corresponding GDB command is `target'.
8168
8169Example
8170.......
8171
8172     (gdb)
8173     -target-select async /dev/ttya
8174     ^connected,addr="0xfe00a300",func="??",args=[]
8175     (gdb)
8176
8177
8178File: gdb.info,  Node: GDB/MI Thread Commands,  Next: GDB/MI Tracepoint Commands,  Prev: GDB/MI Target Manipulation,  Up: GDB/MI
8179
8180GDB/MI Thread Commands
8181======================
8182
8183The `-thread-info' Command
8184--------------------------
8185
8186Synopsis
8187........
8188
8189      -thread-info
8190
8191GDB command
8192...........
8193
8194No equivalent.
8195
8196Example
8197.......
8198
8199N.A.
8200
8201The `-thread-list-all-threads' Command
8202--------------------------------------
8203
8204Synopsis
8205........
8206
8207      -thread-list-all-threads
8208
8209GDB Command
8210...........
8211
8212The equivalent GDB command is `info threads'.
8213
8214Example
8215.......
8216
8217N.A.
8218
8219The `-thread-list-ids' Command
8220------------------------------
8221
8222Synopsis
8223........
8224
8225      -thread-list-ids
8226
8227   Produces a list of the currently known GDB thread ids.  At the end
8228of the list it also prints the total number of such threads.
8229
8230GDB Command
8231...........
8232
8233Part of `info threads' supplies the same information.
8234
8235Example
8236.......
8237
8238No threads present, besides the main process:
8239
8240     (gdb)
8241     -thread-list-ids
8242     ^done,thread-ids={},number-of-threads="0"
8243     (gdb)
8244
8245   Several threads:
8246
8247     (gdb)
8248     -thread-list-ids
8249     ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
8250     number-of-threads="3"
8251     (gdb)
8252
8253The `-thread-select' Command
8254----------------------------
8255
8256Synopsis
8257........
8258
8259      -thread-select THREADNUM
8260
8261   Make THREADNUM the current thread.  It prints the number of the new
8262current thread, and the topmost frame for that thread.
8263
8264GDB Command
8265...........
8266
8267The corresponding GDB command is `thread'.
8268
8269Example
8270.......
8271
8272     (gdb)
8273     -exec-next
8274     ^running
8275     (gdb)
8276     *stopped,reason="end-stepping-range",thread-id="2",line="187",
8277     file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
8278     (gdb)
8279     -thread-list-ids
8280     ^done,
8281     thread-ids={thread-id="3",thread-id="2",thread-id="1"},
8282     number-of-threads="3"
8283     (gdb)
8284     -thread-select 3
8285     ^done,new-thread-id="3",
8286     frame={level="0",func="vprintf",
8287     args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
8288     {name="arg",value="0x2"}],file="vprintf.c",line="31"}
8289     (gdb)
8290
8291
8292File: gdb.info,  Node: GDB/MI Tracepoint Commands,  Next: GDB/MI Variable Objects,  Prev: GDB/MI Thread Commands,  Up: GDB/MI
8293
8294GDB/MI Tracepoint Commands
8295==========================
8296
8297The tracepoint commands are not yet implemented.
8298
8299
8300File: gdb.info,  Node: GDB/MI Variable Objects,  Prev: GDB/MI Tracepoint Commands,  Up: GDB/MI
8301
8302GDB/MI Variable Objects
8303=======================
8304
8305Motivation for Variable Objects in GDB/MI
8306-----------------------------------------
8307
8308For the implementation of a variable debugger window (locals, watched
8309expressions, etc.), we are proposing the adaptation of the existing code
8310used by `Insight'.
8311
8312   The two main reasons for that are:
8313
8314  1. It has been proven in practice (it is already on its second
8315     generation).
8316
8317  2. It will shorten development time (needless to say how important it
8318     is now).
8319
8320   The original interface was designed to be used by Tcl code, so it was
8321slightly changed so it could be used through GDB/MI.  This section
8322describes the GDB/MI operations that will be available and gives some
8323hints about their use.
8324
8325   _Note_: In addition to the set of operations described here, we
8326expect the GUI implementation of a variable window to require, at
8327least, the following operations:
8328
8329   * `-gdb-show' `output-radix'
8330
8331   * `-stack-list-arguments'
8332
8333   * `-stack-list-locals'
8334
8335   * `-stack-select-frame'
8336
8337Introduction to Variable Objects in GDB/MI
8338------------------------------------------
8339
8340The basic idea behind variable objects is the creation of a named object
8341to represent a variable, an expression, a memory location or even a CPU
8342register.  For each object created, a set of operations is available for
8343examining or changing its properties.
8344
8345   Furthermore, complex data types, such as C structures, are
8346represented in a tree format.  For instance, the `struct' type variable
8347is the root and the children will represent the struct members.  If a
8348child is itself of a complex type, it will also have children of its
8349own.  Appropriate language differences are handled for C, C++ and Java.
8350
8351   When returning the actual values of the objects, this facility allows
8352for the individual selection of the display format used in the result
8353creation.  It can be chosen among: binary, decimal, hexadecimal, octal
8354and natural.  Natural refers to a default format automatically chosen
8355based on the variable type (like decimal for an `int', hex for
8356pointers, etc.).
8357
8358   The following is the complete set of GDB/MI operations defined to
8359access this functionality:
8360
8361*Operation*                   *Description*
8362`-var-create'                 create a variable object
8363`-var-delete'                 delete the variable object and its children
8364`-var-set-format'             set the display format of this variable
8365`-var-show-format'            show the display format of this variable
8366`-var-info-num-children'      tells how many children this object has
8367`-var-list-children'          return a list of the object's children
8368`-var-info-type'              show the type of this variable object
8369`-var-info-expression'        print what this variable object represents
8370`-var-show-attributes'        is this variable editable? does it exist
8371                              here?
8372`-var-evaluate-expression'    get the value of this variable
8373`-var-assign'                 set the value of this variable
8374`-var-update'                 update the variable and its children
8375
8376   In the next subsection we describe each operation in detail and
8377suggest how it can be used.
8378
8379Description And Use of Operations on Variable Objects
8380-----------------------------------------------------
8381
8382The `-var-create' Command
8383-------------------------
8384
8385Synopsis
8386........
8387
8388      -var-create {NAME | "-"}
8389         {FRAME-ADDR | "*"} EXPRESSION
8390
8391   This operation creates a variable object, which allows the
8392monitoring of a variable, the result of an expression, a memory cell or
8393a CPU register.
8394
8395   The NAME parameter is the string by which the object can be
8396referenced.  It must be unique.  If `-' is specified, the varobj system
8397will generate a string "varNNNNNN" automatically.  It will be unique
8398provided that one does not specify NAME on that format.  The command
8399fails if a duplicate name is found.
8400
8401   The frame under which the expression should be evaluated can be
8402specified by FRAME-ADDR.  A `*' indicates that the current frame should
8403be used.
8404
8405   EXPRESSION is any expression valid on the current language set (must
8406not begin with a `*'), or one of the following:
8407
8408   * `*ADDR', where ADDR is the address of a memory cell
8409
8410   * `*ADDR-ADDR' -- a memory address range (TBD)
8411
8412   * `$REGNAME' -- a CPU register name
8413
8414Result
8415......
8416
8417This operation returns the name, number of children and the type of the
8418object created.  Type is returned as a string as the ones generated by
8419the GDB CLI:
8420
8421      name="NAME",numchild="N",type="TYPE"
8422
8423The `-var-delete' Command
8424-------------------------
8425
8426Synopsis
8427........
8428
8429      -var-delete NAME
8430
8431   Deletes a previously created variable object and all of its children.
8432
8433   Returns an error if the object NAME is not found.
8434
8435The `-var-set-format' Command
8436-----------------------------
8437
8438Synopsis
8439........
8440
8441      -var-set-format NAME FORMAT-SPEC
8442
8443   Sets the output format for the value of the object NAME to be
8444FORMAT-SPEC.
8445
8446   The syntax for the FORMAT-SPEC is as follows:
8447
8448      FORMAT-SPEC ==>
8449      {binary | decimal | hexadecimal | octal | natural}
8450
8451The `-var-show-format' Command
8452------------------------------
8453
8454Synopsis
8455........
8456
8457      -var-show-format NAME
8458
8459   Returns the format used to display the value of the object NAME.
8460
8461      FORMAT ==>
8462      FORMAT-SPEC
8463
8464The `-var-info-num-children' Command
8465------------------------------------
8466
8467Synopsis
8468........
8469
8470      -var-info-num-children NAME
8471
8472   Returns the number of children of a variable object NAME:
8473
8474      numchild=N
8475
8476The `-var-list-children' Command
8477--------------------------------
8478
8479Synopsis
8480........
8481
8482      -var-list-children [PRINT-VALUES] NAME
8483
8484   Returns a list of the children of the specified variable object.
8485With just the variable object name as an argument or with an optional
8486preceding argument of 0 or `--no-values', prints only the names of the
8487variables.  With an optional preceding argument of 1 or `--all-values',
8488also prints their values.
8489
8490Example
8491.......
8492
8493     (gdb)
8494      -var-list-children n
8495      numchild=N,children=[{name=NAME,
8496      numchild=N,type=TYPE},(repeats N times)]
8497     (gdb)
8498      -var-list-children --all-values n
8499      numchild=N,children=[{name=NAME,
8500      numchild=N,value=VALUE,type=TYPE},(repeats N times)]
8501
8502The `-var-info-type' Command
8503----------------------------
8504
8505Synopsis
8506........
8507
8508      -var-info-type NAME
8509
8510   Returns the type of the specified variable NAME.  The type is
8511returned as a string in the same format as it is output by the GDB CLI:
8512
8513      type=TYPENAME
8514
8515The `-var-info-expression' Command
8516----------------------------------
8517
8518Synopsis
8519........
8520
8521      -var-info-expression NAME
8522
8523   Returns what is represented by the variable object NAME:
8524
8525      lang=LANG-SPEC,exp=EXPRESSION
8526
8527where LANG-SPEC is `{"C" | "C++" | "Java"}'.
8528
8529The `-var-show-attributes' Command
8530----------------------------------
8531
8532Synopsis
8533........
8534
8535      -var-show-attributes NAME
8536
8537   List attributes of the specified variable object NAME:
8538
8539      status=ATTR [ ( ,ATTR )* ]
8540
8541where ATTR is `{ { editable | noneditable } | TBD }'.
8542
8543The `-var-evaluate-expression' Command
8544--------------------------------------
8545
8546Synopsis
8547........
8548
8549      -var-evaluate-expression NAME
8550
8551   Evaluates the expression that is represented by the specified
8552variable object and returns its value as a string in the current format
8553specified for the object:
8554
8555      value=VALUE
8556
8557   Note that one must invoke `-var-list-children' for a variable before
8558the value of a child variable can be evaluated.
8559
8560The `-var-assign' Command
8561-------------------------
8562
8563Synopsis
8564........
8565
8566      -var-assign NAME EXPRESSION
8567
8568   Assigns the value of EXPRESSION to the variable object specified by
8569NAME.  The object must be `editable'.  If the variable's value is
8570altered by the assign, the variable will show up in any subsequent
8571`-var-update' list.
8572
8573Example
8574.......
8575
8576     (gdb)
8577     -var-assign var1 3
8578     ^done,value="3"
8579     (gdb)
8580     -var-update *
8581     ^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
8582     (gdb)
8583
8584The `-var-update' Command
8585-------------------------
8586
8587Synopsis
8588........
8589
8590      -var-update {NAME | "*"}
8591
8592   Update the value of the variable object NAME by evaluating its
8593expression after fetching all the new values from memory or registers.
8594A `*' causes all existing variable objects to be updated.
8595
8596
8597File: gdb.info,  Node: Annotations,  Next: GDB/MI,  Prev: Emacs,  Up: Top
8598
8599GDB Annotations
8600***************
8601
8602This chapter describes annotations in GDB.  Annotations were designed
8603to interface GDB to graphical user interfaces or other similar programs
8604which want to interact with GDB at a relatively high level.
8605
8606   The annotation mechanism has largely been superseeded by GDB/MI
8607(*note GDB/MI::).
8608
8609* Menu:
8610
8611* Annotations Overview::  What annotations are; the general syntax.
8612* Server Prefix::       Issuing a command without affecting user state.
8613* Prompting::           Annotations marking GDB's need for input.
8614* Errors::              Annotations for error messages.
8615* Invalidation::        Some annotations describe things now invalid.
8616* Annotations for Running::
8617                        Whether the program is running, how it stopped, etc.
8618* Source Annotations::  Annotations describing source code.
8619
8620
8621File: gdb.info,  Node: Annotations Overview,  Next: Server Prefix,  Up: Annotations
8622
8623What is an Annotation?
8624======================
8625
8626Annotations start with a newline character, two `control-z' characters,
8627and the name of the annotation.  If there is no additional information
8628associated with this annotation, the name of the annotation is followed
8629immediately by a newline.  If there is additional information, the name
8630of the annotation is followed by a space, the additional information,
8631and a newline.  The additional information cannot contain newline
8632characters.
8633
8634   Any output not beginning with a newline and two `control-z'
8635characters denotes literal output from GDB.  Currently there is no need
8636for GDB to output a newline followed by two `control-z' characters, but
8637if there was such a need, the annotations could be extended with an
8638`escape' annotation which means those three characters as output.
8639
8640   The annotation LEVEL, which is specified using the `--annotate'
8641command line option (*note Mode Options::), controls how much
8642information GDB prints together with its prompt, values of expressions,
8643source lines, and other types of output.  Level 0 is for no anntations,
8644level 1 is for use when GDB is run as a subprocess of GNU Emacs, level
86453 is the maximum annotation suitable for programs that control GDB, and
8646level 2 annotations have been made obsolete (*note Limitations of the
8647Annotation Interface: (annotate)Limitations.).  This chapter describes
8648level 3 annotations.
8649
8650   A simple example of starting up GDB with annotations is:
8651
8652     $ gdb --annotate=3
8653     GNU gdb 6.0
8654     Copyright 2003 Free Software Foundation, Inc.
8655     GDB is free software, covered by the GNU General Public License,
8656     and you are welcome to change it and/or distribute copies of it
8657     under certain conditions.
8658     Type "show copying" to see the conditions.
8659     There is absolutely no warranty for GDB.  Type "show warranty"
8660     for details.
8661     This GDB was configured as "i386-pc-linux-gnu"
8662
8663     ^Z^Zpre-prompt
8664     (gdb)
8665     ^Z^Zprompt
8666     quit
8667
8668     ^Z^Zpost-prompt
8669     $
8670
8671   Here `quit' is input to GDB; the rest is output from GDB.  The three
8672lines beginning `^Z^Z' (where `^Z' denotes a `control-z' character) are
8673annotations; the rest is output from GDB.
8674
8675
8676File: gdb.info,  Node: Server Prefix,  Next: Prompting,  Prev: Annotations Overview,  Up: Annotations
8677
8678The Server Prefix
8679=================
8680
8681To issue a command to GDB without affecting certain aspects of the
8682state which is seen by users, prefix it with `server '.  This means
8683that this command will not affect the command history, nor will it
8684affect GDB's notion of which command to repeat if <RET> is pressed on a
8685line by itself.
8686
8687   The server prefix does not affect the recording of values into the
8688value history; to print a value without recording it into the value
8689history, use the `output' command instead of the `print' command.
8690
8691
8692File: gdb.info,  Node: Prompting,  Next: Errors,  Prev: Server Prefix,  Up: Annotations
8693
8694Annotation for GDB Input
8695========================
8696
8697When GDB prompts for input, it annotates this fact so it is possible to
8698know when to send output, when the output from a given command is over,
8699etc.
8700
8701   Different kinds of input each have a different "input type".  Each
8702input type has three annotations: a `pre-' annotation, which denotes
8703the beginning of any prompt which is being output, a plain annotation,
8704which denotes the end of the prompt, and then a `post-' annotation
8705which denotes the end of any echo which may (or may not) be associated
8706with the input.  For example, the `prompt' input type features the
8707following annotations:
8708
8709     ^Z^Zpre-prompt
8710     ^Z^Zprompt
8711     ^Z^Zpost-prompt
8712
8713   The input types are
8714
8715`prompt'
8716     When GDB is prompting for a command (the main GDB prompt).
8717
8718`commands'
8719     When GDB prompts for a set of commands, like in the `commands'
8720     command.  The annotations are repeated for each command which is
8721     input.
8722
8723`overload-choice'
8724     When GDB wants the user to select between various overloaded
8725     functions.
8726
8727`query'
8728     When GDB wants the user to confirm a potentially dangerous
8729     operation.
8730
8731`prompt-for-continue'
8732     When GDB is asking the user to press return to continue.  Note:
8733     Don't expect this to work well; instead use `set height 0' to
8734     disable prompting.  This is because the counting of lines is buggy
8735     in the presence of annotations.
8736
8737
8738File: gdb.info,  Node: Errors,  Next: Invalidation,  Prev: Prompting,  Up: Annotations
8739
8740Errors
8741======
8742
8743     ^Z^Zquit
8744
8745   This annotation occurs right before GDB responds to an interrupt.
8746
8747     ^Z^Zerror
8748
8749   This annotation occurs right before GDB responds to an error.
8750
8751   Quit and error annotations indicate that any annotations which GDB
8752was in the middle of may end abruptly.  For example, if a
8753`value-history-begin' annotation is followed by a `error', one cannot
8754expect to receive the matching `value-history-end'.  One cannot expect
8755not to receive it either, however; an error annotation does not
8756necessarily mean that GDB is immediately returning all the way to the
8757top level.
8758
8759   A quit or error annotation may be preceded by
8760
8761     ^Z^Zerror-begin
8762
8763   Any output between that and the quit or error annotation is the error
8764message.
8765
8766   Warning messages are not yet annotated.
8767
8768
8769File: gdb.info,  Node: Invalidation,  Next: Annotations for Running,  Prev: Errors,  Up: Annotations
8770
8771Invalidation Notices
8772====================
8773
8774The following annotations say that certain pieces of state may have
8775changed.
8776
8777`^Z^Zframes-invalid'
8778     The frames (for example, output from the `backtrace' command) may
8779     have changed.
8780
8781`^Z^Zbreakpoints-invalid'
8782     The breakpoints may have changed.  For example, the user just
8783     added or deleted a breakpoint.
8784
8785
8786File: gdb.info,  Node: Annotations for Running,  Next: Source Annotations,  Prev: Invalidation,  Up: Annotations
8787
8788Running the Program
8789===================
8790
8791When the program starts executing due to a GDB command such as `step'
8792or `continue',
8793
8794     ^Z^Zstarting
8795
8796   is output.  When the program stops,
8797
8798     ^Z^Zstopped
8799
8800   is output.  Before the `stopped' annotation, a variety of
8801annotations describe how the program stopped.
8802
8803`^Z^Zexited EXIT-STATUS'
8804     The program exited, and EXIT-STATUS is the exit status (zero for
8805     successful exit, otherwise nonzero).
8806
8807`^Z^Zsignalled'
8808     The program exited with a signal.  After the `^Z^Zsignalled', the
8809     annotation continues:
8810
8811          INTRO-TEXT
8812          ^Z^Zsignal-name
8813          NAME
8814          ^Z^Zsignal-name-end
8815          MIDDLE-TEXT
8816          ^Z^Zsignal-string
8817          STRING
8818          ^Z^Zsignal-string-end
8819          END-TEXT
8820
8821     where NAME is the name of the signal, such as `SIGILL' or
8822     `SIGSEGV', and STRING is the explanation of the signal, such as
8823     `Illegal Instruction' or `Segmentation fault'.  INTRO-TEXT,
8824     MIDDLE-TEXT, and END-TEXT are for the user's benefit and have no
8825     particular format.
8826
8827`^Z^Zsignal'
8828     The syntax of this annotation is just like `signalled', but GDB is
8829     just saying that the program received the signal, not that it was
8830     terminated with it.
8831
8832`^Z^Zbreakpoint NUMBER'
8833     The program hit breakpoint number NUMBER.
8834
8835`^Z^Zwatchpoint NUMBER'
8836     The program hit watchpoint number NUMBER.
8837
8838
8839File: gdb.info,  Node: Source Annotations,  Prev: Annotations for Running,  Up: Annotations
8840
8841Displaying Source
8842=================
8843
8844The following annotation is used instead of displaying source code:
8845
8846     ^Z^Zsource FILENAME:LINE:CHARACTER:MIDDLE:ADDR
8847
8848   where FILENAME is an absolute file name indicating which source
8849file, LINE is the line number within that file (where 1 is the first
8850line in the file), CHARACTER is the character position within the file
8851(where 0 is the first character in the file) (for most debug formats
8852this will necessarily point to the beginning of a line), MIDDLE is
8853`middle' if ADDR is in the middle of the line, or `beg' if ADDR is at
8854the beginning of the line, and ADDR is the address in the target
8855program associated with the source which is being displayed.  ADDR is
8856in the form `0x' followed by one or more lowercase hex digits (note
8857that this does not depend on the language).
8858
8859
8860File: gdb.info,  Node: GDB Bugs,  Next: Formatting Documentation,  Prev: GDB/MI,  Up: Top
8861
8862Reporting Bugs in GDB
8863*********************
8864
8865Your bug reports play an essential role in making GDB reliable.
8866
8867   Reporting a bug may help you by bringing a solution to your problem,
8868or it may not.  But in any case the principal function of a bug report
8869is to help the entire community by making the next version of GDB work
8870better.  Bug reports are your contribution to the maintenance of GDB.
8871
8872   In order for a bug report to serve its purpose, you must include the
8873information that enables us to fix the bug.
8874
8875* Menu:
8876
8877* Bug Criteria::                Have you found a bug?
8878* Bug Reporting::               How to report bugs
8879
8880
8881File: gdb.info,  Node: Bug Criteria,  Next: Bug Reporting,  Up: GDB Bugs
8882
8883Have you found a bug?
8884=====================
8885
8886If you are not sure whether you have found a bug, here are some
8887guidelines:
8888
8889   * If the debugger gets a fatal signal, for any input whatever, that
8890     is a GDB bug.  Reliable debuggers never crash.
8891
8892   * If GDB produces an error message for valid input, that is a bug.
8893     (Note that if you're cross debugging, the problem may also be
8894     somewhere in the connection to the target.)
8895
8896   * If GDB does not produce an error message for invalid input, that
8897     is a bug.  However, you should note that your idea of "invalid
8898     input" might be our idea of "an extension" or "support for
8899     traditional practice".
8900
8901   * If you are an experienced user of debugging tools, your suggestions
8902     for improvement of GDB are welcome in any case.
8903
8904
8905File: gdb.info,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: GDB Bugs
8906
8907How to report bugs
8908==================
8909
8910A number of companies and individuals offer support for GNU products.
8911If you obtained GDB from a support organization, we recommend you
8912contact that organization first.
8913
8914   You can find contact information for many support companies and
8915individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
8916
8917   In any event, we also recommend that you submit bug reports for GDB.
8918The prefered method is to submit them directly using GDB's Bugs web
8919page (http://www.gnu.org/software/gdb/bugs/).  Alternatively, the
8920e-mail gateway <bug-gdb@gnu.org> can be used.
8921
8922   *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
8923newsgroups.*  Most users of GDB do not want to receive bug reports.
8924Those that do have arranged to receive `bug-gdb'.
8925
8926   The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
8927serves as a repeater.  The mailing list and the newsgroup carry exactly
8928the same messages.  Often people think of posting bug reports to the
8929newsgroup instead of mailing them.  This appears to work, but it has one
8930problem which can be crucial: a newsgroup posting often lacks a mail
8931path back to the sender.  Thus, if we need to ask for more information,
8932we may be unable to reach you.  For this reason, it is better to send
8933bug reports to the mailing list.
8934
8935   The fundamental principle of reporting bugs usefully is this:
8936*report all the facts*.  If you are not sure whether to state a fact or
8937leave it out, state it!
8938
8939   Often people omit facts because they think they know what causes the
8940problem and assume that some details do not matter.  Thus, you might
8941assume that the name of the variable you use in an example does not
8942matter.  Well, probably it does not, but one cannot be sure.  Perhaps
8943the bug is a stray memory reference which happens to fetch from the
8944location where that name is stored in memory; perhaps, if the name were
8945different, the contents of that location would fool the debugger into
8946doing the right thing despite the bug.  Play it safe and give a
8947specific, complete example.  That is the easiest thing for you to do,
8948and the most helpful.
8949
8950   Keep in mind that the purpose of a bug report is to enable us to fix
8951the bug.  It may be that the bug has been reported previously, but
8952neither you nor we can know that unless your bug report is complete and
8953self-contained.
8954
8955   Sometimes people give a few sketchy facts and ask, "Does this ring a
8956bell?"  Those bug reports are useless, and we urge everyone to _refuse
8957to respond to them_ except to chide the sender to report bugs properly.
8958
8959   To enable us to fix the bug, you should include all these things:
8960
8961   * The version of GDB.  GDB announces it if you start with no
8962     arguments; you can also print it at any time using `show version'.
8963
8964     Without this, we will not know whether there is any point in
8965     looking for the bug in the current version of GDB.
8966
8967   * The type of machine you are using, and the operating system name
8968     and version number.
8969
8970   * What compiler (and its version) was used to compile GDB--e.g.
8971     "gcc-2.8.1".
8972
8973   * What compiler (and its version) was used to compile the program
8974     you are debugging--e.g.  "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP
8975     C Compiler".  For GCC, you can say `gcc --version' to get this
8976     information; for other compilers, see the documentation for those
8977     compilers.
8978
8979   * The command arguments you gave the compiler to compile your
8980     example and observe the bug.  For example, did you use `-O'?  To
8981     guarantee you will not omit something important, list them all.  A
8982     copy of the Makefile (or the output from make) is sufficient.
8983
8984     If we were to try to guess the arguments, we would probably guess
8985     wrong and then we might not encounter the bug.
8986
8987   * A complete input script, and all necessary source files, that will
8988     reproduce the bug.
8989
8990   * A description of what behavior you observe that you believe is
8991     incorrect.  For example, "It gets a fatal signal."
8992
8993     Of course, if the bug is that GDB gets a fatal signal, then we
8994     will certainly notice it.  But if the bug is incorrect output, we
8995     might not notice unless it is glaringly wrong.  You might as well
8996     not give us a chance to make a mistake.
8997
8998     Even if the problem you experience is a fatal signal, you should
8999     still say so explicitly.  Suppose something strange is going on,
9000     such as, your copy of GDB is out of synch, or you have encountered
9001     a bug in the C library on your system.  (This has happened!)  Your
9002     copy might crash and ours would not.  If you told us to expect a
9003     crash, then when ours fails to crash, we would know that the bug
9004     was not happening for us.  If you had not told us to expect a
9005     crash, then we would not be able to draw any conclusion from our
9006     observations.
9007
9008     To collect all this information, you can use a session recording
9009     program such as `script', which is available on many Unix systems.
9010     Just run your GDB session inside `script' and then include the
9011     `typescript' file with your bug report.
9012
9013     Another way to record a GDB session is to run GDB inside Emacs and
9014     then save the entire buffer to a file.
9015
9016   * If you wish to suggest changes to the GDB source, send us context
9017     diffs.  If you even discuss something in the GDB source, refer to
9018     it by context, not by line number.
9019
9020     The line numbers in our development sources will not match those
9021     in your sources.  Your line numbers would convey no useful
9022     information to us.
9023
9024
9025   Here are some things that are not necessary:
9026
9027   * A description of the envelope of the bug.
9028
9029     Often people who encounter a bug spend a lot of time investigating
9030     which changes to the input file will make the bug go away and which
9031     changes will not affect it.
9032
9033     This is often time consuming and not very useful, because the way
9034     we will find the bug is by running a single example under the
9035     debugger with breakpoints, not by pure deduction from a series of
9036     examples.  We recommend that you save your time for something else.
9037
9038     Of course, if you can find a simpler example to report _instead_
9039     of the original one, that is a convenience for us.  Errors in the
9040     output will be easier to spot, running under the debugger will take
9041     less time, and so on.
9042
9043     However, simplification is not vital; if you do not want to do
9044     this, report the bug anyway and send us the entire test case you
9045     used.
9046
9047   * A patch for the bug.
9048
9049     A patch for the bug does help us if it is a good one.  But do not
9050     omit the necessary information, such as the test case, on the
9051     assumption that a patch is all we need.  We might see problems
9052     with your patch and decide to fix the problem another way, or we
9053     might not understand it at all.
9054
9055     Sometimes with a program as complicated as GDB it is very hard to
9056     construct an example that will make the program follow a certain
9057     path through the code.  If you do not send us the example, we will
9058     not be able to construct one, so we will not be able to verify
9059     that the bug is fixed.
9060
9061     And if we cannot understand what bug you are trying to fix, or why
9062     your patch should be an improvement, we will not install it.  A
9063     test case will help us to understand.
9064
9065   * A guess about what the bug is or what it depends on.
9066
9067     Such guesses are usually wrong.  Even we cannot guess right about
9068     such things without first using the debugger to find the facts.
9069
9070
9071File: gdb.info,  Node: Command Line Editing,  Next: Using History Interactively,  Prev: Formatting Documentation,  Up: Top
9072
9073Command Line Editing
9074********************
9075
9076This chapter describes the basic features of the GNU command line
9077editing interface.
9078
9079* Menu:
9080
9081* Introduction and Notation::	Notation used in this text.
9082* Readline Interaction::	The minimum set of commands for editing a line.
9083* Readline Init File::		Customizing Readline from a user's view.
9084* Bindable Readline Commands::	A description of most of the Readline commands
9085				available for binding
9086* Readline vi Mode::		A short description of how to make Readline
9087				behave like the vi editor.
9088
9089
9090File: gdb.info,  Node: Introduction and Notation,  Next: Readline Interaction,  Up: Command Line Editing
9091
9092Introduction to Line Editing
9093============================
9094
9095The following paragraphs describe the notation used to represent
9096keystrokes.
9097
9098   The text `C-k' is read as `Control-K' and describes the character
9099produced when the <k> key is pressed while the Control key is depressed.
9100
9101   The text `M-k' is read as `Meta-K' and describes the character
9102produced when the Meta key (if you have one) is depressed, and the <k>
9103key is pressed.  The Meta key is labeled <ALT> on many keyboards.  On
9104keyboards with two keys labeled <ALT> (usually to either side of the
9105space bar), the <ALT> on the left side is generally set to work as a
9106Meta key.  The <ALT> key on the right may also be configured to work as
9107a Meta key or may be configured as some other modifier, such as a
9108Compose key for typing accented characters.
9109
9110   If you do not have a Meta or <ALT> key, or another key working as a
9111Meta key, the identical keystroke can be generated by typing <ESC>
9112_first_, and then typing <k>.  Either process is known as "metafying"
9113the <k> key.
9114
9115   The text `M-C-k' is read as `Meta-Control-k' and describes the
9116character produced by "metafying" `C-k'.
9117
9118   In addition, several keys have their own names.  Specifically,
9119<DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves
9120when seen in this text, or in an init file (*note Readline Init File::).
9121If your keyboard lacks a <LFD> key, typing <C-j> will produce the
9122desired character.  The <RET> key may be labeled <Return> or <Enter> on
9123some keyboards.
9124
9125
9126File: gdb.info,  Node: Readline Interaction,  Next: Readline Init File,  Prev: Introduction and Notation,  Up: Command Line Editing
9127
9128Readline Interaction
9129====================
9130
9131Often during an interactive session you type in a long line of text,
9132only to notice that the first word on the line is misspelled.  The
9133Readline library gives you a set of commands for manipulating the text
9134as you type it in, allowing you to just fix your typo, and not forcing
9135you to retype the majority of the line.  Using these editing commands,
9136you move the cursor to the place that needs correction, and delete or
9137insert the text of the corrections.  Then, when you are satisfied with
9138the line, you simply press <RET>.  You do not have to be at the end of
9139the line to press <RET>; the entire line is accepted regardless of the
9140location of the cursor within the line.
9141
9142* Menu:
9143
9144* Readline Bare Essentials::	The least you need to know about Readline.
9145* Readline Movement Commands::	Moving about the input line.
9146* Readline Killing Commands::	How to delete text, and how to get it back!
9147* Readline Arguments::		Giving numeric arguments to commands.
9148* Searching::			Searching through previous lines.
9149
9150