public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* RFC: A mode in which gdb avoids libthread_db
@ 2003-07-26 15:58 Daniel Jacobowitz
  2003-07-26 23:29 ` Elena Zannoni
  2003-07-28 20:53 ` Kevin Buettner
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-07-26 15:58 UTC (permalink / raw)
  To: gdb

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?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: A mode in which gdb avoids libthread_db
  2003-07-26 15:58 RFC: A mode in which gdb avoids libthread_db Daniel Jacobowitz
@ 2003-07-26 23:29 ` Elena Zannoni
  2003-07-26 23:32   ` Daniel Jacobowitz
  2003-07-28 20:53 ` Kevin Buettner
  1 sibling, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2003-07-26 23:29 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

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?

What ptrace changes did you do? (Elena needs to start reading
linux-kernel)

elena


 > 
 > -- 
 > Daniel Jacobowitz
 > MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: A mode in which gdb avoids libthread_db
  2003-07-26 23:29 ` Elena Zannoni
@ 2003-07-26 23:32   ` Daniel Jacobowitz
  2003-08-08  2:21     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-07-26 23:32 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: A mode in which gdb avoids libthread_db
  2003-07-26 15:58 RFC: A mode in which gdb avoids libthread_db Daniel Jacobowitz
  2003-07-26 23:29 ` Elena Zannoni
@ 2003-07-28 20:53 ` Kevin Buettner
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Buettner @ 2003-07-28 20:53 UTC (permalink / raw)
  To: Daniel Jacobowitz, gdb

On Jul 26, 11:58am, Daniel Jacobowitz wrote:

> 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?

As a settable mode, this definitely sounds worthwhile.

Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: A mode in which gdb avoids libthread_db
  2003-07-26 23:32   ` Daniel Jacobowitz
@ 2003-08-08  2:21     ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-08-08  2:21 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Elena Zannoni, gdb

> On Sat, Jul 26, 2003 at 07:37:12PM -0400, Elena Zannoni wrote:

>> 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.

Yes.  In this mode, just restrict libthread_db to, er, visualizing 
thread data structures such as the thread ID and, hopefully, eventually, 
semaphore state et.al.

>> 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:

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-08-08  2:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-26 15:58 RFC: A mode in which gdb avoids libthread_db Daniel Jacobowitz
2003-07-26 23:29 ` Elena Zannoni
2003-07-26 23:32   ` Daniel Jacobowitz
2003-08-08  2:21     ` Andrew Cagney
2003-07-28 20:53 ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).