This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: Ignore TLS symbols for non-TLS programs
On Thu, Aug 24, 2006 at 11:43:01PM -0400, Daniel Jacobowitz wrote:
> On Fri, Aug 25, 2006 at 04:13:11AM +0200, Jan Kratochvil wrote:
> > * with -ggdb2 and less "errno" in fact does not exist anywhere as it was
> > compiled to "(*__errno_location ())" and the macro definition is not present.
> > Unfortunately gdb will find the TLS symbol and it will try to access it but
> > as the program has been compiled without -lpthread the TLS base register
> > (%gs on i386) is not setup and it will result in:
> > Cannot access memory at address 0x8
>
> That can't be correct. Every program using glibc references errno.
> If the program can access it, then GDB ought to be able to also.
> In this case, libc.so.6 exports a dynamic TLS symbol named errno.
>
> Did you try this with the patch you posted earlier to access TLS
> without debug info?
Oh, I see now - that's not enough, you'd also need to implement direct
DTV lookup in GDB since libthread_db probably can't cope. And that
might require some fiddling with e.g. the remote protocol, too, to get
at the result of ps_get_thread_area. Anyway, this is doable, just
a bit of work.
With your other patch, I hope this would get a more appropriate error,
like "can't access thread local data"?
--
Daniel Jacobowitz
CodeSourcery