From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7879 invoked by alias); 26 Jul 2003 23:32:04 -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 7870 invoked from network); 26 Jul 2003 23:32:01 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 26 Jul 2003 23:32:01 -0000 Received: from drow by nevyn.them.org with local (Exim 4.20 #1 (Debian)) id 19gYW9-0003dN-EV; Sat, 26 Jul 2003 19:32:01 -0400 Date: Sat, 26 Jul 2003 23:32:00 -0000 From: Daniel Jacobowitz To: Elena Zannoni Cc: gdb@sources.redhat.com Subject: Re: RFC: A mode in which gdb avoids libthread_db Message-ID: <20030726233201.GA13936@nevyn.them.org> Mail-Followup-To: Elena Zannoni , gdb@sources.redhat.com References: <20030726155820.GA1063@nevyn.them.org> <16163.4264.817155.564263@localhost.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16163.4264.817155.564263@localhost.redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-07/txt/msg00315.txt.bz2 On Sat, Jul 26, 2003 at 07:37:12PM -0400, Elena Zannoni wrote: > Daniel Jacobowitz writes: > > Recent Linux kernels (2.5.30 and later; theoretically the latest Red Hat > > 2.4.20 kernels also include it, but I observed some badness in testing...) > > support some ptrace extensions I designed which make it possible to debug > > multi-threaded applications without using libthread_db at all. The only > > things we'll lose are: > > - Potential high-level information, like mutex status - right now we > > don't have this at all on GNU/Linux. > > - TLS access - this could be easily fixed by handling each platform's > > TLS ABI directly from GDB, and there's a comment to that effect in > > GDB's source already. > > - TIDs - we'd only have the application's LWP IDs, not the thread IDs > > that LinuxThreads/NPTL use. > > > > Things we'll gain: > > - A lot of libthread_db-related bugs would go away. For instance, > > the kfail in print-threads.exp, which hits a breakpoint after > > LinuxThreads decides the thread has already exited. > > - ABI simplicity - this would solve the x86-64/i386 issue, and similar > > problems on MIPS. > > - Support for debugging clone-based 1-1 threading which doesn't use > > libpthread.so. > > > > Once the pending fork-debugging patch is accepted, most of the machinery > > we'd need to do it will be in place, too. Thoughts? Worthwhile? > > > I know first hand of the pains of mismatched glibcs, binutils, > kernels, gdbs. I wouldn't mind having this coexist with the use of > glibc, is that possible? Sure. It could just be a switch or a "set" flag - easy enough. > What ptrace changes did you do? (Elena needs to start reading > linux-kernel) Take a look at the support for "set follow-fork-mode", which I've posted a few times. I added: /* 0x4200-0x4300 are reserved for architecture-independent additions. */ #define PTRACE_GETEVENTMSG 0x4201 #define PTRACE_GETSIGINFO 0x4202 #define PTRACE_SETSIGINFO 0x4203 /* options set using PTRACE_SETOPTIONS */ #define PTRACE_O_TRACEFORK 0x00000002 #define PTRACE_O_TRACEVFORK 0x00000004 #define PTRACE_O_TRACECLONE 0x00000008 #define PTRACE_O_TRACEEXEC 0x00000010 #define PTRACE_O_TRACEVFORKDONE 0x00000020 #define PTRACE_O_TRACEEXIT 0x00000040 They allow a debugger to automatically detect processes as they're created, and better signal handling. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer