From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10235 invoked by alias); 13 Sep 2006 13:05:43 -0000 Received: (qmail 10217 invoked by uid 22791); 13 Sep 2006 13:05:42 -0000 X-Spam-Check-By: sourceware.org Received: from 195.22.55.53.adsl.nextra.cz (HELO host0.dyn.jankratochvil.net) (195.22.55.53) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 13 Sep 2006 13:05:38 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.13.8/8.13.8) with ESMTP id k8DD5W6f022814; Wed, 13 Sep 2006 15:05:32 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.13.8/8.13.8/Submit) id k8DD5WHX022813; Wed, 13 Sep 2006 15:05:32 +0200 Date: Wed, 13 Sep 2006 13:05:00 -0000 From: Jan Kratochvil To: libc-alpha@sourceware.org, gdb@sourceware.org Subject: Re: tcbhead_t gdb access for nonthreaded, gdb for longjmp() Message-ID: <20060913130532.GA21977@host0.dyn.jankratochvil.net> References: <20060908102235.GA31335@host0.dyn.jankratochvil.net> <20060910142723.GA28131@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060910142723.GA28131@nevyn.them.org> User-Agent: Mutt/1.4.2.2i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00074.txt.bz2 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