[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gdb
Subject:    v2.6.28 KGDB/GDB problem resolving module function addresses
From:       "Suresh P.C" <suresh.pc123 () gmail ! com>
Date:       2009-09-19 6:07:09
Message-ID: 4855fdcc0909182255xec2f91g2bc123dc4c36ee89 () mail ! gmail ! com
[Download RAW message or body]

v2.6.28 of the kernel seems to have changed the way module sections
are created which prevents KGDB/GDB (v6.8) from correctly evaluating
the addresses of functions within the module. The problem does not
exist with kernel v2.6.26. Example follows:

After I load a module, I can see the module section information in the
directory /sys/module/chardev/sections as follows:

#ls -a
.                          .symtab
..                         .text
.bss                       .text.cleanup_module
.data                      .text.device_ioctl
.fixup                     .text.device_open
.gnu.linkonce.this_module  .text.device_read
.note.gnu.build-id         .text.device_release
.reginfo                   .text.device_write
.rodata.str1.4             .text.init_module
.strtab                    __ex_table
#

I then add the module symbols to gdb as follows:

(gdb) add-symbol file chardev.ko 0xc0745000 -s .data 0xc0745e20 -s
.bss 0xc0746000 -s .reginfo 0xc0745534

Now when I try to get the address of a function the wrong value is
returned i.e. all functions get the same address

(gdb) p /x &device_write
$1 = 0xc0745000
(gdb) p /x &device_read
$2 = 0xc0745000
(gdb) p /x &device_open
$3 = 0xc0745000

Tried adding explicitly as follows:

(gdb) add-symbol-file ../moduletest/chardev.ko 0xc0745000 -s .reginfo
0xc0745534 -s .data 0xc0745e20 -s .bss 0xc0746000 -s .text.device_open
0xc07450a0 -s .text.device_write 0xc07450a0 -s .text.device_read
0xc07451ac add symbol table from file "../moduletest/chardev.ko" at
     .text_addr = 0xc0745000
     .reginfo_addr = 0xc0745534
     .data_addr = 0xc0745e20
     .bss_addr = 0xc0746000
     .text.device_open_addr = 0xc07450a0
     .text.device_write_addr = 0xc07450a0
     .text.device_read_addr = 0xc07451ac (y or n) y Reading symbols
from /home/suresh/moduletest/chardev.ko...done.
(gdb)

However, the result is still the same i.e.:

(gdb) p /x &device_write
$4 = 0xc0745000
(gdb) p /x &device_read
$5 = 0xc0745000
(gdb) p /x &device_open
$6 = 0xc0745000

Any help/explanation appreciated.

Regards,
Suresh

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic