This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/solib-svr4] use AT_BASE auxiliary entry to compute load base address
- From: Daniel Jacobowitz <drow at false dot org>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 16 Sep 2007 15:35:58 -0400
- Subject: Re: [RFA/solib-svr4] use AT_BASE auxiliary entry to compute load base address
- References: <20070912211805.GF10540@adacore.com>
On Wed, Sep 12, 2007 at 02:18:05PM -0700, Joel Brobecker wrote:
> Hello,
>
> I came across an unexpected issue on sparc-solaris 2.9, where I tried
> to attach to an Ada program. When I later did a "continue", the debugger
> error'ed out saying:
>
> (gdb) c
> Continuing.
> Warning:
> Cannot insert breakpoint -1.
> Error accessing memory address 0xff36159c: I/O error.
So, it has attached to the program and decided that it's at the start
address. That means we tried this:
/* On a running target, we can get the dynamic linker's base
address from the shared library table. */
solib_add (NULL, 0, ¤t_target, auto_solib_add);
so = master_so_list ();
while (so)
...
and did not find any loaded libraries or else did not find the
interpreter in the list. That's strange and almost certainly
indicates a bug that we should fix. The loader should have
been in the list at that point. Maybe it has a different
filename in the list than in .interp?
If you have time, I would recommend looking into this more.
> I think that the problem is that we're computing the wrong base load
> address in solib-svr4.c. As it turned out, there was a "TODO" hint
> added by Daniel that suggested using the AT_BASE auxiliary entry.
> The attached patch attempts to do that.
>
> 2007-09-12 Joel Brobecker <brobecker@adacore.com>
>
> * solib-svr4.c: Add include of "auxv.h".
> (enable_break): Use the AT_BASE auxiliary entry if available.
> * Makefile.in (solib-svr4.o): Update dependencies.
This patch, independently, is a good idea and I'm glad you did it.
It's OK.
--
Daniel Jacobowitz
CodeSourcery