This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB support for thread-local storage


Daniel Jacobowitz <drow@mvista.com> writes:
> On Fri, Jun 21, 2002 at 01:18:29PM -0400, Andrew Cagney wrote:
> > >>BTW, what happens if the target doesn't have execution (i.e. a corefile).
> > >
> > >We fall down, just like we do debugging thread_db capable corefiles,
> > >I'd imagine.  Thread_db does not like read-only targets very much.
> > 
> > GDB on a threaded GNU/Linux target, again falls down, sigh!  We can 
> > hopefully have it working on other platforms.
> 
> I beg your pardon?  This is a thread_db limitation, not a GNU/Linux
> limitation.  GNU/Linux copied the interface from Solaris and I believe
> we use it on Solaris.  The effect there will be even more extreme than
> on GNU/Linux.  <check> Yes, we do use it on Solaris.
> 
> If threaded corefiles work on Solaris I doubt it's by merit of
> thread_db.

We can debug multi-threaded core files on Linux; see below.  I must be
missing the point.  But this works because the core file reader
actually goes and constructs the thread list itself.  We're not using
thread_db to handle that.  Which is sort of a bug --- what you see
when you run GDB on such a core file are LWP's, not threads.

Why aren't we using thread_db, though?  Why can't we run thread_db and
simply serve its memory and register requests from the core file?  I
don't see which part of the interface makes this impossible.  And
we'll need to do it if Linux switches to an NxM thread model, no?


$ ps xf
  PID TTY      STAT   TIME COMMAND
...
 9415 pts/1    S      0:00 -bash
...
28675 pts/1    S      0:00  \_ ./linux-dp
28676 pts/1    S      0:00      \_ ./linux-dp
28677 pts/1    S      0:00          \_ ./linux-dp
28678 pts/1    S      0:00          \_ ./linux-dp
28679 pts/1    S      0:00          \_ ./linux-dp
28680 pts/1    S      0:00          \_ ./linux-dp
28681 pts/1    S      0:00          \_ ./linux-dp
...
$ gdb -nw linux-dp
GNU gdb 2002-06-13-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) attach 28675
Attaching to program: /rigel/jimb/cygnus/pentium3/sourceware/gdb/main/native/build/gdb/testsuite/gdb.threads/linux-dp, process 28675
Reading symbols from /lib/i686/libpthread.so.0...done.
[New Thread 1024 (LWP 28675)]
[New Thread 2049 (LWP 28676)]
[New Thread 1026 (LWP 28677)]
[New Thread 2051 (LWP 28678)]
[New Thread 3076 (LWP 28679)]
[New Thread 4101 (LWP 28680)]
[New Thread 5126 (LWP 28681)]
Loaded symbols for /lib/i686/libpthread.so.0
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0x4011a5a1 in __libc_nanosleep () at __libc_nanosleep:-1
-1      __libc_nanosleep: No such file or directory.
        in __libc_nanosleep
(gdb) gcore linux-dp.core
Saved corefile linux-dp.core
(gdb) The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /rigel/jimb/cygnus/pentium3/sourceware/gdb/main/native/build/gdb/testsuite/gdb.threads/linux-dp, process 28675
$ readelf -n linux-dp.core

Notes at offset 0x00000354 with length 0x000016dc:
  Owner         Data size       Description
  CORE          0x0000007c      NT_PRPSINFO (prpsinfo structure)
  CORE          0x00000090      NT_PRSTATUS (prstatus structure)
  CORE          0x0000006c      NT_FPREGSET (floating point registers)
  LINUX         0x00000200      NT_PRXFPREG (user_xfpregs structure)
  CORE          0x00000090      NT_PRSTATUS (prstatus structure)
  CORE          0x0000006c      NT_FPREGSET (floating point registers)
  LINUX         0x00000200      NT_PRXFPREG (user_xfpregs structure)
  CORE          0x00000090      NT_PRSTATUS (prstatus structure)
  CORE          0x0000006c      NT_FPREGSET (floating point registers)
  LINUX         0x00000200      NT_PRXFPREG (user_xfpregs structure)
  CORE          0x00000090      NT_PRSTATUS (prstatus structure)
  CORE          0x0000006c      NT_FPREGSET (floating point registers)
  LINUX         0x00000200      NT_PRXFPREG (user_xfpregs structure)
  CORE          0x00000090      NT_PRSTATUS (prstatus structure)
  CORE          0x0000006c      NT_FPREGSET (floating point registers)
  LINUX         0x00000200      NT_PRXFPREG (user_xfpregs structure)
  CORE          0x00000090      NT_PRSTATUS (prstatus structure)
  CORE          0x0000006c      NT_FPREGSET (floating point registers)
  LINUX         0x00000200      NT_PRXFPREG (user_xfpregs structure)
  CORE          0x00000090      NT_PRSTATUS (prstatus structure)
  CORE          0x0000006c      NT_FPREGSET (floating point registers)
  LINUX         0x00000200      NT_PRXFPREG (user_xfpregs structure)
$ gdb -nw linux-dp
GNU gdb 2002-06-13-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) core linux-dp.core
warning: core file may not match specified executable file.
Core was generated by `/rigel/jimb/cygnus/pentium3/sourceware/gdb/main/native/build/gdb/testsuite/gdb.t'.
Program terminated with signal 17, Child status changed.
Reading symbols from /lib/i686/libpthread.so.0...done.
Loaded symbols for /lib/i686/libpthread.so.0
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x40146afe in __select () at __select:-1
-1      __select: No such file or directory.
        in __select
(gdb) info thread
  7 process 67137539  0x4011a5a1 in __libc_nanosleep () at __libc_nanosleep:-1
  6 process 134311939  0x401453e7 in __poll (fds=0x804bddc, nfds=1, 
    timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63
  5 process 67268611  0x4008dba5 in __sigsuspend (set=0x4039a98c)
    at ../sysdeps/unix/sysv/linux/sigsuspend.c:45
  4 process 134443011  0x40146afe in __select () at __select:-1
  3 process 201617411  0x4008dba5 in __sigsuspend (set=0x4079a98c)
    at ../sysdeps/unix/sysv/linux/sigsuspend.c:45
  2 process 268791811  0x40146afe in __select () at __select:-1
* 1 process 335966211  0x40146afe in __select () at __select:-1
(gdb) 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]