Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Wrong address for static function in linux module
@ 2006-04-11 13:33 Jean-Rene Peulve
  2006-04-11 13:38 ` Daniel Jacobowitz
  0 siblings, 1 reply; 10+ messages in thread
From: Jean-Rene Peulve @ 2006-04-11 13:33 UTC (permalink / raw)
  To: gdb

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-04-13  8:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-11 13:33 Wrong address for static function in linux module Jean-Rene Peulve
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox