Show Table of Contents
A.6. Changes in GDB
Red Hat Developer Toolset 4.0 is distributed with GDB 7.10, which provides a number of bug fixes and improvements over the Red Hat Enterprise Linux system version and the version included in the previous release of Red Hat Developer Toolset. Below is a comprehensive list of new features in this release.
A.6.1. Changes Since Red Hat Developer Toolset 3.1
The following features have been added since the release of GDB in Red Hat Developer Toolset 3.1:
New Features
- GDB now honors the content of the
/proc/file (PID/coredump_filterPIDis the process ID). This file can be used to specify the types of memory mappings that will be included in a corefile. For more information, please see the core(5) manual page.GDB also has a new command:set use-coredump-filter on|off. It allows to set whether GDB reads the content of the/proc/file when generating a corefile.PID/coredump_filter - The
info oscommand can now be used to display information about CPUs. Runinfo os cpusto list all CPUs and cores on the system. - The
info sourcecommand can now be used to display the producer string (if it was included in the debugging information). The string usually contains the compiler version and command-line arguments. - Directory names supplied to the
set sysrootcommands may be prefixed withtarget:to instruct GDB to access shared libraries from the target system, regardless of whether it is local or remote. This replaces theremote:prefix. The default system root has been changed from "" (empty) totarget:. For backward compatibility,remote:is automatically converted totarget:. - The system root specified by the
set sysrootcommand is prepended to the filename of the main executable (if reported to GDB as absolute by the operating system) when starting processes remotely and when attaching to already-running local or remote processes. - GDB now supports automatic location and retrieval of executable files from remote targets. Remote debugging can now be initiated using only the
target remoteortarget extended-remotecommands (noset sysrootorfilecommands are required). See also the section called “New Remote Packets” below. - Support for the Verilog hexadecimal format has been added to the
dumpcommand. - GDB and gdbserver are now able to access executable and shared library files without the
set sysrootcommand when attaching to processes running in different mount namespaces from the debugger. This makes it possible to attach to processes in containers as simply asgdb -p PIDorgdbserver --attach PID. See also the section called “New Remote Packets” below. - Support for completion for all of the available register groups, including target-specific groups, has been added to the
tui regcommand. - The size of GDB's command history is no longer determined by reading the
HISTSIZEenvironment variable. Instead, the dedicatedGDBHISTSIZEenvironment variable is now used. To disable truncation of command history, setGDBHISTSIZEto-1or leave it empty. Non-numeric values are ignored. - Support for fork events on extended-remote Linux targets has been added. This makes it possible to use the
follow-fork-modeanddetach-on-forkoptions on targets with Linux kernels 2.5.60 and higher for both theforkandvforkcalls, as well asforkandvforkcatchpoints. - Using new
gdbfeatures(fork-eventsandvfork-events), theqSupportedpacket allows GDB to request support forforkandvforkevents, and theqSupportedresponse can contain the correspondingstubfeatures. Standardsetandshowcommands can be used to set and display whether these features are enabled. - The
info recordcommand now displays the format of the recording and when the btrace record target is used, it also shows the branch-tracing configuration for the current thread. In case of the BTS format, the command displays the ring buffer size. - Support for DTrace USDT (Userland Static Defined Tracing) probes has been added.
- GDB now supports the compilation and injection of source code into the inferior. GDB will use GCC 5.0 or higher built with
libcc1.soto compile the source code to object code, and if successful, inject and execute that code within the current context of the inferior. Currently, the C language is supported. The commands used for interfacing with this new feature are:compile code [-raw|-r] [--] [source code]
compile file [-raw|-r] filename - The
dll-symbolscommand and its two aliases (add-shared-symbol-filesandassf) have been removed. Use thesharedlibrarycommand or its aliasshareinstead. - On resume, GDB now always passes the signal the program had stopped for to the thread the signal was sent to, even if the user changed threads before resuming. Previously, GDB would often (but not always) deliver the signal to the thread that happened to be current at resume time.
- Conversely, the
signalcommand now consistently delivers the requested signal to the current thread. GDB now asks for confirmation if the program had stopped for a signal, and the user switched threads meanwhile. - The
offandautostates of thebreakpoint always-insertedmode have been merged into one. Now, when thebreakpoint always-insertedmode is set tooff, GDB does not remove breakpoints from the target until all threads stop, even in non-stop mode. Theautomode has been removed, andoffis now the default mode. - The
--xdbcommand-line option (HP-UX XDB compatibility mode) has been removed.
New Remote Packets
A number of new remote packets have been added. See Table A.1, “New Remote Packets” for a complete list.
Table A.1. New Remote Packets
| Remote Packet | Description |
|---|---|
qXfer:btrace-conf:read | Return the branch-trace configuration for the current thread. |
Qbtrace-conf:bts:size | Set the requested ring-buffer size for branch tracing in the BTS format. |
swbreak stop reason | Indicates a memory breakpoint instruction was executed, irrespective of whether it was GDB that planted the breakpoint or the breakpoint was hardcoded in the program. This is required for correct non-stop mode operation. |
hwbreak stop reason | Indicates the target stopped for a hardware breakpoint. This is required for correct non-stop mode operation. |
vFile:fstat: | Return information about files on the remote system. |
qXfer:exec-file:read | Return the full absolute name of the file that was executed to create a process running on the remote system. |
vFile:setfs: | Select the file system on which vFile: operations with file name arguments will operate. This is required for GDB to be able to access files on remote targets where the remote stub does not share a common file system with the inferior(s). |
fork stop reason | Indicates that a fork system call was executed. |
vfork stop reason | Indicates that a vfork system call was executed. |
vforkdone stop reason | Indicates that a vfork child of the specified process has executed an exec or exit function, allowing the vfork parent to resume execution. |
Python Scripting Support
Python scripting support has been improved:
- Objects of the
gdb.Objfileclass have a new attribute,username, which is the user-specified name of the objfile. - Support for writing frame unwinders in Python has been added.
- A new method,
optimized_out, has been added togdb.Typeobjects. It is used for returning the optimized outgdb.Valueinstance of this type. - New methods,
reference_valueandconst_value, have been added togdb.Valueobjects. They are used to return a reference to the value and theconstversion of the value, respectively. - Auto-loading of Python scripts contained in the
.debug_gdb_scriptsspecial section is now supported. Xmethodscan now specify the type of the result.- You can now access frame registers from Python scripts.
- The
producerattribute forgdb.Symtabobjects has been added. - The
progspaceattribute forgdb.Objfileobjects has been added. It is thegdb.Progspaceobject of the containing program space. - The
ownerattribute forgdb.Objfileobjects has been added. - The
build_idattribute forgdb.Objfileobjects has been added. It is the build ID generated when the file was built. - The
add_separate_debug_filemethod has been added togdb.Objfileobjects. - A new event,
gdb.clear_objfiles, has been added. It is triggered when a new file for debugging is selected. - You can now add attributes to
gdb.Objfileandgdb.Progspaceobjects. - A new function,
gdb.lookup_objfile, has been added.
The following new events are triggered when the state of the inferior is modified by GDB.
- gdb.events.inferior_call_pre
- Function call is about to be made.
- gdb.events.inferior_call_post
- Function call has just been made.
- gdb.events.memory_changed
- A memory location has been altered.
- gdb.events.register_changed
- A register has been altered.
The following new Python-based convenience functions have been added.
$_caller_is(name [, number_of_frames])$_caller_matches(regexp [, number_of_frames])$_any_caller_is(name [, number_of_frames])$_any_caller_matches(regexp [, number_of_frames])
New Commands
The following new commands have been added:
set serial parity odd|even|none,show serial parity- Set or show parity for remote serial I/O.
maint print symbol-cache- Print the contents of the symbol cache.
maint print symbol-cache-statistics- Print statistics of symbol cache usage.
maint flush-symbol-cache- Flush the contents of the symbol cache.
record btrace bts,record bts- Begin branch-trace recording using the Branch Trace Store (BTS) format.
tui enable,tui disable- Enable or and disable the TUI (Text User Interface) mode.
set mpx bound,show mpx bound- Investigate bound tables in Intel(R) MPX-enabled applications.
maint info btrace- Display information about branch-tracing internals.
maint btrace packet-history- Display raw branch-tracing data.
maint btrace clear-packet-history- Discard stored raw branch-tracing data.
maint btrace clear- Discard all branch-tracing data. The next invocation of the
recordcommand will fetch and process it again. demangle [-l language] [--] name- Demangle name in the specified language or the current language if the parameter is omitted. This command replaces the renamed
maint demanglecommand. The old command name is kept as a no-op command to avoidmaint demanglebeing interpreted asmaint demangler-warning. queue-signal signal-name-or-number- Queue a signal to be delivered to the thread when it is resumed.
maint print user-registers- Display all currently available user registers.
compile code [-r|-raw] [--] [source code]- Compile, inject, and execute in the inferior the executable object code produced by compiling the provided source code.
compile [file -r|-raw] filename- Compile and inject into the inferior the executable object code produced by compiling the source code stored in the filename provided.
compile print- Evaluate an expression using the compiler and display the result.
New Options
The following new options have been added:
set debug dwarf-die,show debug dwarf-die- Renamed from
set debug dwarf2-dieandshow debug dwarf2-dierespectively. set debug dwarf-read,show debug dwarf-read- Renamed from
set debug dwarf2-readandshow debug dwarf2-readrespectively. maint set dwarf always-disassemble,maint show dwarf always-disassemble- Renamed from
maint set dwarf2 always-disassembleandmaint show dwarf2 always-disassemblerespectively. maint set dwarf max-cache-age,maint show dwarf max-cache-age- Renamed from
maint set dwarf2 max-cache-ageandmaint show dwarf2 max-cache-agerespectively. set debug dwarf-line,show debug dwarf-line- Control display of debugging info regarding DWARF line processing.
set max-completions,show max-completions- Set the maximum number of candidates to be considered during completion. The default value is
200. This limit allows GDB to avoid generating large completion lists, the computation of which can cause the debugger to become temporarily unresponsive. set history remove-duplicates,show history remove-duplicates- Control the removal of duplicate history entries.
maint set symbol-cache-size,maint show symbol-cache-size- Control the size of the symbol cache.
set record btrace bts buffer-size,show record btrace bts buffer-size- Set and show the size of the ring buffer used for branch tracing in the BTS format. The obtained size may differ from the requested size. To see the obtained buffer size, use the
info recordcommand. set debug linux-namespaces,show debug linux-namespaces- Control display of debugging info regarding Linux namespaces.
set debug symbol-lookup,show debug symbol-lookup- Control display of debugging info regarding symbol lookup.
The
thread apply all command now supports a new option, -ascending, for calling its specified command for all threads in an ascending order.
Change in the Machine Interface Interpreter (GDB/MI)
The following change has been made the GDB/MI.
- The
-list-thread-groupscommand outputs an exit-code field for inferiors that have exited.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.