public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/13346] New: Multiple breakpoints/losing symbol table issue
@ 2011-10-25 21:55 j.vimal at gmail dot com
  2011-10-26  7:41 ` [Bug breakpoints/13346] " jan.kratochvil at redhat dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: j.vimal at gmail dot com @ 2011-10-25 21:55 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 13346
           Summary: Multiple breakpoints/losing symbol table issue
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: j.vimal@gmail.com
    Classification: Unclassified


This bug happened when I was debugging a loadable kernel module.  There are
many variants of this bug and the earliest commit that causes the kernel module
issue is: 2cdbbe44126601596aad7891de05cb7fc6bb21c8.

Setup:
- arch: x86_64
- qemu + kvm VM
- gdb built from master

Summary of bug:
- Load a LKM
- Get the LKM's .text address and use add-symbol-file
- A combination of the following happens:
  - breakpoint is set at 2 locations (gdb/master)
    http://pastebin.com/4PhDAHwW

  - breakpoint is set at 1 location, but all subsequent
    breakpoints lose line number information.  Breakpoints from #2
    onwards to the same function are set at slightly different
    offsets.
    http://pastie.org/2758080

  - Setting a breakpoint at the actual function address also
    loses locals.
    http://pastie.org/2758181

  - Line number/locals info is lost
    (in all the above)


tromey suggested a small .so example and here's one.  I am not sure if this is
the right behaviour though.

############# app.c:
#include <stdio.h>

extern int lib_function(int);

void f() {
    printf("f()\n");
}

int main()
{
    lib_function(0); // force load
    f();             // for breakpoint
    printf("Return code is %i\n",lib_function(32));
    return 0;
}

############# lib.c:
#include <stdio.h>

int lib_function(int arg) {
    int temp = arg + 10;
    printf("lib_function(%d) called\n", arg);
    return temp;
}

############# compile.sh:
gcc -fPIC -c -g lib.c
gcc -shared -g -Wl,-soname,libblah.so -o libblah.so  lib.o

gcc app.c -L . -l blah -g -o app

############# in gdb:
http://pastie.org/2758798


Thanks,

-- 
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] 13+ messages in thread

end of thread, other threads:[~2011-12-02  1:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25 21:55 [Bug breakpoints/13346] New: Multiple breakpoints/losing symbol table issue j.vimal at gmail dot com
2011-10-26  7:41 ` [Bug breakpoints/13346] " jan.kratochvil at redhat dot com
2011-10-26 14:36 ` j.vimal at gmail dot com
2011-10-26 14:49 ` jan.kratochvil at redhat dot com
2011-10-26 15:06 ` j.vimal at gmail dot com
2011-10-26 15:13 ` jan.kratochvil at redhat dot com
2011-10-26 15:51 ` j.vimal at gmail dot com
2011-10-26 16:30 ` jan.kratochvil at redhat dot com
2011-10-27  7:14 ` jan.kiszka at siemens dot com
2011-11-02 13:39 ` tromey at redhat dot com
2011-11-08  0:35 ` jan.kratochvil at redhat dot com
2011-12-02  1:29 ` cvs-commit at gcc dot gnu.org
2011-12-02  1:34 ` jan.kratochvil 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).