This is the mail archive of the
mailing list for the GDB project.
Re: [RFA/solib-svr4] use AT_BASE auxiliary entry to compute load base address
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: brobecker at adacore dot com (Joel Brobecker)
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 17 Apr 2008 17:11:38 +0200 (CEST)
- Subject: Re: [RFA/solib-svr4] use AT_BASE auxiliary entry to compute load base address
Joel Brobecker wrote:
> 2007-09-12 Joel Brobecker <email@example.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.
> Tested on x86-linux, no regression. Currently testing on sparc-solaris,
> but it's taking a loooong time because sigstep is keeps timing out to
> death. It fixes the issue above, and I'm confident the results will be OK.
It looks like this breaks remote debugging in the presence of prelinking.
The problem is that AT_BASE is set by the kernel to the load bias (i.e.
the difference between the actual load address and the load address as
recorded in the ELF file) of the dynamic interpreter. GDB goes on to
add back the load address from the ELF file, so that looks fine.
However, when doing remote debugging, the ELF file GDB sees may be
different from the ELF file that was used on the remote target. This
happens in particular if a background prelinking job runs from time
to time on the remote system.
GDB used to work correctly in the presence of prelinking anyway,
because for regular shared libraries it detected that mismatch by
comparing the load addresses from the BFD it reads with those
recorded in the dynamic loader's data structures (LM_ADDR_CHECK),
and adjusting its expectations if it detects prelinking.
However, this does not work for enable_break because this function
must work *before* the dynamic loader gets a chance to set up those
Any suggestions how this could be fixed?
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE