[RFA/solib-svr4] use AT_BASE auxiliary entry to compute load base address

Ulrich Weigand uweigand@de.ibm.com
Thu Apr 17 15:29:00 GMT 2008


Joel Brobecker wrote:

> 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.
> 
> 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
data structures.

Any suggestions how this could be fixed?

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com



More information about the Gdb-patches mailing list