B.4. Changes in GDB
B.4.1. Changes Since Red Hat Developer Toolset 4.0
- Thread numbers are now per-inferior instead of global. When debugging multiple inferiors, GDB now displays thread IDs using a qualified
INF_NUM.THR_NUMform. For example:
(gdb) info threads Id Target Id Frame 1.1 Thread 0x7ffff7fc2740 (LWP 8155) (running) 1.2 Thread 0x7ffff7fc1700 (LWP 8168) (running) * 2.1 Thread 0x7ffff7fc2740 (LWP 8157) (running) 2.2 Thread 0x7ffff7fc1700 (LWP 8190) (running)As consequence, thread numbers visible in the
$_threadconvenience variable and in Python's
InferiorThread.numattribute are no longer unique between inferiors.GDB now maintains a second thread ID per thread, referred to as the global thread ID, which is the new equivalent of thread numbers in previous releases. See below for
$_gthread.For backwards compatibility, thread IDs of the Machine Interpreter (MI) always refer to global IDs.
- Commands that accept thread IDs now accept the qualified
INF_NUM.THR_NUMform as well. For example:
(gdb) thread 2.1 [Switching to thread 2.1 (Thread 0x7ffff7fc2740 (LWP 8157))] (running) (gdb)
- In commands that accept a list of thread IDs, it is now possible to refer to all threads of an inferior using a star wildcard. GDB accepts
INF_NUM.*, to refer to all threads of inferior
*to refer to all threads of the current inferior. For example,
info threads 2.*.
- You can use the
info threads -gidcommand to display the global thread ID of all threads.
- The new
$_gthreadconvenience variable holds the global number of the current thread.
- The new
$_inferiorconvenience variable holds the number of the current inferior.
- For multi-threaded programs, GDB now displays the ID and the name of the thread that hit a breakpoint or received a signal. For example:
Thread 3 "bar" hit Breakpoint 1 at 0x40087a: file program.c, line 20. Thread 1 "main" received signal SIGINT, Interrupt.
- GDB now allows users to specify explicit locations, bypassing the linespec parser. This feature is also available to GDB/MI clients.
- The following commands now list corresponding items in ascending ID order to maintain consistency with all other
info checkpoints, and
maint info program-spaces.
- In the Ada programming language, the overloads selection menu has been enhanced to display the parameter types and the return types for the matching overloaded subprograms.
- Support has been added for thread names in the remote protocol. The reply to
qXfer:threads:readmay now include a name attribute for each thread.
- GDB now has support for fork and exec events on remote-mode Linux targets. This enables
follow-exec-modemodes and fork and exec catchpoints.
maint set target-non-stop [on|off|auto],
maint show target-non-stop
- Controls whether GDB targets always operate in non-stop mode even if
set non-stopis set to
off. The default is
auto, which means non-stop mode is enabled if it is supported by the target.
maint set bfd-sharing,
maint show bfd-sharing
- Controls whether
bfdobjects can be used more than once.
set debug bfd-cache,
show debug bfd-cache
- Controls whether debugging information regarding
bfdcaching is displayed.
set remote multiprocess-extensions-packet,
show remote multiprocess-extensions-packet
- Controls the use of remote protocol multiprocess extensions.
set remote thread-events,
show remote thread-events
- Controls the use of thread create and exit events.
set ada print-signatures on|off,
show ada print-signatures
- Controls the display of parameter types and return types in overloads selection menus. By default, this option is active (
- Controls the maximum number of bytes of memory that GDB is allowed to allocate for value contents. The option prevents GDB from allocating overly large buffers by accessing inconsistent data of a debugged program. The default amount is 64 kB.
set remote exec-event-feature-packet,
show remote exec-event-feature-packet
- GDB now has support for exec events on extended-remote Linux targets. This enables
follow-exec-modemode and exec catchpoints. The commands control the use of the remote exec event feature.
set remote catch-syscall-packet,
show remote catch-syscall-packet
- GDB now has support for catching system calls on remote Linux targets. The commands control the use of the feature.
disassemblecommand now accepts a new modifier:
/s. When the modifier is used, the command prints mixed source code and disassembly similarly to the
/mmodifier. There are two differences: disassembled instructions are now printed in program order, and source for all relevant files is now printed. The
/moption is now considered deprecated because its "source-centric" output has not proven useful in practice.
record instruction-historycommand now accepts a new modifier:
/s. The option behaves exactly like the
/mmodifier and prints mixed source code and disassembly.
set scheduler-lockingcommand now supports a new option,
set scheduler-locking replayis used, it behaves like
offin record mode and like
onin replay mode.
New Remote Packets
Table B.1. New Remote Packets
| || Serves as an indicator that an |
| || Using the |
| || An equivalent to interrupting with the |
| ||Indicates that the thread has just been created and is stopped at entry.|
| ||Indicates that the thread has terminated.|
| ||Enables or disables thread create and exit event reporting. For example, this is used in non-stop mode when GDB stops a set of threads and synchronously waits for the their corresponding stop replies. Without exit events, if one of the threads exits, GDB would wait forever not knowing that it should no longer expect a stop for that same thread.|
| ||Indicates that there are no resumed threads left in the target (all threads are stopped). The remote stub reports support for this stop reply to the qSupported query by GDB.|
| || Enables or disables catching system calls from the inferior process. The remote stub reports support for this packet to the |
| ||Indicates that a system call was just called.|
| ||Indicates that a system call just returned.|
Python Scripting Support
gdb.InferiorThreadobjects now have a new attribute,
global_num, which refers to the global thread ID. The existing
numattribute now refers to the per-inferior number of the thread. See per-inferior thread numbers: the section called “New Features”.
gdb.InferiorThreadobjects now have a new attribute,
inferior, which is the
Inferiorobject the thread belongs to.
Change in the Machine Interface Interpreter (GDB/MI)
-var-set-formatcommand has been enhanced to support input in zero-hexadecimal format. The output of the command is in the hexadecimal format with zero-padding on the left.