Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jean-Rene Peulve <jr.peulve@wanadoo.fr>
To: gdb@sources.redhat.com
Subject: Wrong address for static function in linux module
Date: Tue, 11 Apr 2006 13:33:00 -0000	[thread overview]
Message-ID: <6.1.0.6.0.20060411102654.00ad0710@pop.wanadoo.fr> (raw)

Hi,
I am debugging a linux module on a Coldfire and I encounter the following
problem:
  -functions which have the static attribut are always relocated at offset 0
   of the .text section with the break command when the display command at the
   right address disassemble the right static function.
  -functions without the static attribut are relocated properly.

  I found out that the psymtab entry for a static function is relocated at the
  right offset in the .text section when the symtab entry for the same function
  is relocated at offset 0 of the .text section.

  To generate the target software, I use gcc 2.95.3
  I was using gdb 5.2.1, then I fetch gdb-6.4.50.20060405 and get the same
  problem.

Here are the details:

The nm command gives:
   - 00000136 t horloge_read
   - 0000037a T HorlogeCheck

I put a breakpoint at exit of the lookup_symbol to display the content of the
struct symbol (here this is gdb-6.4.50.20060405):

(top-gdb) b lookup_symbol
During symbol reading, inner block (0x770-0x83d) not inside outer block 
(0x80a309
c-0x80a31a4).
During symbol reading, block at 0x776 out of order.
Breakpoint 3 at 0x80a378d: file ../../gdb-6.4.50.20060405/gdb/symtab.c, 
line 1028
.
(top-gdb) c
Continuing.

Breakpoint 3, lookup_symbol (name=0x832d180 "HorlogeCheck", block=0x0,
     domain=VAR_DOMAIN, is_a_field_of_this=0x0, symtab=0x0)
     at ../../gdb-6.4.50.20060405/gdb/symtab.c:1028
1028      if (current_language->la_language == language_cplus)
(top-gdb) fin
Run till exit from #0  lookup_symbol (name=0x832d180 "HorlogeCheck", 
block=0x0,
     domain=VAR_DOMAIN, is_a_field_of_this=0x0, symtab=0x0)
     at ../../gdb-6.4.50.20060405/gdb/symtab.c:1028
c_lex () at c-exp.y:1740
1740        if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
Value returned is $1 = (struct symbol *) 0x83f1ab0
(top-gdb) p *(struct symbol *) 0x83f1ab0
$2 = {ginfo = {name = 0x8381388 "HorlogeCheck", value = {ivalue = 138353432,
       block = 0x83f1b18, bytes = 0x83f1b18 "Ú\003y", address = 138353432,
       chain = 0x83f1b18}, language_specific = {cplus_specific = {
         demangled_name = 0x0}}, language = language_c, section = 0,
     bfd_section = 0x837da44}, type = 0x83f1ad8, domain = VAR_DOMAIN,
   aclass = LOC_BLOCK, line = 627, ops = 0x0, aux_value = {basereg = 0,
     ptr = 0x0}, hash_next = 0x0}
(top-gdb) x/x ((struct symbol *) 0x83f1ab0)->ginfo.value.ivalue
0x83f1b18:      0x007903da  <<<=== offset 0x37a of .text OK
(top-gdb) c
Continuing.

Breakpoint 3, lookup_symbol (name=0x832d180 "horloge_read", block=0x0,
     domain=VAR_DOMAIN, is_a_field_of_this=0x0, symtab=0x0)
     at ../../gdb-6.4.50.20060405/gdb/symtab.c:1028
1028      if (current_language->la_language == language_cplus)
(top-gdb) fin
Run till exit from #0  lookup_symbol (name=0x832d180 "horloge_read", 
block=0x0,
     domain=VAR_DOMAIN, is_a_field_of_this=0x0, symtab=0x0)
     at ../../gdb-6.4.50.20060405/gdb/symtab.c:1028
c_lex () at c-exp.y:1740
1740        if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
Value returned is $3 = (struct symbol *) 0x83e6e3c
(top-gdb) p *(struct symbol *) 0x83e6e3c
$4 = {ginfo = {name = 0x8381284 "horloge_read", value = {ivalue = 138309632,
       block = 0x83e7000, bytes = 0x83e7000 "`", address = 138309632,
       chain = 0x83e7000}, language_specific = {cplus_specific = {
         demangled_name = 0x0}}, language = language_c, section = 0,
     bfd_section = 0x837da44}, type = 0x83e6e64, domain = VAR_DOMAIN,
   aclass = LOC_BLOCK, line = 375, ops = 0x0, aux_value = {basereg = 0,
     ptr = 0x0}, hash_next = 0x0}
(top-gdb) x/x ((struct symbol *) 0x83e6e3c)->ginfo.value.ivalue
0x83e7000:      0x00790060       <<<=== offset 0 of .text BAD BAD
(top-gdb)
I tried to go further to debug this problem but without succes so far.

Any help would be  appreciated.

Jean-Rene Peulve



             reply	other threads:[~2006-04-11  9:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-11 13:33 Jean-Rene Peulve [this message]
2006-04-11 13:38 ` Daniel Jacobowitz
2006-04-11 13:45   ` Jean-Rene Peulve
2006-04-11 13:55     ` Daniel Jacobowitz
2006-04-11 14:41       ` Jean-Rene Peulve
2006-04-11 15:05         ` Daniel Jacobowitz
2006-04-12 11:38           ` Jean-Rene Peulve
2006-04-12 16:36           ` stabs vs dwarf (was: Re: Wrong address for static function in linux module ) David Taylor
2006-04-13  7:02             ` Mark Kettenis
2006-04-13  8:26               ` Eli Zaretskii

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=6.1.0.6.0.20060411102654.00ad0710@pop.wanadoo.fr \
    --to=jr.peulve@wanadoo.fr \
    --cc=gdb@sources.redhat.com \
    /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