public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Vimal <j.vimal@gmail.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb@sourceware.org
Subject: Re: Multiple breakpoint issue when debugging loadable kernel module
Date: Mon, 31 Oct 2011 17:18:00 -0000	[thread overview]
Message-ID: <4EAED7DC.5030805@siemens.com> (raw)
In-Reply-To: <CAK3Ji13FeEtpsq80eAwsyQo+xxSyiyjhDQ=MKXniXJr-d1p2Fg@mail.gmail.com>

On 2011-10-28 05:39, Vimal wrote:
> Some more info.  This looks interesting.
> 
> 1. find_pc_sect_symtab has changed quite a bit between the faulty
> commit noted above (sha 2cdbbe44) and its parent (2cdbbe44^)!
> 
> 2. Since the module is loaded into the kernel address space,
> find_pc_sect_symtab seems to think the vmlinux module's symbol table
> has symbol information for the function I am breaking into.   Some
> prints from find_pc_sect_symtab for a LKM function seems to return
> vmlinux's symtab! :(
> 
> find_pc_sect_symtab(pc=0xffffffffa00d5bb8,sec=0x20fb988)
> objfile=0x11cbc40, name=/usr/src/linux-cfs-bw/vmlinux
> Returning 0x2690cc0 (objfile=0x11cbc40)  # Which is vmlinux
> 
> So, I checked the BLOCK_START and BLOCK_END for the vmlinux image.  I got this:
> start=0xffffffff8102eb10
> end=0xffffffffff60017f
> 
> and pc=0xffffffffa00d5bb8 was very well within start and end, so it
> chose vmlinux. :(
> 
> So, I tired this (without loading vmlinux's symbols)
> 
> (gdb) target remote localhost:1234
> (gdb) add-symbol-file (for module)
> (gdb) info scope module_function
> (got info)
> (gdb) break module_function
> (correct break)
> (gdb) info scope module_function
> (got correct info!  it works!)
> 
> All locals/args info is retained.
> 
> So, to combat this, I presently do this (load vmlinux _after_ loading
> module symbols)
> 
> gdb (without vmlinux)
> (gdb) target remote ...
> (gdb) add-symbol-file (for module)
> (gdb) file vmlinux
> (gdb) break vport_receive
> Breakpoint 1, vport_receive (vport=0xffff880115fa7200,
> skb=0xffff880117580900) at
> /home/nikhilh/openvswitch/datapath/linux/vport.c:643
> 643             if (vport->ops->flags & VPORT_F_GEN_STATS) {
> 
> With full information.
> 
> I am also able to break into Linux functions, like sys_write for e.g.
> 
> Jan: can you try this and tell us if it works?

Yes, that works (around the bug). But it does not help me as it's
unhandy (gdb assumes 32-bit by default, my kernels are 64 usually) and
automatic module loading depends on the kernel symbols already being
present.

Tom, do you still like to have a description of the full reproduction
scenario or are you debugging via Vimal?

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2011-10-31 17: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
2011-10-28 21:07         ` Vimal
2011-10-31 17:18           ` Jan Kiszka [this message]
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=4EAED7DC.5030805@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=gdb@sourceware.org \
    --cc=j.vimal@gmail.com \
    --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).