Run-time linker interface
As part of its basic operation GDB interfaces with the run-time linker to follow shared library events. glibc has two possible interfaces a debugger can use to do this: the standard interface (present on most System V systems) and the probes-based interface (specific to glibc as of October 2013). The probes-based interface is approximately an order of magnitude faster when debugging applications with large numbers of shared libraries (greater than 1000). Using the probes-based interface also fixes a long-standing bug (PR gdb/2328). The two interfaces are described in the file elf/rtld-debugger-interface.txt in the glibc sources. There is a brief history of the standard interface at http://gbenson.net/?p=407.
GDB >= 7.5 will use the probes-based interface if it is available. This requires glibc >= 2.17 configured with --enable-systemtap, and GDB itself built with the SystemTap headers present. Use the following command to check whether your glibc contains the required probes:
gdb -nx /lib64/ld-linux-x86-64.so.2 -ex "info probes" -ex quit
GDB must list all these probes for incremental transfers to work:
Provider Name rtld init_complete rtld init_start rtld map_complete rtld map_start rtld reloc_complete rtld reloc_start rtld unmap_complete rtld unmap_start
There should also be a map_failed probe, but its presence is not required. Note that some versions of Fedora and RHEL contain probes called rtld_init_complete, rtld_init_start. This is an older version of the probes code that does not give the speed benefits of the newer code.
For remote debugging both GDB and the remote must support the newer interface. You can check if the remote supports the probes interface by entering set debug remote 1 before the target remote command. If the remote sends augmented-libraries-svr4-read+ in response to GDB's qSupported packet as shown below then the remote supports the probes interface.
(gdb) set debug remote 1 (gdb) target remote :9999 Remote debugging using :9999 Sending packet: $qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+#b5...Ack Packet received: PacketSize=3fff;QPassSignals+;QProgramSignals+;qXfer:libraries-svr4:read+;augmented-libraries-svr4-read+;qXfer:auxv:read+;qXfer:spu:read+;qXfer:spu:write+;qXfer:siginfo:read+;qXfer:siginfo:write+;qXfer:features:read+;QStartNoAckMode+;qXfer:osdata:read+;multiprocess+;QNonStop+;QDisableRandomization+;qXfer:threads:read+;ConditionalTracepoints+;TraceStateVariables+;TracepointSource+;DisconnectedTracing+;FastTracepoints+;StaticTracepoints+;InstallInTrace+;qXfer:statictrace:read+;qXfer:traceframe-info:read+;EnableDisableTracepoints+;QTBuffer:size+;tracenz+;ConditionalBreakpoints+;BreakpointCommands+;QAgent+ ...
Lack of dlmopen support
Neither the standard interface nor the probes interface can presently handle shared libraries loaded using dlmopen. There are bugs filed against GDB and glibc to track this. See PR gdb/11839 and PR glibc/15971.