[Bug 1576432] Re: gdb crashes when trying to start a debugging session

Chris Coulson chrisccoulson at ubuntu.com
Tue May 1 18:43:07 UTC 2018


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.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gdb in Ubuntu.
https://bugs.launchpad.net/bugs/1576432

Title:
  gdb crashes when trying to start a debugging session

Status in gdb:
  New
Status in gdb package in Ubuntu:
  New

Bug description:
  This bug log applies to Ubuntu Mate for raspberry PI.

  I cannot use gdb to debug a program. See below. This happens on any
  program, even programs that come with ubuntu, for example try gdb
  /bin/less. It always crashes in  d-linux-armhf.so.3

  gdb mythfrontend
  GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11
  Copyright (C) 2016 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  and "show warranty" for details.
  This GDB was configured as "arm-linux-gnueabihf".
  Type "show configuration" for configuration details.
  For bug reporting instructions, please see:
  <http://www.gnu.org/software/gdb/bugs/>.
  Find the GDB manual and other documentation resources online at:
  <http://www.gnu.org/software/gdb/documentation/>.
  For help, type "help".
  Type "apropos word" to search for commands related to "word"...
  Reading symbols from mythfrontend...done.
  (gdb) start
  Temporary breakpoint 1 at 0x62c22: file main.cpp, line 1674.
  Starting program: /srv/storage/homexenial/peter/proj/mythtv-build/myth-p28/usr/bin/mythfrontend

  Program received signal SIGSEGV, Segmentation fault.
  0x76fd9822 in ?? () from /lib/ld-linux-armhf.so.3
  (gdb)

To manage notifications about this bug go to:
https://bugs.launchpad.net/gdb/+bug/1576432/+subscriptions



More information about the foundations-bugs mailing list