This is the mail archive of the gdb@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]

Re: Multiple breakpoint issue when debugging loadable kernel module


On 27 October 2011 13:31, Tom Tromey <tromey@redhat.com> wrote:
>
> A recipe to reproduce the bug. ?I know nothing about the kernel, so if
> it requires extensive setup, precise instructions would be best.
>
> We've been poking at it a bit on irc but, aside from a lot of weird and
> inexplicable gdb behavior, we haven't seen anything too useful.

I was poking around the gdb-7.3 code from your branch and noticed the
following behaviour:

As you suggested, I set breakpoint at decode_variable.  Then, followed
some function calls to see the function that's returning the sal.
Turns out it's this function: find_pc_sect_line.  So, in that
function, I introduced some print statements and noticed the
following:

1. info scope function, before setting a breakpoint, prints the following:

(gdb) info scope vport_receive
exploring s=0x20fb810
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
section=0x1cff988, pc=0xffffffffa00d5ba3
best_symtab: 0x20fb810, in
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
found best_symtab 0x20fb810
exploring s=0x20fb810
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
section=(nil), pc=0xffffffffa00d5ba3
best_symtab: 0x20fb810, in
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
found best_symtab 0x20fb810
exploring s=0x20fb810
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
section=0x1cff988, pc=0xffffffffa00d5ba7
best_symtab: 0x20fb810, in
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
found best_symtab 0x20fb810
exploring s=0x20fb810
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
section=0x1cff988, pc=0xffffffffa00d5bb8
best_symtab: 0x20fb810, in
filename=/home/nikhilh/openvswitch/datapath/linux/vport.c
found best_symtab 0x20fb810
[Prints the correct scope information]

Here's the portion I made change in the gdb/symtab.c:find_pc_sect_line(..)

   printf("exploring s=%p filename=%s section=%p, pc=%p\n", s,
s?s->filename:NULL, section, (void*)pc);
   ALL_OBJFILE_SYMTABS (objfile, s) { ...

The variable 's' is obtained via find_pc_sect_symtab().

When I set a breakpoint for the same function vport_receive, I see the
same output as above.

But, after setting a breakpoint, when I do "info scope vport_receive",
I see this:

(gdb) info scope vport_receive
exploring s=0x2294cc0 filename=arch/x86/kernel/hpet.c
section=0x1cff988, pc=0xffffffffa00d5ba3
count't find best_symtab :(, s=(nil), filename=(null)
exploring s=0x2294cc0 filename=arch/x86/kernel/hpet.c section=(nil),
pc=0xffffffffa00d5ba3
count't find best_symtab :(, s=(nil), filename=(null)
exploring s=0x2294cc0 filename=arch/x86/kernel/hpet.c
section=0x1cff988, pc=0xffffffffa00d5ba7
count't find best_symtab :(, s=(nil), filename=(null)

Notice that the 's' variable has changed!  section and pc variables
haven't.   It's looking for the function vport_receive in a
_different_ file; I don't understand why! :(   It seems like
find_pc_sect_symtab() is the culprit.   Let me step through that
function and see what the problem is....

Thanks,
-- 
Vimal


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