B.5. Changes in GDB
Red Hat Developer Toolset 3.0 is distributed with GDB 7.8, which provides a number of improvements and bug fixes over the Red Hat Enterprise Linux system versions and the version included in the previous release of Red Hat Developer Toolset. Below is a comprehensive list of new features in this release.
B.5.1. Changes Since Red Hat Enterprise Linux 6.6
The following features have been added since the release of GDB in Red Hat Enterprise Linux 6.6:
New Features
- Support for linespecs has been improved (in particular, a more consistent handling of ambiguous linespecs, some support for labels in the program's source, and FILE:LINE support now extends to further linespecs types). Breakpoints are now set on all matching locations in all inferiors and will be updated according to changes in the inferior.
- New inferior control commands
skip functionandskip filehave been added. These commands can be uses to skip certain functions and files when stepping. - The
info threadscommand now displays the thread name as set byprctlorpthread_setname_np. In addition, new commandsthread nameandthread findhave been added. Thethread namecommand accepts a name as an argument and can be used to set the name of the current thread. Thethread findcommand accepts a regular expression and allows the user to find threads that match it. - GDB now provides support for reading and writing a new
.gdb_indexsection. The commandgdb-add-indexcan be used to add.gdb_indexto a file, which allows GDB to load symbols from that file faster. Note that this feature is already present in Red Hat Enterprise Linux 6.1 and later. - The
watchcommand has been adapted to accept-locationas an optional argument. - Two new special values can now be used when specifying the current search path for
libthread_db:$sdirrepresents the default system locations of shared libraries, and$pdirstands for the directory with thelibthreadthat is used by the application. - The
info macrocommand now accepts-alland--as valid options. - To display a function parameter's entry value (that is, the value at the time of function entry), the suffix
@entrycan be added to the parameter. GDB now displays@entryvalues in backtraces, if available. - The
watchcommand now acceptsmask mask_valueas an argument. This can be used to create masked watchpoints. - The
info oscommand has been changed and can now display information on several objects managed by the operating system, in particular:- The
info os procgroupscommand lists process groups. - The
info os filescommand lists file descriptors. - The
info os socketscommand lists internet-domain sockets. - The
info os shmcommand lists shared-memory regions. - The
info os semaphorescommand lists semaphores. - The
info os msgcommand lists message queues. - The
info os modulescommand lists loaded kernel modules.
- GDB now has support for Static Defined Tracing (SDT) probes. Currently, the only implemented back end is for SystemTap probes (the
sys/sdt.hheader file). You can set a breakpoint by using the new-probe,-pstap, or-probe-stapoptions, and inspect the probe arguments by using the new$_probe_argfamily of convenience variables. - The
symbol-reloadingoption has been deleted. gdbservernow supports STDIO connections, for example:(gdb)
target remote | ssh myhost gdbserver - hello- GDB is now able to print flag enums. In a flag enum, all enumerator values have no bits in common when pairwise AND-ed. When GDB prints a value whose type is a flag enum, GDB shows all the constants; for example, for enum
E { ONE = 1, TWO = 2}:(gdb)
print (enum E) 3$1 = (ONE | TWO) - The file name part of a linespec now matches trailing components of a source file name. For example,
break gcc/expr.c:1000now sets a breakpoint in thebuild/gcc/expr.cfile, but not inbuild/libcpp/expr.c. - The
info procandgenerate-core-filecommands now work on remote targets connected togdbserver. - The command
info catchhas been removed. - The Ada-specific
catch exceptionandcatch assertcommands now accept conditions at the end of the command. - The
info static-tracepoint-markercommand now works on native targets with an in-process agent. - GDB can now set breakpoints on inline functions.
- The
.gdb_indexsection has been updated to include symbols for inline functions. By default, GDB now ignores older.gdb_indexsections until their.gdb_indexsections can be recreated. The new commandset use-deprecated-index-sections oncauses GDB to use any older.gdb_indexsections it finds. If this option is set, the ability to set breakpoints on inline functions is lost in symbol files with older.gdb_indexsections.The.gdb_indexsection has also been updated to record more information about each symbol. - GDB now provides Ada support for GDB/MI Variable Objects.
- GDB now supports
breakpoint always-inserted modein therecordtarget. gdbservernow supports evaluation of breakpoint conditions. Note that you can instruct GDB to send the breakpoint conditions in bytecode form, butgdbserveronly reports the breakpoint trigger to GDB when its condition evaluates to true.- New convenience functions
$_memeq(buf1, buf2, length),$_streq(str1, str2),$_strlen(str), and$_regex(str, regex)have been added. - Target
recordhas been renamed torecord-full. Consequently, you can now use therecord fullcommand to record or replay an execution log. In addition, the following commands have been renamed:- The
set record insn-number-maxandshow record insn-number-maxcommands have been renamed toset record full insn-number-maxandshow record full insn-number-max. - The
set record memory-queryandshow record memory-querycommands have been renamed toset record full memory-queryandshow record full memory-query. - The
set record stop-at-limitandshow record stop-at-limitcommands have been renamed toset record full stop-at-limitandshow record full stop-at-limit.
- A new record target,
record-btrace, has been added. This target uses hardware support to record the control flow of a process and can be enabled by using therecord btracecommand. This record target does not support replaying the execution.Important
Therecord-btracetarget is only available on Intel Atom processors and requires the Linux kernel in version 2.6.32 or later. - The
-epochcommand line option has been removed. This option was used by GDB mode in Epoch, a deprecated clone of the Emacs text editor. - The
ptypeandwhatiscommands have been updated to accept an argument to control the type formatting. - The
info proccommand has been updated to work on some core files. - The
cdcommand has been enhanced and no longer requires a directory path as its first argument. When executed with no arguments, the command now changes to the home directory. - GDB now uses GNU v3 ABI as the default C++ ABI. This has been the default option for GCC since November 2000.
- The
info tracepointscommand has been enhanced to displayinstalled on targetornot installed on targetfor each non-pending location of a tracepoint.
New Remote Packets
A number of new remote packets have been added. See Table B.3, “New Remote Packets” for a complete list.
Table B.3. New Remote Packets
| Remote Packet | Description |
|---|---|
QTBuffer:size | Sets the size of the trace buffer. The remote stub reports support for this packet to the qSupported query. |
Qbtrace:bts | Enables branch tracing based on Branch Trace Store (BTS) for the current thread. The remote stub reports support for this packet to the qSupported query. |
Qbtrace:off | Disables branch tracing for the current thread. The remote stub reports support for this packet to the qSupported query. |
qXfer:btrace:read | Reads the traced branches for the current thread. The remote stub reports support for this packet to the qSupported query. |
qXfer:libraries-svr4:read's annex |
The previously unused annex of the
qXfer:libraries-svr4:read packet is now used to support passing of an argument list. The remote stub reports support for this argument list to the qSupported query.
The defined arguments are
start and prev. These arguments are used to reduce work necessary for updating the library list and significantly speed up the process.
|
The
z0/z1 breakpoint insertion packets have been extended to carry a list of conditional expressions over to the remote stub depending on the condition evaluation mode. You can use the set remote conditional-breakpoints-packet command to control the use of this extension.
New RSP Packet
A new RSP packet has been added:
- A new RSP packet
QProgramSignalscan be used to specify the signals the remote stub can pass to the debugged program without GDB involvement.
Changes in the Machine Interface Interpreter (GDB/MI)
The following MI changes have been made:
- A new command
-info-oshas been added as the MI equivalent ofinfo os. - Output logs, such as
set loggingand related, now include MI output. - A new async record,
=cmd-param-changed, has been added. This async record reports that a command parameter has changed. - A new async record,
=traceframe-changed, has been added. This async record reports that a trace frame has been changed by using thetfindcommand. - New async records
=tsv-created,=tsv-deleted, and=tsv-modifiedhave been added. These async records report that a trace state variable has been created, deleted, or modified. - New async records
=record-startedand=record-stoppedhave been added. These async records report that a process record has been started or stopped. - A new async record,
=memory-changed, has been added. This async record reports that the memory has changed. - When the source is requested, the
-data-disassemblecommand now includes a newfullnamefield containing an absolute path to the source file name. - The
fullnamefiled is now always present along with thefilefield. This field is included even if GDB cannot find the file. - A new optional parameter,
COUNT, has been added to the-data-write-memory-bytescommand. This parameter can be used to allow pattern filling of memory areas. - The response to breakpoint commands and breakpoint async records now includes a new
installedfield. This field reports the current state of each non-pending tracepoint location: when the tracepoint is installed, the value of this field isy, otherwise the value isn. - The output of the
-trace-statuscommand now includes a newtrace-filefield. This field is only present when examining a trace file and contains the name of this file.
New Commands
The following new commands have been added:
- New
set use-deprecated-index-sections on|offandshow use-deprecated-index-sections on|offcommands have been added. These commands allow you to control the use of deprecated.gdb_indexsections. - New
catch loadandcatch unloadcommands have been added. These commands allow you to stop execution of a debugged program when a shared library is loaded or unloaded. - A new
enable countcommand has been added. This command allows you to auto-disable a breakpoint after several hits. - A new
info vtblcommand has been added. This command allows you to show the virtual method tables for C++ and Java objects. - A new
explorecommand has been added. It supports two subcommandsexplore valueandexplore type, and allows you to recursively explore values and types of expressions. Note that this command is only available with Python-enabled GDB. - A new
dprintf location,format,args...command has been added. This command allows you to create a dynamicprintf-type breakpoint, which performs aprintf-like operation and then resumes program execution. - New
set print symbolandshow print symbolcommands have been added. These commands allow you to control whether GDB attempts to display the symbol, if any, that corresponds to addresses it prints. This functionality is enabled by default, but you can restore the previous behavior by running theset print symbol offcommand. - New
record instruction-historyandrecord function-call-historycommands have been added. These commands allow you to view information about an execution log without having to replay it. Therecord instruction-historycommand displays the execution history at instruction granularity and therecord function-call-historydisplays the execution history at function granularity. The commands are only supported by therecord btracecommand. - A new command,
fo, has been added. This commands serves as a shorter variant of theforward-searchcommand. - A new command,
catch signal, has been added. This command can be used to catch signals by their names and is similar to thehandlecommand, but also allows you to attach additional conditions or commands. - A new command,
maint info bfds, has been added. This command can be used to list all binary files (BFDs) opened by GDB. - Two new commands,
python-interactive [command]and its shorter variantpi [command], have been added. These commands allow you to start an interactive Python prompt or evaluate a Python command and print the results to standard output. - A new command,
py [command], has been added. This command serves as a shorter variant of thepython [command]command. - New
enable type-printer [name...]anddisable type-printer [name...]commands have been added. These commands allow you to enable or disable type printers. - New
set breakpoint condition-evaluationandshow breakpoint condition-evaluationcommands have been added. These commands allow you to control whether breakpoint conditions are evaluated by GDB (thehostoption), or bygdbserver(thetargetoption). The default option,auto, chooses the most efficient available mode. - New
set dprintf-style gdb|call|agentandshow dprintf-stylecommands have been added. These commands allow you to control the way in which a dynamicprintfis performed: thegdboption requests a GDBprintfcommand,callcausesdprintfto call a function in the inferior, andagentrequests that the target agent such asgdbserverdoes the printing. - New
set dprintf-function expression,show dprintf-function,set dprintf-channel expression, andshow dprintf-channelcommands have been added. These commands allow you to set the function and optional first argument to the call when using thecallstyle of dynamicprintf. - New
set disconnected-dprintf on|offandshow disconnected-dprintfcommands have been added. These commands allow you to control whether agent-style dynamicprintfs continue to be in effect after GDB disconnects. - New
set print type methods on|offandshow print type methodscommands have been added. These commands allow you to control whether method declarations are displayed by theptypecommand. This functionality is enabled by default. - New
set print type typedefs on|offandshow print type typedefscommands have been added. These commands allow you to control whethertypedefdefinitions are displayed by theptypecommand. This functionality is enabled by default. - New
set filename-display basename|relative|absoluteandshow filename-displaycommands have been added. These commands allow you to control the way in which file names are displayed: thebasenameoption displays only the base name of a file name,relativedisplays a path relative to the compilation directory, andabsolutedisplays an absolute path to the file. The default option isrelativeto preserve the previous behavior. - New
set trace-buffer-sizeandshow trace-buffer-sizecommands have been added. These commands allow you to control the size of the trace buffer for a target. - New
set remote trace-buffer-size-packet auto|on|offandshow remote trace-buffer-size-packetcommands have been added. These commands allow you to control the use of the remote protocolQTBuffer:sizepacket. - New
set debug notificationandshow debug notificationcommands have been added. These commands allow you to control whether to display debugging information for asynchronous remote notification. This functionality is disabled by default. - A new command
info macroshas been added. This command accepts linespec as an optional argument and can be used to display the definitions of macros at that linespec location. Note that in order to do this, the debugged program must be compiled with the-g3command line option to have macro information available in it. - A new command
aliashas been added. This command can be used to create an alias of an existing command. - New
set print entry-valuesandshow print entry-valuescommands have been added. Theset print entry-valuescommand acceptsboth,compact,default,if-needed,no,only, andpreferredas valid arguments and can be used to enable printing of function arguments at function entry. Theshow print entry-valuescommand can be used to determine whether this feature is enabled. - New
set debug entry-valuesandshow debug entry-valuescommands have been added. Theset debug entry-valuescommand can be used to enable printing of debugging information for determining frame argument values at function entry and virtual tail call frames. !commandhas been added as an alias ofshell command.- New
set extended-promptandshow extended-promptcommands have been added. Theset extended-promptcommand enables support for a defined set of escape sequences that can be used to display various information. Theshow extended-promptcommand can be used to determine whether the extended prompt is enabled. - New
set basenames-may-differandshow basenames-may-differcommands have been added. Theset basenames-may-differcommand enables support for source files with multiple base names. Theshow basenames-may-differcommand can be used to determine whether this support is enabled. The default option isoffto allow faster GDB operations.
New Command Line Options
The following new options have been added:
- A new command line option,
-ix(or--init-command), has been added. This option acts like-x(or--command), but is executed before loading the debugged program. - A new command line option,
-iex(or--init-eval-command), has been added. This option acts like-ex(or--eval-command), but is executed before loading the debugged program. - A new command line option,
-nh, has been added. This option allows you to disable automatic loading of the~/.gdbinitfile without disabling other initialization files.
C++ Language Support
The following changes have been made to the C++ language support:
- When debugging a template instantiation, parameters of the template are now put in scope.
Python Scripting Support
The following changes have been made to the Python scripting support:
- The
register_pretty_printerfunction in modulegdb.printingnow takes an optionalreplaceargument. - The
maint set python print-stack on|offcommand has been deprecated and will be deleted in GDB 7.5. The new commandset python print-stack none|full|messagehas replaced it. - A prompt substitution hook (
prompt_hook) is now available to the Python API. - A new Python module
gdb.prompthas been added to the GDB Python modules library. - Python commands and convenience-functions located in
data_directory/python/gdb/command/anddata_directory/python/gdb/function/are now automatically loaded on GDB start-up. - Blocks now provide four new attributes:
global_block,static_block,is_static, andis_global. - The
gdb.breakpointfunction has been deprecated in favor ofgdb.breakpoints. - A new class
gdb.FinishBreakpointis provided. - Type objects for
structanduniontypes now allow access to the fields using standard Python dictionary (mapping) methods. - A new event
gdb.new_objfilehas been added. - A new function
deep_itemshas been added to thegdb.typesmodule. - The function
gdb.Writenow accepts an optional keywordstream. - Parameters can now be sub-classed in Python, which allows for implementation of the
get_set_docandget_show_docfunctions. - Symbols, Symbol Table, Symbol Table and Line, Object Files, Inferior, Inferior Thread, Blocks, and Block Iterator APIs now have an
is_validmethod. - Breakpoints can now be sub-classed in Python, which allows for implementation of the
stopfunction that is executed each time the inferior reaches that breakpoint. - A new function
gdb.lookup_global_symbolhas been added. This function can be used to look up a global symbol. - GDB values in Python are now callable if the value represents a function.
- A new module
gdb.typeshas been added. - A new module
gdb.printinghas been added. - New commands
info pretty-printers,enable pretty-printer, anddisable pretty-printerhave been added. - A new
gdb.parameter("directories")function call is now available. - A new function
gdb.newest_framehas been added. This function can be used to return the newest frame in the selected thread. - The
gdb.InferiorThreadclass now supports a newnameattribute. - Support for inferior events has been added. Python scripts can now add observers in order to be notified of events occurring in the process being debugged.
- GDB commands implemented in Python can now be put in the
gdb.COMMAND_USERcommand class. - The
maint set python print-stack on|offcommand has been removed and replaced byset python print-stack. - A new class
gdb.printing.FlagEnumerationPrinterhas been added. This class can be used to applyflag enum-style pretty-printing to enums. - The
gdb.lookup_symbolfunction now works correctly when there is no current frame. - The
gdb.Symbolobject now has an additional attributeline. This attribute holds the line number in the source at which the symbol was defined. - The
gdb.Symbolobject now has an additional attributeneeds_frame, and a new methodvalue. Theneeds_frameattribute indicates whether the symbol requires a frame to compute its value, and thevaluemethod computes the symbol's value. - The
gdb.Valueobject now has a new methodreferenced_value. This method can be used to dereference a pointer as well as C++ reference values. - The
gdb.Symtabobject now has two new methods,global_blockandstatic_block. These methods return the global and static blocks (asgdb.Blockobjects) of the underlying symbol table respectively. - A new method
gdb.find_pc_linereturns thegdb.Symtab_and_lineobject associated with a PC value. - The
gdb.Symtab_and_lineobject now has an additional attributelast. This attribute holds the end of the address range occupied by the code for the current source line. - Users can now create vectors by using the
gdb.Type.vector()method. - The
atexit.register()method is now supported. - Users can now pretty-print types by using the Python API.
- In addition to Python 2.4 and later, GDB now also supports Python 3.
- A new class,
gdb.Architecture, has been added. This class exposes the internal representation of the architecture in the Python API. - A new method,
Frame.architecture, has been added. This method can be used to return thegdb.Architectureobject corresponding to the frame's architecture. - Frame filters and frame decorators have been added.
Compatibility Changes
- A new command
info auto-loadhas been added and can be used to display the status of various automatically loaded files. Theinfo auto-load gdb-scriptscommand lists automatically loaded canned sequences of commands,info auto-load python-scriptsdisplays the status of automatically loaded Python scripts,info auto-load local-gdbinitdisplays whether a local.gdbinitfile in the current working directory is loaded, andinfo auto-load libthread-dbdisplays whether the inferior-specific thread debugging shared library is loaded. - New commands
set auto-loadandshow auto-loadhave been added and can be used to control automatic loading of files:- The
set auto-load gdb-scriptsandshow auto-load gdb-scriptscommands control automatic loading of GDB scripts. - The
set auto-load python-scriptsandshow auto-load python-scriptscommands control automatic loading of Python scripts. - The
set auto-load local-gdbinitandshow auto-load local-gdbinitcommands control automatic loading of.gdbinitfrom the current working directory. - The
set auto-load libthread-dbandshow auto-load libthread-dbcommands control automatic loading of inferior-specificlibthread_db. - The
set auto-load scripts-directoryandshow auto-load scripts-directorycommands control the list of directories from which to automatically load GDB and Python scripts. - The
set auto-load safe-pathandshow auto-load safe-pathcommands control the list of directories from which it is safe to automatically load all previously mentioned items. - The
set debug auto-loadandshow debug auto-loadcommands control displaying of debugging information for all previously mentioned items.
Theset auto-load offcommand can be used to disable automatic loading globally. You can also useshow auto-loadwith no subcommand to display current settings of all previously mentioned items. - The
maint set python auto-load on|offcommand has been replaced withset auto-load python-scripts on|off. - The
maintenance print section-scriptscommand has been renamed toinfo auto-load python-scripts [pattern]and is no longer classified as a maintenance-only command. - Support for the Guile extension language has been removed.
- The GNU Debugger has been adapted to follow GCC's rules on accessing volatile objects when reading or writing target state during expression evaluation.
B.5.2. Changes Since Red Hat Developer Toolset 2.1 and Red Hat Enterprise Linux 7.0
The following features have been added since the release of GDB in Red Hat Developer Toolset 2.1 and Red Hat Enterprise Linux 7.0:
Python Scripting Support
Python scripting support has been improved:
- Support for frame filters and frame decorators has been added. Frame filters are Python objects that can be used to manipulate whether frames are visible when GDB prints a backtrace. Frame decorators, which are sister objects to frame filters, are used to customize the printed content of each
gdb.Framein commands that execute frame filters. - Temporary breakpoints, which are automatically deleted after they have been hit, are now supported through the optional
temporaryargument to theBreakpointinitializer. - A representation of line tables has been added. Line tables map source lines to their executable locations in memory. The
linetablefunction can be used to acquire line-table information for a particular symbol table. - A new attribute,
parent_type, has been added forgdb.Fieldobjects. gdb.Fieldobjects can now be used as subscripts ongdb.Valueobjects to access structure elements.- A new attribute,
name, has been added forgdb.Typeobjects. - Valid Python operations on
gdb.Valueobjects representing structs or classes now invoke the corresponding overloaded operators if available. - A new feature, Xmethods, has been added to the Python API. Xmethods are additional methods or replacements for existing methods of a C++ class. This feature is useful for those cases where a method defined in C++ source code could be inlined or optimized out by the compiler, making it unavailable to GDB.
New Commands
A number of new commands have been added:
- A new command,
catch rethrow, has been added. This command works like thecatch throwcommand, but it only catches re-thrown exceptions. - A new command,
maint check-psymtabs, has been added. This command has been renamed from the oldmaint check-symtabs. It is used for checking the consistency of partial symbol tables. - A new command,
maint check-symtabs, has been added. It performs consistency checks on full symbol tables. - A new command,
maint expand-symtabs, has been added. It is used for expanding full symbol tables that match an optional regular expression. - A new command,
show configuration, has been added. The command displays the details of the configuration options with which GDB was built. This command is the equivalent of the--configurationcommand line option. - A new command,
remove-symbol-file, has been added. It can be used to remove a symbol file added using theadd-symbol-filecommand. The file to remove can be identified by its file name:remove-symbol-file FILENAMEOr by an address that lies within the boundaries of this symbol file in memory. In that case, use the-aoption:remove-symbol-file -a ADDRESS - A new command,
info exceptions, has been added. It can be used to display the list of Ada exceptions defined in the program being debugged. Optionally, a regular expression can be supplied to limit the list of displayed exceptions:info exceptions REGEXPIf provided, only the exceptions whose names match REGEXP are listed.
The following new pairs of commands make it possible to change settings and show their values:
-
set debug symfile [off|on] - Controls the displaying of debugging information regarding the reading of symbol files and symbol tables within those files. The
show debug symfilecommand shows the value of this setting. -
set print raw frame-arguments [off|on] - Controls the displaying of frame arguments in raw mode, disregarding any defined pretty-printers. The
show print raw frame-argumentscommand shows the value of this setting. -
set remote trace-status-packet off|on|auto - Controls the use of the remote-protocol
qTStatuspacket. The packet is used to ask the remote stub whether a trace experiment is currently running. Theshow remote trace-status-packetcommand shows the value of this setting. -
set range-stepping [off|on] - Controls whether GDB instructs the target to step through the corresponding range of addresses. If disabled, single-steps are always issued. The
show range-steppingcommand shows the value of this setting. This is set toonby default. -
set startup-with-shell [off|on] - Controls whether the shell is used to start subprocesses. If set to
off, processes are started directly. Theshow startup-with-shellcommand shows the value of this setting. This is set toonby default. -
set code-cache [off|on] - Controls whether the target memory cache is used for accesses to code segments, disregarding any configured memory regions. This improves performance of remote debugging (particularly disassembly). The
show code-cachecommand shows the value of this setting. This is set toonby default. -
set print symbol-loading off|brief|full - Controls whether to print informational messages when loading symbol information for a file. The default value for this option is
full, but when debugging programs with large numbers of shared libraries, the amount of output becomes less useful. Theshow print symbol-loadingcommand shows the value of this setting. -
maint ada set ignore-descriptive-types [on|off] - Controls whether the debugger ignores descriptive types in Ada programs. The default value is
off, that is, not to ignore the descriptive types. See the user manual for more details on descriptive types and the intended usage of this option. Themaint ada show ignore-descriptive-typescommand shows the value of this setting. -
set auto-connect-native-target [on|off] - Controls whether GDB may automatically connect to the native target when not connected to any target yet. If set to
on, GDB attempts therun,attach, and other commands with the native target. Theshow auto-connect-native-targetcommand shows the value of this setting. -
set record btrace replay-memory-access read-only|read-write - Controls what memory accesses are allowed during replays. The
show record btrace replay-memory-accesscommand shows the value of this setting. -
maint set target-async on|off - Controls whether GDB targets operate in synchronous or asynchronous mode. By default and if available, asynchronous mode is used. Set to
offto simplify the debugging of problems that only occur in synchronous mode. Themaint show target-asynccommand shows the value of this setting. -
set mi-async [on|off] - Controls whether GDB/MI uses asynchronous mode. By default, synchronous mode is used. Set to
onto enable background execution of commands. Theshow mi-asynccommand shows the value of this setting. This command supersedes theset target-asynccommand from previous versions of GDB.
The following series of new commands enables displaying GDB resources used by each executed command:
-
maint set per-command space [on|off] - Enable or disable the displaying of the amount of memory used by each command. The
maint show per-command spacecommand shows the value of this setting. -
maint set per-command time [on|off] - Enable or disable the displaying of the execution time of each command. The
maint show per-command timecommand shows the value of this setting. -
maint set per-command symtab [on|off] - Enable or disable the displaying of basic symbol-table statistics for each command. The
maint show per-command symtabcommand shows the value of this setting.
New Command Line Options
Two new command line options have been added:
- A new command line option,
--configuration, has been added. It displays the details of the configuration options with which GDB was built. This option is the equivalent of theshow configurationinteractive command. - A new command line option,
-D, has been added. This option is an alias for the--data-directoryoption. This option allows you to specify where GDB looks for its auxiliary files.
Changes in the Machine Interface Interpreter (GDB/MI)
The machine interface interpreter (GDB/MI) has been improved in a number of ways:
- All MI commands now accept an optional
--languageoption. Support for this feature can be verified by using the-list-featurescommand, which should contain the"language-option"item. - A new command,
-info-gdb-mi-command, has been added. It allows the user to determine whether a GDB/MI command is supported or not. - The
^errorresult record returned when trying to execute an undefined GDB/MI command now provides a variable namedcodewhose content is the undefined-command error code. Support for this feature can be verified by using the-list-featurescommand, which should contain the"undefined-command-error-code"item. - The
-trace-savecommand can now optionally save trace buffer in the Common Trace Format. - A new command,
-dprintf-insert, has been added. It sets a dynamicprintfbreakpoint. - The
-data-list-register-valuescommand now accepts an optional--skip-unavailableoption. When used, only available registers are displayed. - A new command,
-trace-frame-collected, has been added. It returns objects, register names, trace-state variables, memory ranges, and computed expressions that have been collected in a trace frame. There is no corresponding GDB command. - The
-stack-list-locals,-stack-list-arguments, and-stack-list-variablescommands now accept the--skip-unavailableoption. When used, only available locals or arguments are displayed. - The
-exec-runcommand now accepts the optional--startoption. When used, the command follows the same semantics as thestartcommand, stopping the program's execution at the start of its main subprogram. Support for this feature can be verified by using the-list-featurescommand, which should contain the"exec-run-start-option"item. - New commands,
-catch-assertand-catch-exceptions, have been added. The commands insert catchpoints stopping the program when Ada exceptions are raised. - A new command,
-info-ada-exceptions, has been added. It provides the equivalent of the newinfo exceptionscommand in GDB. - A new command,
-gdb-set mi-async [on|off], has been added. It replaces the-gdb-set target-asynccommand, which has been deprecated and only serves as an alias to the new command for backward compatibility purposes. The-gdb-set mi-asynccommand controls whether MI operates in asynchronous mode. If set toon, and provided the target supports it, MI commands are executed in the background, and GDB interprets them while the target is still running.
New Features in Remote Packets
Two remote packets have had their feature set expanded:
- The
vContpacket now supports a newr start,endaction. The action instructs the remote stub to perform one step and then continue stepping through the address range specified by the start (inclusive) and end (exclusive) parameters. - The
qXfer:btrace:readpacket now supports a new annex,delta, to read the branch trace incrementally.
New Features in the GDB Remote Stub, GDBserver
GDBserver has had two new features added and one new option:
- Support for target-assisted range stepping has been added.
- A new element,
tvar, has been added to the XML in the reply to theqXfer:traceframe-info:readpacket. It has theidof the collected trace state variables. - A new option,
--debug-format=option1[,option2, ...], has been added. It allows for adding additional text to each output. At present, only time stamps are supported:--debug-format=. Time stamps can also be turned on with thetimestampsmonitor set debug-format timestampscommand in GDB.
General Changes
- The Fission DWP file format in version 2 is now supported. To use Fission, supply the
-gsplit-dwarfoption togccto generate split DWARF files at compile time. This option must be used in conjunction with the-coption, which disables linking, because Fission cannot be used when compiling and linking in the same step. See http://gcc.gnu.org/wiki/DebugFission for more information about the Fission project. - Access to Intel® MPX registers is now supported.
- Support for Intel® AVX-512 registers has been added, that is, support for displaying and modifying the following Intel® AVX-512 registers:
$zmm0—$zmm31,$k0—$k7,$xmm16—$xmm31, and$ymm16—$ymm31. - A new convenience function,
$_isvoid (expression), has been added. The function returns1if the type of the evaluated expression is void. In other cases, it returns0. - When displaying the values of registers for which the debugging information shows that they have not been saved in the frame, and there is no place to retrieve them from (callee-saved or call-clobbered registers), the
<not saved>message is now consistently printed. - A new formatter,
z, has been added. When printing and examining memory, this formatter causes the value to be displayed as a hexadecimal zero padded on the left to the size of the type. - Target-assigned range stepping with remote targets is now supported. The achieved reduction in the number of control packets sent to and from GDB results in an improved performance.
- GDB now understands the new
tvarelement, which has been added to the XML in the traceframe information. It has theidof the collected trace state variables. - The
typeidC++ operator is now supported. - A new convenience variable,
$_exception, has been added. It holds the exception that is being thrown or caught at an exception-related catchpoint. - Exception-related catchpoints, such as
catch throw, can now filter exceptions by type using a supplied regular expression. - A new convenience variable,
$_exitsignal, has been added. It can be used to determine the signal number with which a program terminates if it dies due to an uncaught signal. The$_exitcodeis then automatically set tovoid. - Commands, such as
c&,s&, can now be executed in the background if the target supports them. In previous versions, asynchronous execution had to be explicitly enabled using the (now deprecated)set target-async oncommand. - The btrace record target now supports the
record gotocommand. For locations inside the execution trace, the back trace is computed based on the information stored in the execution trace. - The btrace record target now supports limited reverse execution and replay. The target does not record data and therefore does not allow for reading the memory or registers.
- The naming of native targets has been unified, and they are now all called native. To reflect this change, the
target childcommand has been replaced bytarget native. Target names feature in the output of the following commands:help target,info target,info files, andmaint print target-stack.
The following commands have been modified:
- The
unlimitedliteral value can now be used for options that interpret the0or-1values as unlimited. - The
set debug symtab-createdebugging command has been changed to accept a verbosity level.0provides no debugging information,1provides basic debugging output, and values of2or greater provide a more verbose output. - The
compare-sectionscommand now works with all targets. In previous versions, it was limited to theremotetarget. - The
target nativecommand can now be used to explicitly connect to the native target, which overrides the setting of theset auto-connect-native-targetcommand. - The ranges given as arguments to the
record function-call-historyandrecord instruction-historycommands are now inclusive. - The
record instruction-historycommand now starts counting instructions at one. This also affects the instruction ranges reported by therecord function-call-historycommand when given the/imodifier. - The
tsavecommand now supports a new option,-ctf, to save trace data in the Common Trace Format (CTF). - The
maintenance print objfilescommand now accepts an optional argument in the form of a regular expression. - The commands
set remotebaudandshow remotebaudare no longer supported. Useset serial baudto set the baud rate for remote serial I/O andshow serial baudto display the set rate. - The
record function-call-historycommand has been modified in a number of ways:- The command now supports a new modifier,
/c, for indenting function names based on their call-stack depth. - The fields for the
/iand/lmodifiers have been reordered. - The source-line range is now prefixed with
at. - The instruction range is now prefixed with
inst. Both ranges are now printed as<from>,<to>to allow copy-and-paste to therecord instruction-historyandlistcommands.