Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jean-Rene Peulve <jr.peulve@wanadoo.fr>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sources.redhat.com
Subject: Re: Wrong address for static function in linux module
Date: Tue, 11 Apr 2006 13:45:00 -0000	[thread overview]
Message-ID: <6.1.0.6.0.20060411152707.00acc440@pop.wanadoo.fr> (raw)
In-Reply-To: <20060411131142.GA21521@nevyn.them.org>

Hi Daniel,
See below.
Jean-Rene Peulvé
At 15:11 11/04/06, Daniel Jacobowitz wrote:
>On Tue, Apr 11, 2006 at 11:01:13AM +0200, Jean-Rene Peulve wrote:
> > 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.
>
>This is normally supposed to be handled in
>symfile_relocate_debug_section.  Are the bad functions really in
>".text", or in another named text section?
Both functions horloge_read and HorlogeCheck are in the .text section.

>   Does the debug section
>have proper relocations for that .debug_info entry (readelf -r)?

Here the output of m68k-elf-readelf -s horloge.o (using binutils-2.16.1):
I am not familiar with the following output. static functions does not show
up in this list.

Relocation section '.rela.text' at offset 0x20060 contains 59 entries:
  Offset     Info    Type            Sym.Value  Sym. Name + Addend
00000006  00000401 R_68K_32          00000000   .bss + 8
0000000c  00001e01 R_68K_32          00000000   jiffies + 0
00000012  00000301 R_68K_32          00000000   .data + 14
0000001a  00000201 R_68K_32          00000000   .text + 32
00000020  00000401 R_68K_32          00000000   .bss + 10
0000002a  00001f01 R_68K_32          00000000   add_timer + 0
00000038  00000301 R_68K_32          00000000   .data + 18
0000003e  00000301 R_68K_32          00000000   .data + 18
0000005c  00001c01 R_68K_32          00000008   horlogeWq + 0
00000062  00002001 R_68K_32          00000000   __wake_up + 0
00000068  00000201 R_68K_32          00000000   .text + 0
0000007e  00002101 R_68K_32          00000000   kmalloc + 0
00000096  00000301 R_68K_32          00000000   .data + 18
0000009c  00000301 R_68K_32          00000000   .data + 18
000000a4  00000301 R_68K_32          00000000   .data + 18
000000b0  00000301 R_68K_32          00000000   .data + 18
000000ba  00000301 R_68K_32          00000000   .data + 18
000000c4  00000301 R_68K_32          00000000   .data + 14
000000f2  00002201 R_68K_32          00000000   kfree + 0
000000f8  00000301 R_68K_32          00000000   .data + 18
00000100  00000301 R_68K_32          00000000   .data + 18
00000110  00000301 R_68K_32          00000000   .data + 18
00000116  00000301 R_68K_32          00000000   .data + 18
0000011e  00000401 R_68K_32          00000000   .bss + 0
00000124  00002301 R_68K_32          00000000   del_timer + 0
0000014c  00001c01 R_68K_32          00000008   horlogeWq + 0
00000152  00002401 R_68K_32          00000000   interruptible_sleep_on + 0
00000188  00001c01 R_68K_32          00000008   horlogeWq + 0
0000019c  00002501 R_68K_32          00000000   __pollwait + 0
000001c6  00000301 R_68K_32          00000000   .data + 14
000001f2  00002601 R_68K_32          00000000   _ramend + 0
000001fc  00002701 R_68K_32          00000000   is_in_rom + 0
0000020a  00002701 R_68K_32          00000000   is_in_rom + 0
00000224  00000501 R_68K_32          00000000   .rodata + 5
0000022a  00002801 R_68K_32          00000000   printk + 0
0000023e  00002601 R_68K_32          00000000   _ramend + 0
00000248  00002701 R_68K_32          00000000   is_in_rom + 0
00000256  00002701 R_68K_32          00000000   is_in_rom + 0
00000270  00000501 R_68K_32          00000000   .rodata + 2b
00000276  00002801 R_68K_32          00000000   printk + 0
000002a0  00002901 R_68K_32          00000000   memcpy + 0
000002bc  00000501 R_68K_32          00000000   .rodata + 52
000002c2  00002801 R_68K_32          00000000   printk + 0
000002d6  00000301 R_68K_32          00000000   .data + 14
000002e8  00000301 R_68K_32          00000000   .data + 14
000002fc  00002901 R_68K_32          00000000   memcpy + 0
00000306  00000301 R_68K_32          00000000   .data + 14
0000030e  00000401 R_68K_32          00000000   .bss + 0
00000314  00002301 R_68K_32          00000000   del_timer + 0
0000031a  00000201 R_68K_32          00000000   .text + 0
00000330  00000301 R_68K_32          00000000   .data + 20
00000336  00000501 R_68K_32          00000000   .rodata + 66
00000340  00002a01 R_68K_32          00000000   register_chrdev + 0
00000346  00000401 R_68K_32          00000000   .bss + 4
0000034c  00000401 R_68K_32          00000000   .bss + 0
0000035c  00000501 R_68K_32          00000000   .rodata + 66
00000366  00002b01 R_68K_32          00000000   unregister_chrdev + 0
0000036c  00000401 R_68K_32          00000000   .bss + 0
00000372  00002301 R_68K_32          00000000   del_timer + 0

Relocation section '.rela.data' at offset 0x20324 contains 10 entries:
  Offset     Info    Type            Sym.Value  Sym. Name + Addend
0000000c  00001c01 R_68K_32          00000008   horlogeWq + 4
00000010  00001c01 R_68K_32          00000008   horlogeWq + 4
00000018  00000301 R_68K_32          00000000   .data + 18
0000001c  00000301 R_68K_32          00000000   .data + 18
00000020  00001d01 R_68K_32          00000000   __this_module + 0
00000028  00000201 R_68K_32          00000000   .text + 136
00000034  00000201 R_68K_32          00000000   .text + 174
00000038  00000201 R_68K_32          00000000   .text + 1b4
00000040  00000201 R_68K_32          00000000   .text + 70
00000048  00000201 R_68K_32          00000000   .text + ce

Relocation section '.rela.stab' at offset 0x2039c contains 41 entries:
  Offset     Info    Type            Sym.Value  Sym. Name + Addend
00000014  00000201 R_68K_32          00000000   .text + 0
00000020  00000201 R_68K_32          00000000   .text + 0
00002b40  00000601 R_68K_32          00000000   .modinfo + 0
00002c48  00000601 R_68K_32          00000000   .modinfo + 78
00002c60  00000301 R_68K_32          00000000   .data + 14
00002c6c  00000301 R_68K_32          00000000   .data + 18
00002c78  00000301 R_68K_32          00000000   .data + 20
00002c84  00000201 R_68K_32          00000000   .text + 0
00002cd8  00000201 R_68K_32          00000000   .text + 32
00002d14  00000201 R_68K_32          00000000   .text + 3c
00002d2c  00000201 R_68K_32          00000000   .text + 3c
00002d74  00000201 R_68K_32          00000000   .text + 4e
00002d8c  00000201 R_68K_32          00000000   .text + 4e
00002e40  00000201 R_68K_32          00000000   .text + 70
00002eac  00000201 R_68K_32          00000000   .text + 94
00002f48  00000201 R_68K_32          00000000   .text + be
00003044  00000201 R_68K_32          00000000   .text + ce
0000308c  00000201 R_68K_32          00000000   .text + de
000030ec  00000201 R_68K_32          00000000   .text + ea
0000311c  00000201 R_68K_32          00000000   .text + fc
00003134  00000201 R_68K_32          00000000   .text + fe
00003158  00000201 R_68K_32          00000000   .text + 10a
00003170  00000201 R_68K_32          00000000   .text + 10a
00003188  00000201 R_68K_32          00000000   .text + 10e
000031ac  00000201 R_68K_32          00000000   .text + 10e
000032e4  00000201 R_68K_32          00000000   .text + 136
000033f8  00000201 R_68K_32          00000000   .text + 174
00003434  00000201 R_68K_32          00000000   .text + 186
0000347c  00000201 R_68K_32          00000000   .text + 1a0
00003524  00000201 R_68K_32          00000000   .text + 1b4
000035b4  00000201 R_68K_32          00000000   .text + 1ea
00003620  00000201 R_68K_32          00000000   .text + 21e
0000365c  00000201 R_68K_32          00000000   .text + 236
000036c8  00000201 R_68K_32          00000000   .text + 26a
00003968  00000201 R_68K_32          00000000   .text + 32a
00003998  00000201 R_68K_32          00000000   .text + 344
000039c8  00000201 R_68K_32          00000000   .text + 350
00003a28  00000201 R_68K_32          00000000   .text + 356
00003a94  00002e01 R_68K_32          0000037a   HorlogeCheck + 0
00003ac4  00000401 R_68K_32          00000000   .bss + 0
00003ad0  00000201 R_68K_32          00000000   .text + 382

Output of m68k-elf-readelf -s horloge.o:
Symbol table '.symtab' contains 47 entries:
..
  12: 00000136    62 FUNC    LOCAL  DEFAULT    1 horloge_read
..
  46: 0000037a     8 FUNC    GLOBAL DEFAULT    1 HorlogeCheck


More details from maint print commands.

from the output of maint print symbols symbols.txt

    int horloge_read(struct file *, char *, size_t, loff_t *); block object
0x83a54f0, 0x790060..0x79009e section .text

     block #006, object at 0x83a54f0 under 0x83bdc54, 8 syms/buckets in
0x790060..0x79009e, function horloge_read, compiled with gcc2

from the output of maint print psymbols psymbols.txt
        `horloge_read', function, 0x790196

from the output of maint print msymbols msymbols.txt
    [ 9] t 0x790196 horloge_read section .text


gdb302bdi> x/i 0x791196
0x791196 <horloge_read at horloge.c:503>:       linkw %fp,#0

   Remark: the line number 503 is wrong as well !

gdb302bdi> x/i horloge_read
0x791060 <exit_horloge at horloge.c:589>:       linkw %fp,#0



>--
>Daniel Jacobowitz
>CodeSourcery



  reply	other threads:[~2006-04-11 13:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-11 13:33 Jean-Rene Peulve
2006-04-11 13:38 ` Daniel Jacobowitz
2006-04-11 13:45   ` Jean-Rene Peulve [this message]
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.20060411152707.00acc440@pop.wanadoo.fr \
    --to=jr.peulve@wanadoo.fr \
    --cc=drow@false.org \
    --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