Comment 11 for bug 1576432

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

This occurs when gdb sets breakpoints on various probe events in the dynamic loader. The probe event locations are exported from ld.so as SDT markers, but gdb needs to know whether ARM or Thumb instructions are being exported at each marker so that it can insert the appropriate breakpoint instruction sequence. It does this by mapping the probe location to a function symbol (see arm_pc_is_thumb in gdb/arm-tdep.c), and using the target address of the symbol to determine if the function is called in Thumb or ARM more (bit 0 of the target address will be set for Thumb mode).

The problem here is that gdb can't map any of the probes to a symbol if the debug symbols aren't installed, and arm_pc_is_thumb returns false in this case (indicating ARM instructions).

But the probes that gdb sets breakpoints on are in dl_main, and dl_main is meant to be called in Thumb mode. See the output of readelf, noting that bit 0 of the target address is set:
$ readelf -s /usr/lib/debug/lib/arm-linux-gnueabihf/ld-2.27.so | grep dl_main
    42: 0000172d 10516 FUNC LOCAL DEFAULT 11 dl_main

So without the debug symbols installed, gdb inserts the ARM breakpoint instruction sequence for the dynamic loader probes, when it should be inserting the Thumb instruction sequence. This is why it crashes.