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]

v2.6.28 KGDB/GDB problem resolving module function addresses


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


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