* [RFA] struct lwp in bsd-kvm.c
@ 2004-08-06 20:42 Nathan J. Williams
2004-08-06 21:07 ` Mark Kettenis
0 siblings, 1 reply; 5+ messages in thread
From: Nathan J. Williams @ 2004-08-06 20:42 UTC (permalink / raw)
To: gdb-patches
Modern NetBSD (-current and 2.0 and later) have a struct lwp that
holds execution state, including the pcb. This patch adds an autoconf
test to check for the presence of struct lwp, and changes the "kvm
proc" command to add the offset of l_addr in struct lwp to the address
supplied, if they are found. This makes the command name slightly
misleading, but it doesn't seem worth renaming.
This is necessary to even compile bsd-kvm.c on modern NetBSD systems,
as struct proc no longer has a p_addr field.
OK to commit?
(I'm not clear what the protocol is for dealing with regenerating
configure and config.in)
- Nathan
2004-08-06 Nathan J. Williams <nathanw@wasabisystems.com>
* configure.in: Test for struct lwp in <sys/lwp.h>
* bsd-kvm.c (bsd_kvm_proc_cmd): If HAVE_STRUCT_LWP is defined, use
the offset of l_addr in struct lwp.
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.160
diff -u -r1.160 configure.in
--- configure.in 30 Jul 2004 14:30:08 -0000 1.160
+++ configure.in 6 Aug 2004 20:34:30 -0000
@@ -553,6 +553,16 @@
[Define to 1 if your system has td_pcb in struct thread.])
fi
+# See if <sys/lwp.h> defines `struct lwp`.
+AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
+[AC_TRY_COMPILE([#include <sys/param.h>
+#include <sys/lwp.h>], [struct lwp l;],
+gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
+if test $gdb_cv_struct_lwp = yes; then
+ AC_DEFINE(HAVE_STRUCT_LWP, 1,
+ [Define to 1 if your system has struct lwp.])
+fi
+
# See if <machine/reg.h> degines `struct reg'.
AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
[AC_TRY_COMPILE([#include <sys/types.h>
Index: bsd-kvm.c
===================================================================
RCS file: /cvs/src/src/gdb/bsd-kvm.c,v
retrieving revision 1.4
diff -u -r1.4 bsd-kvm.c
--- bsd-kvm.c 3 Jul 2004 13:17:33 -0000 1.4
+++ bsd-kvm.c 6 Aug 2004 20:34:30 -0000
@@ -228,7 +229,11 @@
error ("No kernel memory image.");
addr = parse_and_eval_address (arg);
+#ifdef HAVE_STRUCT_LWP
+ addr += offsetof (struct lwp, l_addr);
+#else
addr += offsetof (struct proc, p_addr);
+#endif
if (kvm_read (core_kd, addr, &bsd_kvm_paddr, sizeof bsd_kvm_paddr) == -1)
error ("%s", kvm_geterr (core_kd));
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] struct lwp in bsd-kvm.c
2004-08-06 20:42 [RFA] struct lwp in bsd-kvm.c Nathan J. Williams
@ 2004-08-06 21:07 ` Mark Kettenis
2004-08-08 16:58 ` Jason Thorpe
0 siblings, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2004-08-06 21:07 UTC (permalink / raw)
To: nathanw; +Cc: gdb-patches
From: "Nathan J. Williams" <nathanw@wasabisystems.com>
Date: 06 Aug 2004 16:42:42 -0400
2004-08-06 Nathan J. Williams <nathanw@wasabisystems.com>
* configure.in: Test for struct lwp in <sys/lwp.h>
* bsd-kvm.c (bsd_kvm_proc_cmd): If HAVE_STRUCT_LWP is defined, use
the offset of l_addr in struct lwp.
OK to commit?
(I'm not clear what the protocol is for dealing with regenerating
configure and config.in)
Thanks, yes, except that configure and config.in need to be
regenerated; with a special version of autoconf :-(.
You should be able to get the right version from
ftp://sources.redhat.com/pub/binutils
but if you drop me a mail when you've checked things in, I'll
regenerate the files for you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] struct lwp in bsd-kvm.c
2004-08-06 21:07 ` Mark Kettenis
@ 2004-08-08 16:58 ` Jason Thorpe
2004-08-08 18:11 ` Daniel Jacobowitz
2004-08-08 19:41 ` Andrew Cagney
0 siblings, 2 replies; 5+ messages in thread
From: Jason Thorpe @ 2004-08-08 16:58 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
On Aug 6, 2004, at 2:07 PM, Mark Kettenis wrote:
> Thanks, yes, except that configure and config.in need to be
> regenerated; with a special version of autoconf :-(.
[Maybe a bit off-topic, but...]
Can someone explain to me why "special" versions of the autotools are
used?
-- Jason R. Thorpe <thorpej@wasabisystems.com>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] struct lwp in bsd-kvm.c
2004-08-08 16:58 ` Jason Thorpe
@ 2004-08-08 18:11 ` Daniel Jacobowitz
2004-08-08 19:41 ` Andrew Cagney
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-08-08 18:11 UTC (permalink / raw)
To: Jason Thorpe; +Cc: Mark Kettenis, gdb-patches
On Sun, Aug 08, 2004 at 09:58:11AM -0700, Jason Thorpe wrote:
>
> On Aug 6, 2004, at 2:07 PM, Mark Kettenis wrote:
>
> >Thanks, yes, except that configure and config.in need to be
> >regenerated; with a special version of autoconf :-(.
>
> [Maybe a bit off-topic, but...]
>
> Can someone explain to me why "special" versions of the autotools are
> used?
Hysterical raisins only; Nathaniel is in the process of fixing this at
last.
--
Daniel Jacobowitz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] struct lwp in bsd-kvm.c
2004-08-08 16:58 ` Jason Thorpe
2004-08-08 18:11 ` Daniel Jacobowitz
@ 2004-08-08 19:41 ` Andrew Cagney
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2004-08-08 19:41 UTC (permalink / raw)
To: Jason Thorpe; +Cc: Mark Kettenis, gdb-patches
>
> On Aug 6, 2004, at 2:07 PM, Mark Kettenis wrote:
>
>> Thanks, yes, except that configure and config.in need to be
>> regenerated; with a special version of autoconf :-(.
>
>
> [Maybe a bit off-topic, but...]
>
> Can someone explain to me why "special" versions of the autotools are used?
There was a bug in one of the autotools that prevented something in src/
correctly configuring. To work around the problem, the binutils
autotoolset was created. GDB, to ensure consistency, uses those tools.
As with many things, it then entered folk law, with the exact
rationale for the mini-fork lost.
Fortunatly, people are now pushing through a switch to 2.5x.
How's that for a non-answer :-)
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-08-08 19:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-06 20:42 [RFA] struct lwp in bsd-kvm.c Nathan J. Williams
2004-08-06 21:07 ` Mark Kettenis
2004-08-08 16:58 ` Jason Thorpe
2004-08-08 18:11 ` Daniel Jacobowitz
2004-08-08 19:41 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox