<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Message: 1<br>
Date: Fri, 8 Aug 2008 16:10:34 +0530<br>
From: "Durga Prasad" <<a href="mailto:durgaprasadsharma@gmail.com" target="_blank">durgaprasadsharma@gmail.com</a>><br>
Subject: [Crash-utility] Viewing module symbols using crash<br>
To: <a href="mailto:crash-utility@redhat.com" target="_blank">crash-utility@redhat.com</a><br>
Message-ID:<br>
        <<a href="mailto:4295d5fd0808080340h3996b141oacb4eee4eb9ee00e@mail.gmail.com" target="_blank">4295d5fd0808080340h3996b141oacb4eee4eb9ee00e@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi,<br>
<br>
[1]:<br>
I need to debug a kernel module (a device driver).<br>
I added the desired module to crash using mod -S <path to module>. The<br>
driver is compiled with -g option.<br>
I could not see the structures defined within the module.<br>
<br>
Am I missing something?<br>
<br>
System info:<br>
    KERNEL: vmlinux.sles10sp2.smp.x86_64<br>
    DUMPFILE: 2008-08-08-18:57/vmcore<br>
    CPUS: 4<br>
<br>
     RELEASE: 2.6.16.60-0.21-smp<br>
     VERSION: #1 SMP Tue May 6 12:41:02 UTC 2008<br>
     MACHINE: x86_64  (1995 Mhz)<br>
     MEMORY: 3.9 GB<br>
<br>
<br>
<br>
[2]:<br>
I could get into live kernel debugging using crash on RHEL 5 after<br>
installing relevant kernel-debug packages. How do I do the same on SLES 10?<br>
As of now, I have been compiling the kernel with CONFIG_DEBUG_INFO set. I<br>
can use the resulting vmlinux for post crash analysis, but not for live<br>
analysis.  Any light on how to accomplish this would be appreciated.<br>
<br>
<br>
Thanks<br>
Durga Prasad<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="https://www.redhat.com/archives/crash-utility/attachments/20080808/bd7e28cf/attachment.html" target="_blank">https://www.redhat.com/archives/crash-utility/attachments/20080808/bd7e28cf/attachment.html</a><br>


<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 08 Aug 2008 09:32:09 -0400<br>
From: Dave Anderson <<a href="mailto:anderson@redhat.com" target="_blank">anderson@redhat.com</a>><br>
Subject: Re: [Crash-utility] Viewing module symbols using crash<br>
To: "Discussion list for crash utility usage,   maintenance and<br>
        development" <<a href="mailto:crash-utility@redhat.com" target="_blank">crash-utility@redhat.com</a>><br>
Cc: Bernhard Walle <<a href="mailto:bwalle@suse.de" target="_blank">bwalle@suse.de</a>><br>
Message-ID: <<a href="mailto:489C4AD9.4010309@redhat.com" target="_blank">489C4AD9.4010309@redhat.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
Durga Prasad wrote:<br>
> Hi,<br>
><br>
> [1]:<br>
> I need to debug a kernel module (a device driver).<br>
> I added the desired module to crash using mod -S <path to module>. The<br>
> driver is compiled with -g option.<br>
> I could not see the structures defined within the module.<br>
><br>
> Am I missing something?<br>
<br>
Accessing data in kernel modules can be spotty at best,<br>
but the embedded gdb module should typically be able<br>
to pick up structure definitions in modules.<br>
<br>
For example, these two structures are defined in ./fs/ext3/xattr.c<br>
like so:<br>
<br>
   struct ext3_xattr_info {<br>
           int name_index;<br>
           const char *name;<br>
           const void *value;<br>
           size_t value_len;<br>
   };<br>
<br>
   struct ext3_xattr_search {<br>
           struct ext3_xattr_entry *first;<br>
           void *base;<br>
           void *end;<br>
           struct ext3_xattr_entry *here;<br>
           int not_found;<br>
   };<br>
<br>
Without the ext3 module debuginfo, crash (gdb) doesn't know what<br>
they are:<br>
<br>
   # crash -s<br>
   crash> struct ext3_xattr_search<br>
   struct: invalid data structure reference: ext3_xattr_search<br>
   crash> struct ext3_xattr_info<br>
   struct: invalid data structure reference: ext3_xattr_info<br>
   crash><br>
<br>
Until after adding the module debuginfo data:<br>
<br>
   crash> mod -s ext3<br>
        MODULE       NAME               SIZE  OBJECT FILE<br>
   ffffffff8806be00  ext3             168017  /lib/modules/2.6.18-102.el5.perfmon2/kernel/fs/ext3/ext3.ko<br>
   crash> struct ext3_xattr_search<br>
   struct ext3_xattr_search {<br>
       struct ext3_xattr_entry *first;<br>
       void *base;<br>
       void *end;<br>
       struct ext3_xattr_entry *here;<br>
       int not_found;<br>
   }<br>
   SIZE: 40<br>
   crash> struct ext3_xattr_info<br>
   struct ext3_xattr_info {<br>
       int name_index;<br>
       const char *name;<br>
       const void *value;<br>
       size_t value_len;<br>
   }<br>
   SIZE: 32<br>
   crash><br>
<br>
Then you may be able to "p" individual instances of the structures<br>
if there are symbolic/static declaration of them.  Otherwise you<br>
can always cast the address of the structure to the structure type,<br>
as in:<br>
<br>
   crash> struct ext3_xattr_info <address><br>
<br>
If you cannot get the structure declaration after using "mod -[sS]",<br>
then you'll have to get primitive, and just dump the data at the<br>
relevant address with "rd".<br>
<br>
><br>
> System info:<br>
>     KERNEL: vmlinux.sles10sp2.smp.x86_64<br>
>     DUMPFILE: 2008-08-08-18:57/vmcore<br>
>     CPUS: 4<br>
><br>
>      RELEASE: 2.6.16.60-0.21-smp<br>
>      VERSION: #1 SMP Tue May 6 12:41:02 UTC 2008<br>
>      MACHINE: x86_64  (1995 Mhz)<br>
>      MEMORY: 3.9 GB<br>
><br>
><br>
><br>
> [2]:<br>
> I could get into live kernel debugging using crash on RHEL 5 after<br>
> installing relevant kernel-debug packages. How do I do the same on SLES 10?<br>
> As of now, I have been compiling the kernel with CONFIG_DEBUG_INFO set.<br>
> I can use the resulting vmlinux for post crash analysis, but not for<br>
> live analysis.  Any light on how to accomplish this would be appreciated.<br>
<br>
For SLES I'm guessing that you could use the post-built (CONFIG_DEBUG_INFO) kernel,<br>
but also add the System.map file of the live kernel to the command line, as in:<br>
<br>
   $ crash /boot/System.map vmlinux-post-built-with-debuginfo<br>
<br>
Crash will use the debuginfo data from the vmlinux file, but then go in<br>
and back-patch all the vmlinux file's minimal_symbols with the correct<br>
symbol values from the System.map file.<br>
<br>
But Bernhard Walle (<a href="mailto:bwalle@suse.de" target="_blank">bwalle@suse.de</a>) can answer that part of your question.<br>
He's active on this list, but I've added him to the cc: list to make<br>
sure he sees this.<br>
<br>
Dave Anderson<br>
<br>
<br>
><br>
> Thanks<br>
> Durga Prasad<br>
><br>
</blockquote><div><br><br> </div><div>Hi Dave, <br>I attempted to try your suggested commands, but it tends to fail on my machine: <br><br><br>libl041:/var/log/dump # crash -s vmlinux.sles10sp2.smp.x86_64 2008-08-08-23\:27/vmcore<br>

crash> struct ext3_xattr_search<br>struct: invalid data structure reference: ext3_xattr_search<br>crash> mod -s ext3<br>     MODULE       NAME                   SIZE  OBJECT FILE<br>ffffffff8856a500  ext3                 153360  /lib/modules/2.6.16.60-0.21-smp/kernel/fs/ext3/ext3.ko<br>

crash> struct ext3_xattr_search<br>struct: invalid data structure reference: ext3_xattr_search<br>crash> struct ext3_xattr_info<br>
struct: invalid data structure reference: ext3_xattr_info<br>
<br>
<br>crash> sys<br>      KERNEL: vmlinux.sles10sp2.smp.x86_64<br>    DUMPFILE: 2008-08-08-23:27/vmcore<br>        CPUS: 4<br>        DATE: Fri Aug  8 23:20:09 2008<br>      UPTIME: 01:31:48<br>LOAD AVERAGE: 2.48, 1.32, 0.56<br>

       TASKS: 157<br>    NODENAME: libl041<br>     RELEASE: 2.6.16.60-0.21-smp<br>     VERSION: #1 SMP Tue May 6 12:41:02 UTC 2008<br>     MACHINE: x86_64  (1995 Mhz)<br>      MEMORY: 3.9 GB<br>       PANIC: "Oops: 0000 [1] SMP " (check log for details)<br>

<br>crash version: 4.0-4.10   gdb version: 6.1<br><br>I tried the same after compiling and installing the latest crash version (crash version: 4.0-6.3   gdb version: 6.1) with no difference in results. <br><br>What would you suggest? <br>
<br>Thanks<br>Durga<br><br></div></div><br>
</div>