This is the mail archive of the
mailing list for the GDB project.
Re: how to make gdb happy with my linkmap
- From: "Mathieu Lacage" <mathieu dot lacage at gmail dot com>
- To: gdb at sourceware dot org
- Date: Mon, 5 Jan 2009 15:58:39 +0100
- Subject: Re: how to make gdb happy with my linkmap
- References: <firstname.lastname@example.org> <20081218214854.GA7706@caradoc.them.org> <email@example.com> <20081218221005.GA9012@caradoc.them.org> <firstname.lastname@example.org> <20081226125329.GA12783@caradoc.them.org>
> Does it work any better with ld.so? I doubt it - GDB doesn't do
It does not seem to work any better with ld-linux.so.2. I tried to
look into this a bit more but I did not make much progress. Here is
what I get:
mathieu@mathieu-boulot:~/code/elf-loader$ gdb ./ldso
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) b stage1
Breakpoint 1 at 0x944: file ldso.c, line 304.
(gdb) r ./hello
Starting program: /home/mathieu/code/elf-loader/ldso ./hello
Program exited normally.
What I find weird is:
1) mathieu@mathieu-boulot:~/code/elf-loader$ readelf -s ./ldso |grep stage1
225: 00000932 135 FUNC GLOBAL HIDDEN 6 stage1
mathieu@mathieu-boulot:~/code/elf-loader$ readelf -l ./ldso
Elf file type is DYN (Shared object file)
Entry point 0x932
There are 6 program headers, starting at offset 52
i.e., stage1 is located at offset 0x932, and not 0x944 so, I can't
figure out where the 0x944 displayed by gdb is coming from. I also
find it surprising that gdb is actually trying to set a breakpoint at
address 0x944: this is a pie binary so, gdb should know that the
address will be known only once the program is run....
To summarize, 2 questions:
1) what do I need to do to make gdb _not_ attempt to really set the
breakpoint before the program is run ?
2) why is gdb using 0x944 and not 0x932 ?
I am shooting a bit in the dark here, obviously.
Mathieu Lacage <email@example.com>