This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/13568] New: GDB can trigger a SIGBUS putting abreakpoint on a source line removed by linker garbage collection


http://sourceware.org/bugzilla/show_bug.cgi?id=13568

             Bug #: 13568
           Summary: GDB can trigger a SIGBUS putting a breakpoint on a
                    source line removed by linker garbage collection
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: nickc@redhat.com
    Classification: Unclassified


If GDB is asked to place a breakpoint on a line of source code that has been
removed from the executable via linker garbage collection it can trigger a
SIGBUS fault.  Vis:

  % cat a.c
  int main()
  {
   return 0;
  }
  int fun ()
  {
   return 0;
  }

  % gcc -g3 -ffunction-sections -Wl.--gc-sections a.c

  % gdb -nw a.out
  (gdb) break a.c:6
  Bus error (core dumped)

This problem can be reproduced using the current (2012-01-06) GDB mainline
sources.  Note however that it needs a 4.6 or earlier version of GCC as the
compiler.  Newer GCCs create a .debug_loc section in the executable which
appears to avoid this problem.

The underlying issue is that the linker has not removed the redundant entries
from the .debug_line section, and hence this is a binutils bug.  On the other
hand it would be nice if GDB did not generate a SIGBUS when presented with
bogus debug information.

Detection of this problem originated from a thread in the binutils mailing list
that starts here:

http://sourceware.org/ml/binutils/2012-01/msg00047.html

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]