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]

[RFHelp] Linux, threads, and regsets in thread_db


I spent a while this summer making thread debugging work on some more
non-x86 targets, with great frustration.  Eventually I reached the
decision that my problem was in fact a glibc bug; the attached messages
explain it.  Ulrich has categorically (and without explanation, when
asked.  sigh.) refused the patch.

Could someone on this list at least sanity check my patch?  I have a
(disgusting) workaround for GDB if the header is not changed, but I'd
much rather someone convince Ulrich that I'm not crazy.  Especially
since I can not get the workaround to compile without warnings.  C
behaves badly in the presence of casts to/from array types.


----- Forwarded message from Daniel Jacobowitz <dmj+@andrew.cmu.edu> -----

Date: Mon, 18 Jun 2001 12:06:08 -0700
From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
Subject: gregset vs prgregset vs elf_gregset in thread_db
To: libc-alpha@sources.redhat.com
Mail-Followup-To: libc-alpha@sources.redhat.com

The thread-db routines are defined to take arguments of type 'prgregset_t'. 
On about half the supported architectures, prgregset_t is typedef'd to be
'gregset_t'; on the other half it is 'elf_gregset_t'.  I don't know where
the gregset_t definitions came from, especially on platforms that have
always been ELF, but they are substantially less useful than their elf
counterparts - what we really want to fill in is the data we can get from
ptrace, and pt_regs is usually fairly similar to an elf_gregset_t and an
elf_fpregset_t.

For instance, on PowerPC the NIP is not in any of r0 - r31, and a gregset_t
only has 32 elements.  No way to convey the thread's NIP, which makes
debugging all but meaningless.

The only consumer of the prgregset_t and prfpregset_t types is thread-db. 
Is there any objection to changing them to the elf_* variants, and possibly
bumping the thread-db soname?  Although I'm not sure the latter is even
necessary; gdb is the only consumer of thread-db I've ever found on linux,
and it doesn't work with threads on the architectures affected yet anyway.

-- 
Daniel Jacobowitz                           Debian GNU/Linux Developer
Monta Vista Software                              Debian Security Team


----- End forwarded message -----
----- Forwarded message from Daniel Jacobowitz <dmj+@andrew.cmu.edu> -----

Date: Tue, 26 Jun 2001 22:53:23 -0700
From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
Subject: Re: gregset vs prgregset vs elf_gregset in thread_db
To: Geoff Keating <geoffk@redhat.com>
Cc: libc-alpha@sources.redhat.com
Mail-Followup-To: Geoff Keating <geoffk@redhat.com>,
	libc-alpha@sources.redhat.com

On Tue, Jun 26, 2001 at 09:59:32AM -0700, Geoff Keating wrote:
> > Date: Mon, 25 Jun 2001 22:15:37 -0700
> > From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
> 
> > On Mon, Jun 25, 2001 at 10:25:48PM -0700, Geoff Keating wrote:
> > > I don't believe anything other than gdb uses these structures.  They
> > > don't reflect anything that the kernel produces, do they?
> > 
> > That's right.  They're solely an interface for debuggers, and I do not
> > know of any Linux debugger other than gdb which uses them, so I figure
> > changing them to be more convenient to gdb would be a reasonable thing.
> 
> That's what I'd thought.  In that case, they can be changed in any way
> that gdb finds convenient.

In that case, is this patch OK?

2001-06-26  Daniel Jacobowitz  <dan@debian.org>
	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Change prgregset_t
	and prfpregset_t to match their elf counterparts.
	* sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/procfs.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/procfs.h: Likewise.

Index: sysdeps/unix/sysv/linux/alpha/sys/procfs.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/sys/procfs.h,v
retrieving revision 1.7
diff -u -r1.7 procfs.h
--- procfs.h	1999/11/18 00:11:49	1.7
+++ procfs.h	2001/06/27 05:48:39
@@ -99,8 +99,8 @@
 typedef void *psaddr_t;
 
 /* Register sets.  Linux has different names.  */
-typedef gregset_t prgregset_t;
-typedef fpregset_t prfpregset_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
 
 /* We don't have any differences between processes and threads,
    therefore habe only ine PID type.  */
Index: sysdeps/unix/sysv/linux/ia64/sys/procfs.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/ia64/sys/procfs.h,v
retrieving revision 1.1
diff -u -r1.1 procfs.h
--- procfs.h	2000/06/20 03:34:47	1.1
+++ procfs.h	2001/06/27 05:48:40
@@ -104,8 +104,8 @@
 typedef void *psaddr_t;
 
 /* Register sets.  Linux has different names.  */
-typedef gregset_t prgregset_t;
-typedef fpregset_t prfpregset_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
 
 /* We don't have any differences between processes and threads,
    therefore habe only ine PID type.  */
Index: sysdeps/unix/sysv/linux/mips/sys/procfs.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sys/procfs.h,v
retrieving revision 1.6
diff -u -r1.6 procfs.h
--- procfs.h	2000/01/10 14:27:50	1.6
+++ procfs.h	2001/06/27 05:48:40
@@ -101,8 +101,8 @@
 typedef void *psaddr_t;
 
 /* Register sets.  Linux has different names.  */
-typedef gregset_t prgregset_t;
-typedef fpregset_t prfpregset_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
 
 /* We don't have any differences between processes and threads,
    therefore habe only ine PID type.  */
Index: sysdeps/unix/sysv/linux/sys/procfs.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sys/procfs.h,v
retrieving revision 1.11
diff -u -r1.11 procfs.h
--- procfs.h	1999/11/15 07:59:41	1.11
+++ procfs.h	2001/06/27 05:48:40
@@ -99,8 +99,8 @@
 typedef void *psaddr_t;
 
 /* Register sets.  Linux has different names.  */
-typedef gregset_t prgregset_t;
-typedef fpregset_t prfpregset_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
 
 /* We don't have any differences between processes and threads,
    therefore habe only ine PID type.  */


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


----- End forwarded message -----
----- Forwarded message from Ulrich Drepper <drepper@redhat.com> -----

Date: 14 Sep 2001 19:56:47 -0700
From: Ulrich Drepper <drepper@redhat.com>
Subject: Re: gregset vs prgregset vs elf_gregset in thread_db
To: Daniel Jacobowitz <drow@mvista.com>
Cc: Geoff Keating <geoffk@redhat.com>, libc-alpha@sources.redhat.com
Reply-To: drepper@cygnus.com (Ulrich Drepper)

Daniel Jacobowitz <drow@mvista.com> writes:

> I posted this patch three months ago and no one objected; could it
> please be applied?

There is absolutely no reason to apply this.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


----- End forwarded message -----

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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