Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Some regset-related cleanup for i386bsd-nat.c
@ 2004-05-31 10:01 Mark Kettenis
  2004-06-08 20:49 ` Nathan J. Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2004-05-31 10:01 UTC (permalink / raw)
  To: gdb-patches

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* i386bsd-nat.c: Don't include "gregset.h".
	(supply_gregset, fill_gregset): Make static.
	(supply_fpregset, fill_fpregset): Remove.
	* Makefile.in (i386bsd-nat.o): Update dependencies.

Index: i386bsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386bsd-nat.c,v
retrieving revision 1.27
diff -u -p -r1.27 i386bsd-nat.c
--- i386bsd-nat.c 15 May 2004 17:04:10 -0000 1.27
+++ i386bsd-nat.c 31 May 2004 09:59:38 -0000
@@ -43,8 +43,8 @@ typedef struct reg gregset_t;
 typedef struct fpreg fpregset_t;
 #endif
 
-#include "gregset.h"
 #include "i386-tdep.h"
+#include "i387-tdep.h"
 \f
 
 /* In older BSD versions we cannot get at some of the segment
@@ -120,7 +120,7 @@ cannot_fetch_register (int regnum)
 /* Fill GDB's register array with the general-purpose register values
    in *GREGSETP.  */
 
-void
+static void
 supply_gregset (gregset_t *gregsetp)
 {
   struct regcache *regcache = current_regcache;
@@ -139,7 +139,7 @@ supply_gregset (gregset_t *gregsetp)
    *GREGSETPS with the value in GDB's register array.  If REGNUM is -1,
    do this for all registers.  */
 
-void
+static void
 fill_gregset (gregset_t *gregsetp, int regnum)
 {
   struct regcache *regcache = current_regcache;
@@ -150,26 +150,7 @@ fill_gregset (gregset_t *gregsetp, int r
       regcache_raw_collect (regcache, i, REG_ADDR (gregsetp, i));
 }
 
-#include "i387-tdep.h"
-
-/* Fill GDB's register array with the floating-point register values
-   in *FPREGSETP.  */
 
-void
-supply_fpregset (fpregset_t *fpregsetp)
-{
-  i387_supply_fsave (current_regcache, -1, fpregsetp);
-}
-
-/* Fill register REGNUM (if it is a floating-point register) in
-   *FPREGSETP with the value in GDB's register array.  If REGNUM is
-   -1, do this for all registers.  */
-
-void
-fill_fpregset (fpregset_t *fpregsetp, int regnum)
-{
-  i387_collect_fsave (current_regcache, regnum, fpregsetp);
-}
 
 /* Fetch register REGNUM from the inferior.  If REGNUM is -1, do this
    for all registers (including the floating point registers).  */
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.582
diff -u -p -r1.582 Makefile.in
--- Makefile.in 30 May 2004 18:29:10 -0000 1.582
+++ Makefile.in 31 May 2004 09:59:41 -0000
@@ -1855,7 +1855,7 @@ hpread.o: hpread.c $(defs_h) $(bfd_h) $(
 hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
 	$(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h)
 i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
-	$(gdb_assert_h) $(gregset_h) $(i386_tdep_h) $(i387_tdep_h)
+	$(gdb_assert_h) $(i386_tdep_h) $(i387_tdep_h)
 i386bsd-tdep.o: i386bsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
 	$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) $(i386_tdep_h)
 i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \


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

* Re: [PATCH] Some regset-related cleanup for i386bsd-nat.c
  2004-05-31 10:01 [PATCH] Some regset-related cleanup for i386bsd-nat.c Mark Kettenis
@ 2004-06-08 20:49 ` Nathan J. Williams
  2004-06-08 23:38   ` Mark Kettenis
  2004-06-09 16:20   ` Andrew Cagney
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan J. Williams @ 2004-06-08 20:49 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Mark Kettenis <kettenis@chello.nl> writes:

> 	* i386bsd-nat.c: Don't include "gregset.h".
> 	(supply_gregset, fill_gregset): Make static.
> 	(supply_fpregset, fill_fpregset): Remove.

I just noticed this in one of my builds. I'm attempting to modernize
and prepare my NetBSD thread support code for integration, and that
code uses the {supply,fill}_{regset,fpregset} functions to implement
the thread-specific fetch_registers and store_registers, based on
register context passed back from the pthread debugging library (It
was quite a boon when I ported it forward from 5.0 to 5.3 and got
these functions to use). If these are removed, is there a good way for
an architecture-neutral bit of code like nbsd-thread.c to go back and
forth between GDB's register storage and native register storage?

        - Nathan


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

* Re: [PATCH] Some regset-related cleanup for i386bsd-nat.c
  2004-06-08 20:49 ` Nathan J. Williams
@ 2004-06-08 23:38   ` Mark Kettenis
  2004-06-09 16:20   ` Andrew Cagney
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Kettenis @ 2004-06-08 23:38 UTC (permalink / raw)
  To: nathanw, jimb; +Cc: gdb-patches

   From: "Nathan J. Williams" <nathanw@wasabisystems.com>
   Date: 08 Jun 2004 16:49:15 -0400

   Mark Kettenis <kettenis@chello.nl> writes:

   > 	* i386bsd-nat.c: Don't include "gregset.h".
   > 	(supply_gregset, fill_gregset): Make static.
   > 	(supply_fpregset, fill_fpregset): Remove.

   I just noticed this in one of my builds. I'm attempting to modernize
   and prepare my NetBSD thread support code for integration, and that
   code uses the {supply,fill}_{regset,fpregset} functions to implement
   the thread-specific fetch_registers and store_registers, based on
   register context passed back from the pthread debugging library (It
   was quite a boon when I ported it forward from 5.0 to 5.3 and got
   these functions to use). If these are removed, is there a good way for
   an architecture-neutral bit of code like nbsd-thread.c to go back and
   forth between GDB's register storage and native register storage?

It's not entirely cristallized out yet, but yes there will be.  The
idea is to use "register sets" as fleshed out in regset.h.  A register
set contains a supply_regset() and collect_regset() member function
that knows how to convert between a target's register sets
(i.e. `struct reg' and `struct fpreg' for *BSD) and GDB's internal
register cache.  These register sets are already used for core files.
We have a gdbarch_regset_from_core_section() function that returns the
appropriate register set for a particular core section.  See corelow.c
and fbsd-proc.c for how this is used to read and write core files.

Jim Blandy is currently working on thread-related stuff for Linux
(powerpc and perhaps i386) that's going to use these registers sets.
We'll probably need to introduce a new
gdbarch_regset_from_thread_xxx() for the thread stuff.  The NetBSD
stuff should use similar code.

If you have any questions, or just want to show some code, please
don't hesitate to bug me about it.

Cheers

Mark


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

* Re: [PATCH] Some regset-related cleanup for i386bsd-nat.c
  2004-06-08 20:49 ` Nathan J. Williams
  2004-06-08 23:38   ` Mark Kettenis
@ 2004-06-09 16:20   ` Andrew Cagney
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2004-06-09 16:20 UTC (permalink / raw)
  To: Nathan J. Williams; +Cc: Mark Kettenis, gdb-patches

> Mark Kettenis <kettenis@chello.nl> writes:
> 
> 
>>> 	* i386bsd-nat.c: Don't include "gregset.h".
>>> 	(supply_gregset, fill_gregset): Make static.
>>> 	(supply_fpregset, fill_fpregset): Remove.
> 
> 
> I just noticed this in one of my builds. I'm attempting to modernize
> and prepare my NetBSD thread support code for integration, and that
> code uses the {supply,fill}_{regset,fpregset} functions to implement
> the thread-specific fetch_registers and store_registers, based on
> register context passed back from the pthread debugging library (It
> was quite a boon when I ported it forward from 5.0 to 5.3 and got
> these functions to use). If these are removed, is there a good way for
> an architecture-neutral bit of code like nbsd-thread.c to go back and
> forth between GDB's register storage and native register storage?

Have a look at regsets.[hc], the method:
   set_gdbarch_regset_from_core_section (gdbarch, 
ppc_linux_regset_from_core_section);
they set the general direction for where GDB is going.

Andrew



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

end of thread, other threads:[~2004-06-09 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-31 10:01 [PATCH] Some regset-related cleanup for i386bsd-nat.c Mark Kettenis
2004-06-08 20:49 ` Nathan J. Williams
2004-06-08 23:38   ` Mark Kettenis
2004-06-09 16:20   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox