public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "sureshpc123 at yahoo dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/10667] New: v2.6.28 KGDB/GDB problem resolving module function addresses
Date: Sat, 19 Sep 2009 11:42:00 -0000	[thread overview]
Message-ID: <20090919114254.10667.sureshpc123@yahoo.com> (raw)

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.

-- 
           Summary: v2.6.28 KGDB/GDB problem resolving module function
                    addresses
           Product: gdb
           Version: 6.8
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: sureshpc123 at yahoo dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=10667

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


                 reply	other threads:[~2009-09-19 11:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090919114254.10667.sureshpc123@yahoo.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).