public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Vimal <j.vimal@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Jan Kiszka <jan.kiszka@web.de>, gdb@sourceware.org
Subject: Re: Multiple breakpoint issue when debugging loadable kernel module
Date: Fri, 28 Oct 2011 03:40:00 -0000	[thread overview]
Message-ID: <CAK3Ji109-gd-zHfYSW70XEubPuugW8KRD5o08z5Qfug+f0LSNQ@mail.gmail.com> (raw)
In-Reply-To: <m3aa8mb58w.fsf@fleche.redhat.com>

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

  reply	other threads:[~2011-10-28  0:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24  2:20 Vimal
2011-10-24 14:11 ` Vimal
2011-10-26 12:25 ` Vimal
2011-10-27  0:22   ` Jan Kiszka
2011-10-27  0:43     ` Vimal
2011-10-27  7:21       ` Jan Kiszka
2011-10-27 14:59         ` Vimal
2011-10-27 16:12           ` Jan Kiszka
2011-10-28  0:16         ` Tom Tromey
2011-10-31 17:20           ` Jan Kiszka
2011-10-27 19:38     ` Tom Tromey
2011-10-28  3:40       ` Vimal [this message]
2011-10-28 21:07         ` Vimal
2011-10-31 17:18           ` Jan Kiszka
2011-10-31 21:33             ` Tom Tromey
2011-11-01 15:32               ` Jan Kiszka
2011-11-01 20:13                 ` Jan Kratochvil
2011-11-05  2:07                   ` Vimal
2011-11-05  5:39                     ` Jan Kratochvil
2011-11-08  0:33                   ` Jan Kratochvil
2011-11-05  2:10             ` Vimal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK3Ji109-gd-zHfYSW70XEubPuugW8KRD5o08z5Qfug+f0LSNQ@mail.gmail.com \
    --to=j.vimal@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=jan.kiszka@web.de \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).