public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/13568] New: GDB can trigger a SIGBUS putting a breakpoint on a source line removed by linker garbage collection
@ 2012-01-06 16:00 nickc at redhat dot com
  2012-01-06 17:22 ` [Bug breakpoints/13568] " nickc at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: nickc at redhat dot com @ 2012-01-06 16:00 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-01-30 20:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-06 16:00 [Bug breakpoints/13568] New: GDB can trigger a SIGBUS putting a breakpoint on a source line removed by linker garbage collection nickc at redhat dot com
2012-01-06 17:22 ` [Bug breakpoints/13568] " nickc at redhat dot com
2012-01-09 14:56 ` mjw at redhat dot com
2012-01-25 17:46 ` tromey at redhat dot com
2012-01-26  9:57 ` nickc at redhat dot com
2012-01-26 14:56 ` tromey at redhat dot com
2012-01-26 15:29 ` tromey at redhat dot com
2012-01-30 20:11 ` cvs-commit at gcc dot gnu.org
2012-01-30 20:13 ` tromey at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).