Lines Matching refs:GDB

21    This file documents the GNU debugger GDB.
23 This is the Tenth Edition, of `Debugging with GDB: the GNU
24 Source-Level Debugger' for GDB (GDB) Version 7.6.1.
40 File: gdb.info, Node: MiniDebugInfo, Next: Index Files, Prev: Separate Debug Files, Up: GDB Fil…
53 Debug Files::). The example below shows the intended use; however, GDB
57 GDB has support for this extension. If the section exists, then it
59 found, and that GDB was configured with LZMA support.
89 File: gdb.info, Node: Index Files, Next: Symbol Errors, Prev: MiniDebugInfo, Up: GDB Files
91 18.4 Index Files Speed Up GDB
94 When GDB finds a symbol file, it scans the symbols in the file in order
95 to construct an internal symbol table. This lets most GDB operations
97 this delay can be quite lengthy, so GDB provides a way to build an
100 The index is stored as a section in the symbol file. GDB can write
107 Create an index file for each symbol file currently known by GDB.
117 GDB will normally ignore older versions of `.gdb_index' sections
119 are missing a new feature or have performance issues. To tell GDB to
139 File: gdb.info, Node: Symbol Errors, Next: Data Files, Prev: Index Files, Up: GDB Files
144 While reading a symbol file, GDB occasionally encounters problems, such
146 output. By default, GDB does not notify you of such problems, since
149 ill-constructed symbol tables, you can either ask GDB to print only one
151 problem occurs; or you can ask GDB to print more messages, to see how
163 GDB circumvents the problem by treating the inner block as if it
173 GDB does not circumvent this problem, and has trouble locating
184 GDB circumvents the problem by treating the symbol scope block as
191 GDB circumvents the problem by considering the symbol to have the
196 The symbol information contains new data types that GDB does not
200 GDB circumvents the error by ignoring this symbol information.
208 GDB could not find the full definition for a struct or class.
216 GDB could not parse a type specification output by the compiler.
220 File: gdb.info, Node: Data Files, Prev: Symbol Errors, Up: GDB Files
222 18.6 GDB Data Files
225 GDB will sometimes read an auxiliary data file. These files are kept
228 You can set the data directory's name, and view the name GDB is
232 Set the directory which GDB searches for auxiliary data files to
236 Show the directory GDB searches for auxiliary data files.
239 `--with-gdb-datadir' option. If the data directory is inside GDB's
242 installed GDB is moved to a new location.
248 File: gdb.info, Node: Targets, Next: Remote Debugging, Prev: GDB Files, Up: Top
255 Often, GDB runs in the same host environment as your program; in
258 example, running GDB on a physically separate host, or controlling a
261 target types configured for GDB (*note Commands for Managing Targets:
264 It is possible to build GDB for several different "target
265 architectures". When GDB is built like that, you can choose one of the
295 making core file and process mutually exclusive. Otherwise, GDB can
316 Connects the GDB host environment to a target machine or process.
338 GDB uses its own library BFD to read your files. GDB knows
351 `gnutarget' is set to read. If you have not set `gnutarget', GDB
355 Here are some common targets (available, or not, depending on the GDB
367 A remote system connected to GDB via a serial line or network
368 connection. This command tells GDB to use its own remote protocol
372 machine running GDB, you could say:
382 Builtin CPU simulator. GDB includes simulators for most
400 Different targets are available on different configurations of GDB;
417 Enable or disable display of communications messages between GDB
421 Show the current status of displaying communications between GDB
426 GDB, the `load' command may be available. Where it exists, it is
429 `load' also records the FILENAME symbol table in GDB, like the
432 If your GDB does not have a `load' command, attempting to execute
441 Depending on the remote side capabilities, GDB may be able to load
456 to use. However, you may still find it useful to adjust GDB's idea of
460 Instruct GDB to assume the target is big-endian.
463 Instruct GDB to assume the target is little-endian.
466 Instruct GDB to use the byte order associated with the executable.
469 Display GDB's current idea of the target byte order.
483 run GDB in the usual way, it is often useful to use remote debugging.
488 Some configurations of GDB have special serial or TCP/IP interfaces
489 to make this work with particular debugging targets. In addition, GDB
490 comes with a generic serial protocol (specific to GDB, but not specific
493 with GDB.
495 Other remote targets may be available in your configuration of GDB;
512 On the GDB host machine, you will need an unstripped copy of your
513 program, since GDB needs symbol and debugging information. Start up
514 GDB as usual, using the name of the local copy of your program as the
517 GDB can communicate with the target over a serial line, or over an
518 IP network using TCP or UDP. In each case, GDB uses the same protocol
529 If you're using a serial line, you may want to give GDB the
574 If COMMAND closes its standard output (perhaps by exiting), GDB
584 Whenever GDB is waiting for the remote program, if you type the
585 interrupt character (often `Ctrl-c'), GDB attempts to stop the program.
588 character once again, GDB displays this prompt:
593 If you type `y', GDB abandons the remote debugging session. (If you
595 to connect once more.) If you type `n', GDB goes back to waiting.
599 the `detach' command to release it from GDB control. Detaching
602 command, GDB is free to connect to another target.
606 target is generally not resumed. It will wait for GDB (this
608 the `disconnect' command, GDB is again free to connect to another
613 remote monitor. Since GDB doesn't care about the commands it
614 sends like this, this command is the way to extend GDB--you can
625 connection used to communicate with GDB. This is convenient for
634 Copy file HOSTFILE from the host system (the machine running GDB)
652 you to connect your program with a remote GDB via `target remote'--but
657 that GDB itself does. In fact, a system that can run `gdbserver' to
658 connect to a remote GDB could also run GDB locally! `gdbserver' is
660 than GDB itself. It is also easier to port than all of GDB, so you may
668 GDB and `gdbserver' communicate via either a serial line or a TCP
669 connection, using the standard GDB remote serial protocol.
672 not run `gdbserver' connected to any public network; a GDB
682 if necessary to save space. GDB on the host system does all the symbol
685 To use the server, you must tell it how to communicate with GDB; the
694 and communicate with GDB over the serial port `/dev/com1':
698 `gdbserver' waits passively for the host GDB to communicate with it.
705 specifying that you are communicating with the host GDB via TCP. The
711 `telnet').(1) You must use the same port number with the host GDB
753 detach from it, GDB closes the connection and `gdbserver' exits.
757 from it, GDB stays connected to `gdbserver' even though no program is
772 conditions under which `gdbserver' terminates depend on how GDB
785 GDB normally terminates the spawned debugged process on its exit, which
787 Therefore, when the connection drops unexpectedly, and GDB cannot ask
791 When `gdbserver' stays running, GDB can connect to it again later.
793 tracing::. For completeness, at most one GDB can be connected at a
799 connection attempts after connecting to the first GDB session. This
802 connection with remote GDB has closed, even for unexpectedly closed
825 until it executes your program, and then GDB gains control.
841 Run GDB on the host system.
845 `set sysroot' to locate target libraries (unless your GDB was compiled
861 GDB when using `gdbserver', since the program is already on the target.
866 During a GDB session using `gdbserver', you can use the `monitor'
932 `Using GDB to force loading the agent at run time'
956 Start GDB and connect to `gdbserver' like so, and run to main:
988 number of bits. GDB will mask off the address bits above that
1004 If set to on, GDB sends a `BREAK' signal to the remote when you
1006 set to off, GDB sends the `Ctrl-C' character instead. The default
1011 Show whether GDB sends `BREAK' or `Ctrl-C' to interrupt the remote
1049 Restrict GDB to using LIMIT remote hardware breakpoint or
1053 Restrict GDB to using LIMIT bytes for the maximum length of a
1077 Show which of `Ctrl-C', `BREAK' or `BREAK-g' is sent by GDB to
1083 GDB connects to it. This is mostly needed when you debug Linux
1085 known as Magic SysRq g in order to connect GDB.
1088 Show whether interrupt-sequence is sent to remote target when GDB
1093 the remote debugging agent is launched in parallel with GDB; there
1095 accept the connection before GDB attempts to connect. When
1097 GDB reattempts to establish the connection using the timeout
1116 The GDB remote protocol autodetects the packets supported by your
1126 GDB. You may want to report the problem to the GDB developers.
1206 The stub files provided with GDB implement the target side of the
1207 communication protocol, and the GDB side is implemented in the GDB
1233 communicate with the machine where GDB is running (the "host" machine).
1237 GDB already understands how to use this protocol; when everything
1243 that implement the GDB remote serial protocol. The file
1254 These working remote stubs are distributed with GDB:
1272 The `README' file in the GDB distribution may list other recently
1302 communications with GDB on the host machine. This is where the
1304 the GDB representative on the target machine. It begins by
1307 GDB needs, until you execute a GDB command that makes your program
1314 the only way for GDB to get control. For instance, if your target
1317 `handle_exception'--in effect, to GDB. On some machines, simply
1320 your own program--simply running `target remote' from the host GDB
1333 The debugging stubs that come with GDB are set up for a particular chip
1352 If you want GDB to be able to stop your program while it is running,
1355 That is the character which GDB uses to tell the remote system to stop.
1357 Getting the debugging target to return the proper status to GDB
1360 GDB reports a `SIGTRAP' instead of a `SIGINT').
1391 On target machines that have instruction caches, GDB requires this
1441 function in your program, that function is called when `GDB'
1446 4. Compile and link together: your program, the GDB debugging stub for
1450 and the GDB host, and identify the serial port on the host.
1455 7. Start GDB on the host, and connect to the target (*note Connecting
1460 File: gdb.info, Node: Configurations, Next: Controlling GDB, Prev: Remote Debugging, Up: Top
1465 While nearly all GDB commands are available for all native and cross
1508 begins with a dollar sign, GDB searches for a user or system name
1519 memory images, including live systems and crash dumps. GDB uses this
1523 running kernel into GDB and connect to the `kvm' target:
1552 If GDB is configured for an operating system with this facility, the
1573 debugged (the leading `/' still needs to be present, or else GDB
1616 Tell GDB to write `procfs' API trace to the named FILE. GDB
1649 GDB supports native debugging of DJGPP programs, and defines a few
1740 an `int', GDB will add 4 times the value of `__djgpp_base_address'
1761 to remote serial debugging in the DJGPP port of GDB.
1791 GDB supports native debugging of MS Windows programs, including DLLs
1796 typing `C-c'. For this reason, GDB on MS-Windows supports `C-<BREAK>'
1828 If MODE is `on', GDB will break on exceptions that happen inside
1829 the Cygwin DLL. If MODE is `off', GDB will delay recognition of
1833 is `off' to avoid annoying GDB users with false `SIGSEGV' signals.
1836 Displays whether GDB will break on exceptions that happen inside
1895 `kernel32.dll'). When GDB doesn't recognize any debugging symbols in a
1898 symbols, known internally to GDB as "minimal symbols".
1903 program run once to completion. It is also possible to force GDB to
1908 duplicated in GDB's lookup table, which may adversely affect symbol
1926 symbols within GDB are _case-sensitive_ this may cause some confusion.
1950 type information. All that GDB can do is guess whether a symbol refers
1982 program starts execution. However, under these circumstances, GDB can't
2000 This subsection describes GDB commands specific to the GNU Hurd native
2006 GDB. Mach exceptions, such as breakpoint traps, are not affected
2015 This command tells GDB which thread is the `libc' signal thread.
2026 This commands tells GDB that the inferior process is stopped, as
2031 This command shows whether GDB thinks the debuggee is stopped.
2043 This command toggles task suspension when GDB has control.
2045 suspended whenever GDB gets control. Setting it to off will take
2055 GDB detaches from it.
2062 This command sets the task exception port to which GDB will
2067 This command switches GDB to a mode that is the least invasive as
2085 This command toggles current thread suspension when GDB has
2087 current thread is suspended whenever GDB gets control. Setting it
2089 Normally, this command has no effect, since when GDB has control,
2104 This command sets the suspend count GDB will leave on a thread
2106 found by GDB when it notices the thread; use `set thread
2110 Show the suspend count GDB will leave on the thread when detaching.
2119 Normally, GDB's thread suspend counts are relative to the value
2120 GDB finds when it notices each thread. This command changes the
2138 GDB provides the following commands specific to the Darwin target:
2148 When set to a non zero value, enables debugging messages while GDB
2152 internal to GDB and should not be needed in normal usage.
2180 * VxWorks:: Using GDB with VxWorks
2182 GDB includes the ability to debug programs running on various
2188 21.2.1 Using GDB with VxWorks
2197 system as well as adding its symbols in GDB.
2199 GDB enables developers to spawn and debug tasks running on networked
2201 the VxWorks shell can also be debugged. GDB uses code that runs on
2204 name `vxgdb', to distinguish it from a GDB for debugging programs on
2210 seconds GDB waits for responses to rpc's. You might use this if
2218 To use GDB with VxWorks, you must rebuild your VxWorks kernel to
2227 your Unix execution search path to find GDB, you are ready to run GDB.
2231 GDB comes up showing the prompt:
2247 The GDB command `target' lets you connect to a VxWorks target on the
2252 GDB displays messages like these:
2257 GDB then attempts to read the symbol tables of any object modules
2258 loaded into the VxWorks target since it was last booted. GDB locates
2266 with the GDB command `path', and execute the `target' command again.
2275 object that has not yet been loaded, you can use the GDB `load' command
2278 first by the VxWorks target in order to download the code, then by GDB
2291 Then, in GDB, type:
2296 GDB displays a response similar to this:
2302 makes GDB delete all currently-defined breakpoints, auto-displays, and
2331 Whenever a specific embedded processor has a simulator, GDB allows
2371 GDB provides the following ARM-specific commands:
2410 This command forces GDB to use the specified ABI.
2416 GDB uses the symbol table, when available, to determine whether
2417 instructions are ARM or Thumb. This command controls GDB's
2419 default is `auto', which causes GDB to use the current execution
2428 causes GDB to use the symbol table and then the setting of `set
2454 enabled, ADP packets exchanged between GDB and the RDI target
2458 Tell GDB whether the target has ROM at address 0. If on, vector
2476 The GDB ARM simulator accepts the following optional arguments.
2505 The following GDB commands are specific to the M32R monitor:
2520 Set the IP address for the download server, which is the GDB's
2590 Use these GDB commands to connect to the MicroBlaze target processor.
2593 Use this command to connect to the target if you are running GDB
2615 GDB can use the MIPS remote debugging protocol to talk to a MIPS board
2616 attached to a serial line. This is available when you configure GDB
2619 Use these GDB commands to specify the connection to your target
2628 download it. You can then use all the usual GDB commands.
2635 GDB is free software and ...
2641 On some GDB host configurations, you can specify a TCP connection
2662 GDB also supports these special commands for MIPS targets:
2671 need this, you may wish to put the command in your GDB init file).
2672 This tells GDB how to find the return value of functions which
2673 return floating point values. It also allows GDB to avoid saving
2699 GDB is configured for `--target=mips-elf'.)
2701 The timeout set by `set timeout' does not apply when GDB is
2702 waiting for your program to stop. In that case, GDB waits forever
2707 Limit the maximum number of characters GDB should ignore when it
2716 Tell GDB to expect the specified PROMPT string from the remote
2728 Show the current strings GDB expects as the prompt from the remote
2733 This has effect only for the `lsi' target. When on, GDB will
2784 hardware trace. It is very similar to GDB trace, except it does not
2855 GDB supports using the DVC (Data Value Compare) register to implement
2861 The DVC register will be automatically used when GDB detects such
2865 feature is available in native GDB running on a Linux kernel version
2868 When running on PowerPC embedded processors, GDB automatically uses
2885 specifies. To set a ranged breakpoint in GDB, use the `break-range'
2888 GDB provides the following PowerPC-specific commands:
2902 Force GDB to use (or not use) a software floating point calling
2903 convention. By default, GDB selects the calling convention based
2908 Force GDB to use the specified calling convention for vector
2912 registers. By default, GDB selects the calling convention based
2917 Allow GDB to use only one debug register when watching a variable
2933 GDB:
2964 GDB enables developers to debug tasks running on Sparclet targets from
2965 a Unix host. GDB uses code that runs on both the Unix host and on the
2970 GDB supports the option `remotetimeout'. This option is set by
2971 the user, and ARGS represents the number of seconds GDB waits for
2986 Once you have set your Unix execution search path to find GDB, you
2987 are ready to run GDB. From your Unix host, run `gdb' (or
2990 GDB comes up showing the prompt:
3007 The GDB command `file' lets you choose with program to debug.
3011 GDB then attempts to read the symbol table of `prog'. GDB locates
3014 files will be searched as well. GDB locates the source files by
3022 paths with the GDB commands `path' and `dir', and execute the `target'
3031 The GDB command `target' lets you connect to a Sparclet target. To
3038 GDB displays messages like these:
3048 Once connected to the Sparclet target, you can use the GDB `load'
3056 0x12010160 and bss at 0x12010170, in GDB, type:
3063 commands to tell GDB where to map the symbol table.
3071 You can now begin debugging the task using GDB's execution control
3072 commands, `b', `step', `run', etc. See the GDB manual for the list of
3094 example: target remote DEV using GDB standard remote protocol.
3103 When configured for debugging Zilog Z8000 targets, GDB includes a Z8000
3134 You can refer to these values in GDB expressions with the usual
3144 When configured for debugging the Atmel AVR, GDB supports the following
3149 each register, GDB prints its number and value.
3157 When configured for debugging CRIS, GDB provides the following
3190 For the Renesas Super-H processor, GDB provides these commands:
3193 Set the calling-convention used when calling functions from GDB.
3216 uses of GDB with the architecture, both native and cross.
3234 When GDB is debugging the AArch64 architecture, it provides the
3278 sometimes requires GDB to search backward in the object code to find
3282 GDB may be restricted to a slow serial line for this search) you may
3286 Restrict GDB to examining at most LIMIT bytes in its search for
3296 These commands are available _only_ when GDB is configured for
3303 Tell GDB which MIPS ABI is used by the inferior. Possible values
3323 Show the MIPS ABI used by GDB to debug the inferior.
3326 Tell GDB which MIPS compressed ISA (Instruction Set Architecture)
3327 encoding is used by the inferior. GDB uses this for code
3345 GDB uses them in preference to the global compressed ISA encoding
3349 Show the MIPS compressed ISA encoding used by GDB to debug the
3360 lets GDB determine the correct value.
3378 MIPS-specific target code in GDB.
3389 When GDB is debugging the HP PA architecture, it provides the following
3410 When GDB is debugging the Cell Broadband Engine SPU architecture, it
3438 When GDB is debugging a combined PowerPC/SPU application on the Cell
3443 Set whether to stop for new SPE threads. When set to `on', GDB
3452 When set to `on', GDB will automatically cause the SPE
3468 When GDB is debugging the PowerPC architecture, it provides a set of
3478 For POWER7 processors, GDB provides a set of pseudo-registers, the
3482 File: gdb.info, Node: Controlling GDB, Next: Extending GDB, Prev: Configurations, Up: Top
3484 22 Controlling GDB
3487 You can alter the way GDB interacts with you by using the `set'
3488 command. For commands controlling how GDB displays data, see *note
3505 File: gdb.info, Node: Prompt, Next: Editing, Up: Controlling GDB
3510 GDB indicates its readiness to read a command by printing a string
3513 debugging GDB with GDB, it is useful to change the prompt in one of the
3514 GDB sessions so that you can always tell which one you are talking to.
3521 Directs GDB to use NEWPROMPT as its prompt string henceforth.
3526 Versions of GDB that ship with Python scripting enabled have prompt
3549 File: gdb.info, Node: Editing, Next: Command History, Prev: Prompt, Up: Controlling GDB
3554 GDB reads its input commands via the "Readline" interface. This GNU
3560 You may control the behavior of command line editing in GDB with the
3578 File: gdb.info, Node: Command History, Next: Screen Size, Prev: Editing, Up: Controlling GDB
3583 GDB can keep track of the commands you type during your debugging
3585 these commands to manage the GDB command history facility.
3587 GDB uses the GNU History library, a part of the Readline package, to
3591 To issue a command to GDB without affecting certain aspects of the
3594 history, nor will it affect GDB's notion of which command to repeat if
3601 Here is the description of GDB commands related to command history.
3604 Set the name of the GDB command history file to FNAME. This is
3605 the file where GDB reads an initial command history list, and
3623 Set the number of commands which GDB keeps in its history list.
3652 These commands display the state of the GDB history parameters.
3665 File: gdb.info, Node: Screen Size, Next: Numbers, Prev: Command History, Up: Controlling GDB
3670 Certain commands to GDB may produce large amounts of information output
3671 to the screen. To help you read all of it, GDB pauses and asks you for
3675 Depending on what is being printed, GDB tries to break the line at a
3679 Normally GDB knows the size of the screen from the terminal driver
3680 software. For example, on Unix GDB uses the termcap data base together
3693 If you specify a height of zero lines, GDB does not pause during
3697 Likewise, you can specify `set width 0' to prevent GDB from
3704 running GDB with the `--batch' option (*note -batch: Mode
3711 File: gdb.info, Node: Numbers, Next: ABI, Prev: Screen Size, Up: Controlling GDB
3716 You can always enter numbers in octal, decimal, or hexadecimal in GDB
3761 File: gdb.info, Node: ABI, Next: Auto-loading, Prev: Numbers, Up: Controlling GDB
3766 GDB can determine the "ABI" (Application Binary Interface) of your
3768 conclusions. Use these commands to manage GDB's view of the current
3771 One GDB configuration can debug binaries for multiple operating
3772 system targets, either via remote debugging or native emulation. GDB
3780 When GDB is debugging the AArch64 architecture, it provides a
3802 indicate whether a function is prototyped. If GDB calls a function
3818 GDB needs to know the ABI used for your program's C++ objects. The
3820 application. GDB only fully supports programs with a single C++ ABI;
3821 if your program contains code using multiple C++ ABI's or if GDB can
3822 not identify your program's ABI correctly, you can tell GDB which ABI
3839 File: gdb.info, Node: Auto-loading, Next: Messages/Warnings, Prev: ABI, Up: Controlling GDB
3844 GDB sometimes reads files with commands and settings automatically,
3847 GDB to the needs of your project, it can sometimes produce unexpected
3855 For these reasons, GDB includes commands and options to let you
3867 directories). To prevent GDB from auto-loading even those init
3901 These are various kinds of files GDB can automatically load:
3918 These are GDB control commands for the auto-loading:
3923 *Note set auto-load gdb-scripts::. Control for GDB command scripts.
3924 *Note show auto-load gdb-scripts::. Show setting of GDB command scripts.
3925 *Note info auto-load gdb-scripts::. Show state of GDB command scripts.
3926 *Note set auto-load Control for GDB Python scripts.
3928 *Note show auto-load Show setting of GDB Python scripts.
3930 *Note info auto-load Show state of GDB Python scripts.
3932 *Note set auto-load Control for GDB auto-loaded scripts
3934 *Note show auto-load Show GDB auto-loaded scripts
3970 By default, GDB reads and executes the canned sequences of commands
3998 GDB reads in some cases thread debugging library from places specific
4004 `libthread-db-search-path' entries GDB checks first if `set auto-load
4031 GDB tries to load an `OBJFILE-gdb.gdb' file containing canned sequences
4051 GDB auto-loaded.
4063 submitted by an application user) GDB does not always load any files
4064 automatically. GDB provides the `set auto-load safe-path' setting to
4080 To instruct GDB to go ahead and use the init files anyway, invoke GDB
4096 GDB compilation.
4115 be also overriden by GDB configuration option
4119 corresponding GDB configuration option is
4127 To force GDB to load the files it declined to load in the previous
4138 single GDB session.
4141 Disable auto-loading safety for a single GDB session. This
4142 assumes all the files you debug during this GDB session will come
4146 During compilation of GDB you may disable any auto-loading safety.
4147 This assumes all the files you will ever debug with this GDB come
4154 You can use GDB command-line option for a single GDB session.
4162 entry matches GDB tries as a last resort to also resolve all the file
4164 and compare the entries again. GDB already canonicalizes most of the
4176 against accidental execution of untrusted scripts -- GDB provides a
4203 ….info, Node: Messages/Warnings, Next: Debugging Output, Prev: Auto-loading, Up: Controlling GDB
4208 By default, GDB is silent about its inner workings. If you are running
4210 makes GDB tell you when it does a lengthy internal operation, so you
4218 Enables GDB output of certain informational messages.
4221 Disables GDB output of certain informational messages.
4226 By default, if GDB encounters bugs in the symbol table of an object
4232 Permits GDB to output LIMIT complaints about each type of unusual
4238 Displays how many symbol complaints GDB is permitted to produce.
4241 By default, GDB is cautious, and asks what sometimes seems to be a
4253 Disables confirmation requests. Note that running GDB with the
4279 … Node: Debugging Output, Next: Other Misc Settings, Prev: Messages/Warnings, Up: Controlling GDB
4284 GDB has commands that enable optional debugging messages from various
4285 GDB subsystems; normally these commands are of interest to GDB
4291 completion. When on, GDB will print a message when an
4322 DWARF debugging information for C++, GDB attempts to compute each
4323 entity's name. GDB can do this computation in two different ways,
4325 this setting causes GDB to compute the names both ways and display
4354 Turns on or off display of GDB debugging info for the displaced
4358 Displays the current state of displaying GDB debugging info
4362 Turns on or off display of GDB event debugging info. The default
4366 Displays the current state of displaying GDB event debugging info.
4369 Turns on or off display of debugging info about GDB expression
4373 Displays the current state of displaying debugging info about GDB
4377 Turns on or off display of GDB frame debugging info. The default
4381 Displays the current state of displaying GDB frame debugging info.
4390 Turns on or off display of GDB debugging info for running the
4391 inferior. The default is off. `infrun.c' contains GDB's runtime
4396 Displays the current state of GDB inferior debugging.
4402 Displays the current state of GDB JIT debugging.
4428 Turns on or off display of GDB observer debugging. This includes
4435 Turns on or off display of GDB C++ overload debugging info. This
4440 Displays the current state of displaying GDB C++ overload
4455 printed on the GDB standard output stream. The default is off.
4461 Turns on or off display of GDB serial debugging info. The default
4465 Displays the current state of displaying GDB serial debugging info.
4482 Turns on or off display of GDB target debugging info. This info
4483 includes what is going on at the target level of GDB, as it
4490 Displays the current state of displaying GDB target debugging info.
4493 Turns on or off display of timestamps with GDB debugging info.
4498 Displays the current state of displaying timestamps with GDB
4502 Turns on or off display of GDB variable object debugging info. The
4506 Displays the current state of displaying GDB variable object
4516 File: gdb.info, Node: Other Misc Settings, Prev: Debugging Output, Up: Controlling GDB
4522 If `on', forces GDB to assume that GDB was started in a terminal.
4523 In practice, this means that GDB should wait for the user to
4525 prompt. If `off', forces GDB to operate in the opposite mode, and
4527 default), GDB tries to determine whether its standard input is a
4533 useful in certain specific cases, such as running a MinGW GDB
4541 File: gdb.info, Node: Extending GDB, Next: Interpreters, Prev: Controlling GDB, Up: Top
4543 23 Extending GDB
4546 GDB provides three mechanisms for extension. The first is based on
4547 composition of GDB commands, the second is based on the Python
4551 To facilitate the use of the first two extensions, GDB is capable of
4552 evaluating the contents of a file. When doing so, GDB can recognize
4555 treated as a GDB Command Files. *Note Command files: Command Files.
4557 You can control how GDB evaluates these files with the following
4561 All scripts are always evaluated as GDB Command Files.
4565 extension. If this scripting language is supported, GDB evaluates
4567 as a GDB Command File.
4581 * Python:: Scripting GDB using Python
4585 File: gdb.info, Node: Sequences, Next: Python, Up: Extending GDB
4591 Commands.), GDB provides two ways to store sequences of commands for
4607 A "user-defined command" is a sequence of GDB commands to which you
4646 The definition of the command is made up of other GDB command
4663 Used inside a user-defined command, this tells GDB that this
4674 Display the GDB commands used to define COMMANDNAME (but not its
4682 levels are allowed in user-defined commands before GDB suspects an
4695 GDB commands that normally print messages to say what they are doing
4755 You can define a hook for any single-word command in GDB, but not
4763 GDB commands stops and GDB issues a prompt (before the command that you
4775 A command file for GDB is a text file made of lines that are GDB
4783 configured using the `script-extension' setting. *Note Extending GDB:
4784 Extending GDB.
4795 GDB first searches for FILENAME in the current directory. If the
4797 then GDB also looks for the file on the source search path (specified
4801 If `-s' is specified, then GDB searches for FILENAME on the search
4805 `/home/user' then GDB will look for the script
4808 search path contains `/home/user' then GDB will look for the script
4812 `c:/tmp' then GDB will look for the script `c:/tmp/myscript'.
4814 If `-v', for verbose mode, is given then GDB displays each command
4819 proceed without asking when used in a command file. Many GDB commands
4823 GDB also accepts command input from standard input. In this mode,
4839 built, etc. GDB provides a set of flow-control commands to deal with
4884 GDB output is suppressed; the only output that appears is what is
4964 underlying `C' implementation used to build GDB supports the `long
4983 If the underlying `C' implementation used to build GDB has support
4985 as width and precision will also be available for GDB to use.
5000 File: gdb.info, Node: Python, Next: Aliases, Prev: Sequences, Up: Extending GDB
5002 23.2 Scripting GDB using Python
5005 You can script GDB using the Python programming language
5006 (http://www.python.org/). This feature is available only if GDB was
5009 Python scripts used by GDB should be installed in
5011 determined at GDB startup (*note Data Files::). This directory, known
5016 Additionally, GDB commands and convenience functions which are
5020 imported when GDB starts.
5024 * Python Commands:: Accessing Python from GDB.
5025 * Python API:: Accessing GDB from Python.
5027 * Python modules:: Python modules provided by GDB.
5035 GDB provides two commands for accessing the Python interpreter, and one
5041 to start an interactive Python prompt. To return to GDB, type the
5076 By default, GDB will print only the message component of a Python
5083 It is also possible to execute a Python script from the GDB
5087 The script name must end with `.py' and GDB must be configured to
5089 the `script-extension' setting. *Note Extending GDB: Extending
5090 GDB.
5102 At startup, GDB overrides Python's `sys.stdout' and `sys.stderr' to
5103 print using GDB's output-paging streams. A Python program which
5115 * Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
5119 * Events In Python:: Listening for events from GDB.
5122 * Parameters In Python:: Adding new GDB parameters.
5142 GDB introduces a new Python module, named `gdb'. All methods and
5143 classes added by GDB are placed in this module. GDB automatically
5151 Evaluate COMMAND, a string, as a GDB CLI command. If a GDB
5155 FROM_TTY specifies whether GDB ought to consider this command as
5159 By default, any output produced by COMMAND is sent to GDB's
5163 `None'. If TO_STRING is `True', the GDB virtual terminal will be
5168 Return a sequence holding all of GDB's breakpoints. *Note
5172 Return the value of a GDB parameter. PARAMETER is a string naming
5183 Return a value from GDB's value history (*note Value History::).
5185 negative, then GDB will take its absolute value and count backward
5187 value to return. If NUMBER is zero, then GDB will return the most
5213 Put EVENT, a callable object taking no arguments, into GDB's
5215 point, during GDB's event processing. Events posted using
5218 relative to other events inside GDB.
5220 GDB is not thread-safe. If your Python program uses multiple
5221 threads, you must be careful to only call GDB-specific functions
5222 in the main GDB thread. `post_event' ensures this. For example:
5247 Print a string to GDB's paginated output stream. The optional
5249 GDB's standard output stream. Possible stream values are:
5252 GDB's standard output stream.
5255 GDB's standard error stream.
5258 GDB's log stream (*note Logging Output::).
5265 Flush the buffer of a GDB paginated stream so that the contents
5266 are displayed immediately. GDB will flush the contents of a
5269 stream is GDB's standard output stream. Possible stream values
5273 GDB's standard output stream.
5276 GDB's standard error stream.
5279 GDB's log stream (*note Logging Output::).
5309 provided, it is decoded the way that GDB's inbuilt `break' or
5313 If PROMPT_HOOK is callable, GDB will call the method assigned to
5314 this operation before a prompt is displayed by GDB.
5316 The parameter `current_prompt' contains the current GDB prompt.
5318 is returned, the GDB prompt will be set to that string. If `None'
5319 is returned, GDB will continue to use the current prompt.
5321 Some prompts cannot be substituted in GDB. Secondary prompts such
5332 the Python code are translated to calls to GDB error-reporting
5334 error, GDB will terminate it and print an error message containing the
5343 GDB errors that happen in GDB commands invoked by Python code are
5348 This is the base class for most exceptions generated by GDB. It
5350 versions of GDB.
5352 If an error occurring in GDB does not fit into some more specific
5363 In all cases, your exception handler will see the GDB error message
5365 statement closest to where the GDB error occured as the traceback.
5367 When implementing GDB commands in Python via `gdb.Command', it is
5394 GDB provides values it obtains from the inferior program in an object
5395 of type `gdb.Value'. GDB uses this object for its internal bookkeeping
5463 `gdb.Value' has not yet been fetched from the inferior. GDB does
5638 encoding that GDB does recognize, GDB will raise an error.
5640 When a lazy string is printed, the GDB encoding machinery is used
5642 argument is not provided, or is an empty string, GDB will
5644 type. For further information on encoding in GDB please see *note
5669 GDB represents types from the inferior using the class `gdb.Type'.
5792 the type does not have a range, GDB will raise a `gdb.error'
5914 A function internal to GDB. This is the type used to represent
5932 GDB will call this method on a pretty-printer to compute the
5939 any Python object which is convertible to a GDB value.
5941 This method is optional. If it does not exist, GDB will act as
5953 Some display hints are predefined by GDB:
5968 some kind, then GDB will call its internal language-specific
5974 GDB will call this method to display the string representation of
5978 GDB will prepend its result to the values returned by `children'.
5988 GDB prints this value. This may result in a call to another
5992 to a `gdb.Value', then GDB performs the conversion and prints the
6002 GDB provides a function which can be used to look up the default
6028 GDB first checks the `pretty_printers' attribute of each
6032 objfile lists, GDB then searches the pretty-printer list of the current
6048 GDB provides support for enabling and disabling individual printers.
6102 This practice will enable GDB to load multiple versions of your
6115 GDB is able to load both sets of printers simultaneously. Then,
6118 with a specific objfile, GDB will find the correct printers for the
6198 Finally, when this printer is loaded into GDB, here is the
6213 GDB provides a way for Python code to customize type display. This is
6231 This is called by GDB at the start of type-printing. It is only
6235 When displaying a type, say via the `ptype' command, GDB will
6241 GDB will call the `instantiate' method of each enabled type printer.
6245 Then, when GDB is going to display a type name, it iterates over the
6255 GDB uses this two-pass approach so that type printers can
6269 Programs which are being run under GDB are called inferiors (*note
6271 and manipulate inferiors controlled by GDB via objects of the
6286 ID of inferior, as assigned by GDB.
6294 or started by GDB itself.
6301 no longer exists within GDB. All other `gdb.Inferior' methods
6339 GDB provides a general event facility so that Python code can be
6381 Some events can be thread specific when GDB is running in non-stop
6405 unavailable if, for example, GDB detaches from the inferior.)
6417 `gdb.StopEvent' will indicate the stopped thread when GDB is
6430 command `info signals' in the GDB command prompt.
6450 has been loaded by GDB. `gdb.NewObjFileEvent' has one attribute:
6465 threads controlled by GDB, via objects of the `gdb.InferiorThread'
6488 ID of the thread, as assigned by GDB.
6508 This changes GDB's currently selected thread to the one represented
6526 You can implement new GDB CLI commands in Python. A CLI command is
6533 with GDB. This initializer is normally invoked from the subclass'
6544 below. This argument tells GDB how to categorize the new command
6549 tells GDB how to perform completion for this command. If not
6550 given, GDB will attempt to complete using the object's `complete'
6564 By default, a GDB command is repeated when the user enters a blank
6570 This method is called by GDB when this command is invoked.
6579 If this method throws an exception, it is turned into a GDB
6583 `gdb.string_to_argv'. This function behaves identically to GDB's
6593 This method is called by GDB when the user attempts completion on
6612 defined below, then the corresponding GDB-internal completion
6632 running' at the GDB prompt to see a list of commands in this
6638 GDB prompt to see a list of commands in this category.
6643 `help stack' at the GDB prompt to see a list of commands in this
6649 files' at the GDB prompt to see a list of commands in this
6654 things that are useful to the user when interacting with GDB, but
6657 the GDB prompt to see a list of commands in this category.
6661 state of GDB itself. For example, `info', `macro', and `show' are
6662 in this category. Type `help status' at the GDB prompt to see a
6668 breakpoints' at the GDB prompt to see a list of commands in this
6674 tracepoints' at the GDB prompt to see a list of commands in this
6680 user-defined' at the GDB prompt to see a list of commands in this
6686 `stop' are in this category. Type `help obscure' at the GDB
6690 The command is only useful to GDB maintainers. The `maintenance'
6692 internals' at the GDB prompt to see a list of commands in this
6711 This constant means that completion should examine GDB command
6733 registration of the command with GDB. Depending on how the Python code
6734 is read into GDB, you may need to import the `gdb' module explicitly.
6742 You can implement new GDB parameters using Python. A new parameter is
6748 There are many parameters that already exist and can be set in GDB.
6750 parameters influences certain behavior in GDB. Similarly, you can
6757 with GDB. This initializer is normally invoked from the subclass'
6765 parameter can subsequently be accessed in GDB as `set print foo'.
6771 Commands In Python::). This argument tells GDB how to categorize
6775 below. This argument tells GDB the type of the new parameter;
6803 It can be read and assigned to just as any other attribute. GDB
6810 GDB will call this method when a PARAMETER's value has been
6816 GDB will call this method when a PARAMETER's `show' API has been
6879 GDB. The argument NAME is the name of the function, a string.
6890 `invoke' method is called. Note that GDB does not predetermine
6916 registration of the function with GDB. Depending on how the Python
6917 code is read into GDB, you may need to import the `gdb' module
6944 Return a sequence of all the progspaces currently known to GDB.
6970 GDB loads symbols for an inferior from various symbol-containing files
6973 (*note Separate Debug Files::). GDB calls these symbol-containing
6981 GDB sets the "current objfile" to the corresponding objfile. This
6986 Return a sequence of all the objfiles current known to GDB. *Note
7012 it refers to is not loaded in GDB any longer. All other
7022 When the debugged program stops, GDB is able to analyze its call stack
7026 an invalid frame object, GDB will throw a `gdb.error' exception (*note
7046 Return a string explaining the reason why GDB stopped unwinding
7072 A fake stack frame that was created by GDB when performing an
7133 future GDB versions. Using it, you could write:
7178 Within each frame, GDB maintains information on each block stored in
7183 technical information on GDB's book-keeping of the stack.
7188 since changes in GDB features and infrastructure may cause symbols move
7249 GDB represents every variable, function and type as an entry in a
7251 Python represents these symbols in GDB with the `gdb.Symbol' object.
7315 asked GDB to display demangled or mangled names.
7344 refers to does not exist in GDB any longer. All other
7361 in the symbol information or in GDB's handling of symbols.
7388 in the symbol information or in GDB's handling of symbols.
7443 Access to symbol table data maintained by GDB on the inferior is
7448 For more information on GDB's symbol table management, see *note
7475 GDB any longer. All other `gdb.Symtab_and_line' methods will
7494 it refers to does not exist in GDB any longer. All other