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/13346] New: Multiple breakpoints/losing symboltable issue


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.


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