Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jon Ringle <jon@ringle.org>
To: Jim Blandy <jimb@codesourcery.com>,
	Jon Ringle <JRingle@vertical.com>,
	  gdb@sourceware.org
Subject: Re: No line number info debugging kernel modules with gdb	6.6.90.20070926-cvs   (gdb 6.7 branch)
Date: Sat, 29 Sep 2007 07:38:00 -0000	[thread overview]
Message-ID: <46FDB801.5010401@ringle.org> (raw)
In-Reply-To: <20070929020649.GA10700@caradoc.them.org>

Daniel Jacobowitz wrote:
> On Fri, Sep 28, 2007 at 09:28:34PM -0400, Jon Ringle wrote:
>   
>> So, do I need to put all the sections that I find in 
>> /sys/module/dstdrv/sections/.[a-z]* on the target
>>     
>
> Probably.
>
>   
I created the following helper script on the target:
[root@isc1 ~]# cat /usr/local/bin/add-symbol-file
#! /bin/bash

MODULE=$1
for f in $(ls -1 /sys/module/${MODULE}/sections/.[a-z]*|grep -E -v 
'/.text$');
do
        echo -n "-s $(basename $f) $(cat $f) ";
done
echo
[root@isc1 ~]# add-symbol-file dstdrv
-s .bss 0xbf137180 -s .data 0xbf136f30 -s .exit.text 0xbf134638 -s 
.gnu.linkonce.this_module 0xbf137040 -s .init.text 0xbf13b000 -s .rodata 
0xbf1346c0 -s .rodata.str1.8 0xbf1348f0 -s .strtab 0xbf136800 -s .symtab 
0xbf135940

Then I defined the following gdb command:
ringlej@crossdev:~/WAVE/Build7/Platform/Volcano/os/kernel/linux$ cat 
.gdbinit
define load_kernel_module
shell echo -n "add-symbol-file $arg1 " > .load_kernel_module.tmp
shell echo -n "$(ssh $arg0 cat /sys/module/$(basename $arg1 
.ko)/sections/.text) " >> .load_kernel_module.tmp
shell echo "$(ssh $arg0 /usr/local/bin/add-symbol-file $(basename $arg1 
.ko))" >> .load_kernel_module.tmp
shell echo "directory $(dirname $arg1)" >> .load_kernel_module.tmp
source .load_kernel_module.tmp
shell rm .load_kernel_module.tmp
end

ringlej@crossdev:~/WAVE/Build7/Platform/Volcano/os/kernel/linux$ 
~/build/armeb-linux-gdb-6.7/gdb/gdb vmlinux
GNU gdb 6.6.90.20070926-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu 
--target=armeb-linux"...
(gdb) target remote bdilab:2001
Remote debugging using bdilab:2001
default_idle () at include/asm/thread_info.h:92
92              register unsigned long sp asm ("sp");
(gdb) load_kernel_module root@ixp.ringle.lan 
../../kernel-modules/dst/dstdrv.ko
add symbol table from file "../../kernel-modules/dst/dstdrv.ko" at
        .text_addr = 0xbf131000
        .bss_addr = 0xbf137180
        .data_addr = 0xbf136f30
        .exit.text_addr = 0xbf134638
        .gnu.linkonce.this_module_addr = 0xbf137040
        .init.text_addr = 0xbf13b000
        .rodata_addr = 0xbf1346c0
        .rodata.str1.8_addr = 0xbf1348f0
        .strtab_addr = 0xbf136800
        .symtab_addr = 0xbf135940
warning: section .strtab not found in 
/home/ringlej/WAVE/Build7/Platform/Volcano/os/kernel-modules/dst/dstdrv.ko
warning: section .symtab not found in 
/home/ringlej/WAVE/Build7/Platform/Volcano/os/kernel-modules/dst/dstdrv.ko
(gdb) show directories
Source directories searched: 
/home/ringlej/WAVE/Build7/Platform/Volcano/os/kernel/linux-2.6.16.29/../../kernel-modules/dst:$cdir:$cwd
(gdb) b vert_dst_nopage_mmap
Breakpoint 1 at 0xbf13427c
(gdb) list vert_dst_nopage_mmap
No line number known for vert_dst_nopage_mmap.


  reply	other threads:[~2007-09-29  2:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27 20:11 Jon Ringle
2007-09-28  0:25 ` Jim Blandy
2007-09-28  3:47   ` Jon Ringle
2007-09-28 13:47   ` Jon Ringle
2007-09-28 16:01     ` Jon Ringle
2007-09-28 21:32     ` Jim Blandy
2007-09-28 22:06       ` ringlej
2007-09-29  0:27         ` Jim Blandy
2007-09-29  0:27           ` Daniel Jacobowitz
2007-09-29  2:06             ` Jon Ringle
2007-09-29  2:27               ` Daniel Jacobowitz
2007-09-29  7:38                 ` Jon Ringle [this message]
2007-10-02 21:38                   ` Jim Blandy
2007-10-02 22:54                     ` Jon Ringle
2007-10-02 20:26             ` Jim Blandy
2007-10-02 20:43               ` Daniel Jacobowitz
2007-09-29  1:28           ` Jon Ringle

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=46FDB801.5010401@ringle.org \
    --to=jon@ringle.org \
    --cc=JRingle@vertical.com \
    --cc=gdb@sourceware.org \
    --cc=jimb@codesourcery.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