This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: tcbhead_t gdb access for nonthreaded, gdb for longjmp()
Hi Daniel,
On Sun, 10 Sep 2006 16:27:24 +0200, Daniel Jacobowitz wrote:
> On Fri, Sep 08, 2006 at 12:22:35PM +0200, Jan Kratochvil wrote:
> > glibc part:
> >
> > * Provide some access to the `tcbhead_t.pointer_guard' field for gdb.
> > Currently implemented by `td_thr_getxregs' providing only `pointer_guard'.
> > New non-Solaris `td_thr_*' function could be provided instead.
> >
> > * All the `libthread_db' functions accessing inferior's `_thread_db*' symbols
> > of `libpthread' fallback to the new `_local_db*' symbols in `libthread_db'
> > itself. `libthread_db'<=>`libpthread' versions must match anyway.
> > I admit I do not know how may `libthread_db' and `libpthread' as there is
> > already required in `td_ta_new' their versions match. Anyway it should be
> > enough for 99% of cases - as the fallback option.
>
> Your new libthread_db will accept any version of glibc, even one which
> does not match - that seems like a good way to get in a lot of trouble.
Is it fine to make `__libc_version' public?
`libthread_db' would check for it if running in `TD_MINIMALONLY' mode.
> I wonder if we really need to use libthread_db here anyway.
Besides longjmp() target PTR_DEMANGLE()ing there is also need to access glibc
TLS symbol `errno' but - in fact - AFAIK no other TLS symbol.
One may say there is no TLS `errno' for nonthreaded programs as they use only
(*__errno_location ())
But from the user perspective I consider not acceptable to say something like
No symbol "errno" in current context.
Also one cannot expect everyone will compile everything with bloated -ggdb3 to
automatically expand `errno' to `(*__errno_location ())'.
I see multiple solutions (maybe first one enough?).
* Hardcoding `#define errno (*__errno_location ())' into gdb.
* Providing full custom TLS resolving for gdb - no glibc change needed.
* Extending current glibc libthread_db for non-threaded inferiors.
(the patch sent before <20060908102235.GA31335@host0.dyn.jankratochvil.net>)
* Merging the basic libpthread part for TLS resolving into glibc core
as nonthreaded glibc is using the TLS support for threading anyway.
* Merging the whole libpthread to glibc, making libpthread just a stub,
forgetting there ever existed nonthreaded programs before,
the same way UP (vs. SMP) was forgotten.
...
> a function in glibc which we could call that would return the target
> of a jmp_buf. Then GDB wouldn't have to know how PTR_MANGLE worked.
Nice idea.
Regards,
Jan