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]

Wrong address for static function in linux module


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



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