Hi Caz,

I am using MIPS architecture target.

The file details of a module is as follows: (for testing I made a chardev.ko). 
You can see the section differences.

readelf -S chardev.ko (2.6.26)


Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .reginfo          MIPS_REGINFO    00000000 000034 000018 18   A  0   0  4
  [ 2] .note.gnu.build-i NOTE            00000018 00004c 000024 00   A  0   0  4
  [ 3] .text             PROGBITS        00000000 000070 000520 00  AX  0   0 16
  [ 4] .rel.text         REL             00000000 00b6e8 0002f8 08     37   3  4
  [ 5] .fixup            PROGBITS        00000000 000590 000028 00  AX  0   0  1
  [ 6] .rel.fixup        REL             00000000 00b9e0 000028 08     37   5  4
  [ 7] .rodata.str1.4    PROGBITS        00000000 0005b8 000238 01 AMS  0   0  4
  [ 8] __ex_table        PROGBITS        00000000 0007f0 000028 00   A  0   0  4
  [ 9] .rel__ex_table    REL             00000000 00ba08 000050 08     37   8  4
  [10] .modinfo          PROGBITS        00000000 000818 000070 00   A  0   0  4
  [11] __versions        PROGBITS        00000000 000888 000100 00   A  0   0  4
  [12] .data             PROGBITS        00000000 000990 000070 00  WA  0   0 16
  [13] .rel.data         REL             00000000 00ba58 000028 08     37  12  4
  [14] .gnu.linkonce.thi PROGBITS        00000000 000a00 000180 00  WA  0   0 32
  [15] .rel.gnu.linkonce REL             00000000 00ba80 000010 08     37  14  4
  [16] .bss              NOBITS          00000000 000b80 000060 00  WA  0   0 16
  [17] .pdr              PROGBITS        00000000 000b80 0000e0 00      0   0  4
  [18] .rel.pdr          REL             00000000 00ba90 000038 08     37  17  4
  [19] .comment          PROGBITS        00000000 000c60 000050 00      0   0  1
  [20] .debug_aranges    MIPS_DWARF      00000000 000cb0 000020 00      0   0  1
  [21] .rel.debug_arange REL             00000000 00bac8 000010 08     37  20  4
  [22] .debug_pubnames   MIPS_DWARF      00000000 000cd0 0000a7 00      0   0  1
  [23] .rel.debug_pubnam REL             00000000 00bad8 000010 08     37  22  4
  [24] .debug_info       MIPS_DWARF      00000000 000d77 0060a8 00      0   0  1
  [25] .rel.debug_info   REL             00000000 00bae8 002b78 08     37  24  4
  [26] .debug_abbrev     MIPS_DWARF      00000000 006e1f 0004e5 00      0   0  1
  [27] .debug_line       MIPS_DWARF      00000000 007304 0005ef 00      0   0  1
  [28] .rel.debug_line   REL             00000000 00e660 000008 08     37  27  4
  [29] .debug_frame      MIPS_DWARF      00000000 0078f4 0000cc 00      0   0  4
  [30] .rel.debug_frame  REL             00000000 00e668 000070 08     37  29  4
  [31] .debug_str        MIPS_DWARF      00000000 0079c0 00303b 01  MS  0   0  1
  [32] .debug_loc        MIPS_DWARF      00000000 00a9fb 000517 00      0   0  1
  [33] .debug_ranges     MIPS_DWARF      00000000 00af12 000048 00      0   0  1
  [34] .gnu.attributes   LOOS+ffffff5    00000000 00af5a 000010 00      0   0  1
  [35] .mdebug.abi32     PROGBITS        00000020 00af6a 000000 00      0   0  1
  [36] .shstrtab         STRTAB          00000000 00af6a 000165 00      0   0  1
  [37] .symtab           SYMTAB          00000000 00e6d8 000420 10     38  58  4
  [38] .strtab           STRTAB          00000000 00eaf8 0001a4 00      0   0  1
 

readelf -S chardev.ko (2.6.28) kernel

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .reginfo          MIPS_REGINFO    00000000 000034 000018 18   A  0   0  4
  [ 2] .note.gnu.build-i NOTE            00000018 00004c 000024 00   A  0   0  4
  [ 3] .text             PROGBITS        00000000 000070 000000 00  AX  0   0 16
  [ 4] .text.device_rele PROGBITS        00000000 000070 000048 00  AX  0   0  4
  [ 5] .rel.text.device_ REL             00000000 00c1ec 000038 08     52   4  4
  [ 6] .text.device_open PROGBITS        00000000 0000b8 000058 00  AX  0   0  4
  [ 7] .rel.text.device_ REL             00000000 00c224 000058 08     52   6  4
  [ 8] .text.device_writ PROGBITS        00000000 000110 0000e8 00  AX  0   0  4
  [ 9] .rel.text.device_ REL             00000000 00c27c 000070 08     52   8  4
  [10] .fixup            PROGBITS        00000000 0001f8 000028 00  AX  0   0  1
  [11] .rel.fixup        REL             00000000 00c2ec 000028 08     52  10  4
  [12] .text.device_read PROGBITS        00000000 000220 0000f0 00  AX  0   0  4
  [13] .rel.text.device_ REL             00000000 00c314 000060 08     52  12  4
  [14] .text.device_ioct PROGBITS        00000000 000310 000180 00  AX  0   0  4
  [15] .rel.text.device_ REL             00000000 00c374 000068 08     52  14  4
  [16] .text.cleanup_mod PROGBITS        00000000 000490 000018 00  AX  0   0  4
  [17] .rel.text.cleanup REL             00000000 00c3dc 000020 08     52  16  4
  [18] .text.init_module PROGBITS        00000000 0004a8 000104 00  AX  0   0  4
  [19] .rel.text.init_mo REL             00000000 00c3fc 000110 08     52  18  4
  [20] .rodata.str1.4    PROGBITS        00000000 0005ac 000238 01 AMS  0   0  4
  [21] __ex_table        PROGBITS        00000000 0007e4 000028 00   A  0   0  4
  [22] .rel__ex_table    REL             00000000 00c50c 000050 08     52  21  4
  [23] .modinfo          PROGBITS        00000000 00080c 000070 00   A  0   0  4
  [24] __versions        PROGBITS        00000000 00087c 000100 00   A  0   0  4
  [25] .data             PROGBITS        00000000 000980 000070 00  WA  0   0 16
  [26] .rel.data         REL             00000000 00c55c 000028 08     52  25  4
  [27] .gnu.linkonce.thi PROGBITS        00000000 000a00 000160 00  WA  0   0 32
  [28] .rel.gnu.linkonce REL             00000000 00c584 000010 08     52  27  4
  [29] .bss              NOBITS          00000000 000b60 000060 00  WA  0   0 16
  [30] .pdr              PROGBITS        00000000 000b60 0000e0 00      0   0  4
  [31] .rel.pdr          REL             00000000 00c594 000038 08     52  30  4
  [32] .comment          PROGBITS        00000000 000c40 000050 00      0   0  1
  [33] .debug_aranges    MIPS_DWARF      00000000 000c90 000050 00      0   0  1
  [34] .rel.debug_arange REL             00000000 00c5cc 000040 08     52  33  4
  [35] .debug_pubnames   MIPS_DWARF      00000000 000ce0 0000a7 00      0   0  1
  [36] .rel.debug_pubnam REL             00000000 00c60c 000010 08     52  35  4
  [37] .debug_info       MIPS_DWARF      00000000 000d87 00655f 00      0   0  1
  [38] .rel.debug_info   REL             00000000 00c61c 002d88 08     52  37  4
  [39] .debug_abbrev     MIPS_DWARF      00000000 0072e6 000517 00      0   0  1
  [40] .debug_line       MIPS_DWARF      00000000 0077fd 0006a7 00      0   0  1
  [41] .rel.debug_line   REL             00000000 00f3a4 000038 08     52  40  4
  [42] .debug_frame      MIPS_DWARF      00000000 007ea4 0000cc 00      0   0  4
  [43] .rel.debug_frame  REL             00000000 00f3dc 000070 08     52  42  4
  [44] .debug_str        MIPS_DWARF      00000000 007f70 003217 01  MS  0   0  1
  [45] .debug_loc        MIPS_DWARF      00000000 00b187 000548 00      0   0  1
  [46] .rel.debug_loc    REL             00000000 00f44c 0005e0 08     52  45  4
  [47] .debug_ranges     MIPS_DWARF      00000000 00b6cf 000090 00      0   0  1
  [48] .rel.debug_ranges REL             00000000 00fa2c 0000e0 08     52  47  4
  [49] .gnu.attributes   LOOS+ffffff5    00000000 00b75f 000010 00      0   0  1
  [50] .mdebug.abi32     PROGBITS        00000020 00b76f 000000 00      0   0  1
  [51] .shstrtab         STRTAB          00000000 00b76f 00020b 00      0   0  1
  [52] .symtab           SYMTAB          00000000 00fb0c 000490 10     53  65  4
  [53] .strtab           STRTAB          00000000 00ff9c 0001cb 00      0   0  1



Suresh



----- Original Message ----
From: Caz Yokoyama <[email protected]>
To: Suresh P.C <[email protected]>; [email protected]
Sent: Wednesday, 30 September, 2009 1:30:07 AM
Subject: RE: [Kgdb-bugreport] KGDB/GDB problem resolving module function 
addresses

Hello Suresh,
I don't think there is difference between v2.6.26 and later in module
sections. The address of e1000_rx_checksum is 0xffffffffa0093b59 on
v2.6.30.8. I guess something wrong on your .ko file. Have you dumped symbols
of your .ko file?
-caz

-----Original Message-----
From: Suresh P.C [mailto:[email protected]] 
Sent: Tuesday, September 29, 2009 12:18 AM
To: [email protected]
Subject: [Kgdb-bugreport] KGDB/GDB problem resolving module
functionaddresses

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 but the problem exist with kernel 2.6.30 also. 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 .data0xc0745e20 -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


      Connect more, do more and share more with Yahoo! India Mail. Learn
more. http://in.overview.mail.yahoo.com/

----------------------------------------------------------------------------
--
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport


      Try the new Yahoo! India Homepage. Click here. http://in.yahoo.com/trynew

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to