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 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


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