From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20073 invoked by alias); 19 Aug 2002 16:05:16 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 20066 invoked from network); 19 Aug 2002 16:05:15 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 19 Aug 2002 16:05:15 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17gp1i-0003rT-00; Mon, 19 Aug 2002 11:05:11 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17gp2G-0002Yh-00; Mon, 19 Aug 2002 12:05:44 -0400 Date: Mon, 19 Aug 2002 09:05:00 -0000 From: Daniel Jacobowitz To: Jim Blandy Cc: Andrew Cagney , Andrew Cagney , James Cownie , gdb@sources.redhat.com Subject: Re: GDB support for thread-local storage Message-ID: <20020819160544.GD7772@nevyn.them.org> Mail-Followup-To: Jim Blandy , Andrew Cagney , Andrew Cagney , James Cownie , gdb@sources.redhat.com References: <20020625154201.GB17370@branoic.them.org> <17MsdN-0Qe-00@etnus.com> <20020625155555.GA18083@branoic.them.org> <3D1897DA.90405@cygnus.com> <20020625170147.GB19950@branoic.them.org> <3D1A78E4.5060904@ges.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-SW-Source: 2002-08/txt/msg00212.txt.bz2 On Wed, Jun 26, 2002 at 11:56:58PM -0500, Jim Blandy wrote: > > Andrew Cagney writes: > > > Doesn't libthread_db read `struct _pthread_descr_struct' from the > > > linuxthreads library in the inferior, rather than knowing the layout > > > itself? So it's actually the inferior's linuxthreads library that > > > describes its own structures' layout. > > > > The structure layout will have been compiled into libthread-db.a. It > > implicitly knows the layout itself. > > I think you're wrong here. Could you show me the code? > > (Not that the question is especially relevant to the discussion --- of > course it could do a simple checksum check.) You're right, and you're wrong. For instance, td_ta_map_id2thr.c: #include struct pthread_handle_struct phc; if (ps_pdread (ta->ph, ta->handles + pt % pthread_threads_max, &phc, sizeof (struct pthread_handle_struct)) != PS_OK) if (phc.h_descr == NULL) etc. which references: struct pthread_handle_struct { struct _pthread_fastlock h_lock; /* Fast lock for sychronized access */ pthread_descr h_descr; /* Thread descriptor or NULL if invalid */ char * h_bottom; /* Lowest address in the stack thread */ }; Worse, it reads the _pthread_descr_struct from the inferior. _pthread_descr_struct does not describe the layout of anything; it's the actual descriptor. It has things like a sigjmp_buf in it. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer