This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Handle absence of DT_DEBUG while debugging ld.so
- From: Daniel Jacobowitz <drow at false dot org>
- To: Luis Machado <luisgpm at linux dot vnet dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 28 Jul 2008 22:27:23 -0400
- Subject: Re: [PATCH] Handle absence of DT_DEBUG while debugging ld.so
- References: <1217289278.16935.23.camel@gargoyle>
On Mon, Jul 28, 2008 at 08:54:37PM -0300, Luis Machado wrote:
> Hi folks,
>
> When trying to debug ld.so, we may find that the DT_DEBUG entry in
> the .dynamic section is missing, thus GDB tries to look for the _r_debug
> minimal symbol, and eventually finds it. This works OK as long as the
> _r_debug minimal symbol is correct and initialized.
>
> In the case where GDB fetches an uninitialized _r_debug minimal symbol
> and tries to access its address, we have a memory access error, just
> like below:
>
> (gdb) r
> Starting program: /foo/lib/ld.so.1
> Cannot access memory at address 0x2f648
>
> Thus, we should guard this piece of code against uninitialized addresses
> so that GDB can skip this entry and look for another (hopefully) valid
> _r_debug symbol.
I think this is a PIE-related problem. It has nothing to do with
uninitialized, because we're just taking the symbol's
address; but the address you've got there looks wrong. It's as if
ld.so was loaded at 0x0. How did that happen?
--
Daniel Jacobowitz
CodeSourcery