summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/alpha-nat.c3
-rw-r--r--gdb/arm-linux-nat.c3
-rw-r--r--gdb/config/nm-linux.h5
-rw-r--r--gdb/core-regset.c3
-rw-r--r--gdb/core-sol2.c3
-rw-r--r--gdb/cxux-nat.c3
-rw-r--r--gdb/gregset.h50
-rw-r--r--gdb/i386-linux-nat.c3
-rw-r--r--gdb/i386v4-nat.c3
-rw-r--r--gdb/ia64-linux-nat.c3
-rw-r--r--gdb/irix4-nat.c3
-rw-r--r--gdb/irix5-nat.c3
-rw-r--r--gdb/lin-thread.c3
-rw-r--r--gdb/m68k-tdep.c3
-rw-r--r--gdb/m68klinux-nat.c3
-rw-r--r--gdb/m88k-nat.c3
-rw-r--r--gdb/mipsv4-nat.c3
-rw-r--r--gdb/ppc-linux-nat.c3
-rw-r--r--gdb/procfs.c34
-rw-r--r--gdb/ptx4-nat.c3
-rw-r--r--gdb/sol-thread.c37
-rw-r--r--gdb/sparc-tdep.c13
-rw-r--r--gdb/uw-thread.c2
23 files changed, 131 insertions, 61 deletions
diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c
index 089e56fea10..e1b6e4e66a4 100644
--- a/gdb/alpha-nat.c
+++ b/gdb/alpha-nat.c
@@ -199,6 +199,9 @@ kernel_u_size ()
#if defined(USE_PROC_FS) || defined(HAVE_GREGSET_T)
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/*
* See the comment in m68k-tdep.c regarding the utility of these functions.
*/
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 466d1d10164..7c8e04b1885 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -28,6 +28,9 @@
#include <sys/utsname.h>
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
extern int arm_apcs_32;
#define typeNone 0x00
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index 9b225827c54..ecf4711e922 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -59,3 +59,8 @@ linuxthreads_prepare_to_proceed PARAMS ((int step));
#define TIDGET(PID) (((PID) & 0x7fffffff) >> 16)
#define MERGEPID(PID, TID) (((PID) & 0xffff) | ((TID) << 16))
+/* Use elf_gregset_t and elf_fpregset_t, rather than
+ gregset_t and fpregset_t. */
+
+#define GDB_GREGSET_T prgregset_t
+#define GDB_FPREGSET_T prfpregset_t
diff --git a/gdb/core-regset.c b/gdb/core-regset.c
index 36880276b8a..248f8026d99 100644
--- a/gdb/core-regset.c
+++ b/gdb/core-regset.c
@@ -48,6 +48,9 @@
#include "command.h"
#include "gdbcore.h"
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
static void fetch_core_registers PARAMS ((char *, unsigned, int, CORE_ADDR));
void _initialize_core_regset PARAMS ((void));
diff --git a/gdb/core-sol2.c b/gdb/core-sol2.c
index 3ce9cd460d0..6a829f75dd0 100644
--- a/gdb/core-sol2.c
+++ b/gdb/core-sol2.c
@@ -40,6 +40,9 @@
#include "command.h"
#include "gdbcore.h"
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
static void fetch_core_registers PARAMS ((char *, unsigned, int, CORE_ADDR));
static void
diff --git a/gdb/cxux-nat.c b/gdb/cxux-nat.c
index 8c16bceb983..93ed232770c 100644
--- a/gdb/cxux-nat.c
+++ b/gdb/cxux-nat.c
@@ -281,6 +281,9 @@ m88k_register_u_addr (blockend, regnum)
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* Given a pointer to a general register set in /proc format (gregset_t *),
unpack the register contents and supply them as gdb's idea of the current
register values. */
diff --git a/gdb/gregset.h b/gdb/gregset.h
new file mode 100644
index 00000000000..3a85397455a
--- /dev/null
+++ b/gdb/gregset.h
@@ -0,0 +1,50 @@
+/* Interface for functions using gregset and fpregset types.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef GDB_GREGSET_T
+#define GDB_GREGSET_T gregset_t
+#endif
+
+#ifndef GDB_FPREGSET_T
+#define GDB_FPREGSET_T fpregset_t
+#endif
+
+typedef GDB_GREGSET_T gdb_gregset_t;
+typedef GDB_FPREGSET_T gdb_fpregset_t;
+
+/* A gregset is a data structure supplied by the native OS containing
+ the general register values of the debugged process. Usually this
+ includes integer registers and control registers. An fpregset is a
+ data structure containing the floating point registers. These data
+ structures were originally a part of the /proc interface, but have
+ been borrowed or copied by other GDB targets, eg. Linux. */
+
+/* Copy register values from the native target gregset / fpregset
+ into GDB's internal register cache. */
+
+extern void supply_gregset (gdb_gregset_t *gregs);
+extern void supply_fpregset (gdb_fpregset_t *fpregs);
+
+/* Copy register values from GDB's register cache into
+ the native target gregset / fpregset. If regno is -1,
+ copy all the registers. */
+
+extern void fill_gregset (gdb_gregset_t *gregs, int regno);
+extern void fill_fpregset (gdb_fpregset_t *fpregs, int regno);
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 287b23bcb29..6a375589175 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -35,6 +35,9 @@
#include <sys/reg.h>
#endif
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* On Linux, threads are implemented as pseudo-processes, in which
case we may be tracing more than one process at a time. In that
case, inferior_pid will contain the main process ID and the
diff --git a/gdb/i386v4-nat.c b/gdb/i386v4-nat.c
index 056ea7f3ba2..3ed273e7b13 100644
--- a/gdb/i386v4-nat.c
+++ b/gdb/i386v4-nat.c
@@ -31,6 +31,9 @@
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* The /proc interface divides the target machine's register set up into
two different sets, the general register set (gregset) and the floating
point register set (fpregset). For each set, there is an ioctl to get
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index dfaa704f799..339c58ba760 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -34,6 +34,9 @@
#include <asm/ptrace_offsets.h>
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* These must match the order of the register names.
Some sort of lookup table is needed because the offsets associated
diff --git a/gdb/irix4-nat.c b/gdb/irix4-nat.c
index 03eadc0359e..9509f8a9e6d 100644
--- a/gdb/irix4-nat.c
+++ b/gdb/irix4-nat.c
@@ -30,6 +30,9 @@
#include <sys/procfs.h>
#include <setjmp.h> /* For JB_XXX. */
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* Size of elements in jmpbuf */
#define JB_ELEMENT_SIZE 4
diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c
index 2a16dc07ebd..19e4d954cc2 100644
--- a/gdb/irix5-nat.c
+++ b/gdb/irix5-nat.c
@@ -33,6 +33,9 @@
#include <sys/procfs.h>
#include <setjmp.h> /* For JB_XXX. */
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
static void
fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
diff --git a/gdb/lin-thread.c b/gdb/lin-thread.c
index 7f54e299540..cd9ab996eb7 100644
--- a/gdb/lin-thread.c
+++ b/gdb/lin-thread.c
@@ -125,6 +125,9 @@
#include <dlfcn.h> /* dynamic library interface */
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
#ifndef TIDGET
#define TIDGET(PID) (((PID) & 0x7fffffff) >> 16)
#define PIDGET(PID) (((PID) & 0xffff))
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 359d61f85aa..0bdb3f62fc1 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -507,6 +507,9 @@ lose:;
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* The /proc interface divides the target machine's register set up into
two different sets, the general register set (gregset) and the floating
point register set (fpregset). For each set, there is an ioctl to get
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index 4eed201fcaf..111f2a91a2f 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -82,6 +82,9 @@ m68k_linux_register_u_addr (blockend, regnum)
#ifndef USE_PROC_FS
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
void
supply_gregset (gregsetp)
gregset_t *gregsetp;
diff --git a/gdb/m88k-nat.c b/gdb/m88k-nat.c
index ed9dfffc306..afaa4ea9817 100644
--- a/gdb/m88k-nat.c
+++ b/gdb/m88k-nat.c
@@ -239,6 +239,9 @@ m88k_register_u_addr (blockend, regnum)
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* Given a pointer to a general register set in /proc format (gregset_t *),
unpack the register contents and supply them as gdb's idea of the current
register values. */
diff --git a/gdb/mipsv4-nat.c b/gdb/mipsv4-nat.c
index 8551186bc0f..01ac8c05784 100644
--- a/gdb/mipsv4-nat.c
+++ b/gdb/mipsv4-nat.c
@@ -27,6 +27,9 @@
#include <sys/procfs.h>
#include <setjmp.h> /* For JB_XXX. */
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* Size of elements in jmpbuf */
#define JB_ELEMENT_SIZE 4
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 2f242a8427e..30e580a0def 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -31,6 +31,9 @@
#include <fcntl.h>
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
int
kernel_u_size ()
{
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 73716e6e457..9e9275a3221 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -89,6 +89,9 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "proc-utils.h"
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* =================== TARGET_OPS "MODULE" =================== */
/*
@@ -245,24 +248,6 @@ typedef prstatus_t gdb_prstatus_t;
typedef prstatus_t gdb_lwpstatus_t;
#endif /* NEW_PROC_API */
-
-/* These #ifdefs are for sol2.x in particular. sol2.x has
- both a "gregset_t" and a "prgregset_t", which have
- similar uses but different layouts. sol2.x gdb tries to
- use prgregset_t (and prfpregset_t) everywhere. */
-
-#ifdef GDB_GREGSET_TYPE
- typedef GDB_GREGSET_TYPE gdb_gregset_t;
-#else
- typedef gregset_t gdb_gregset_t;
-#endif
-
-#ifdef GDB_FPREGSET_TYPE
- typedef GDB_FPREGSET_TYPE gdb_fpregset_t;
-#else
- typedef fpregset_t gdb_fpregset_t;
-#endif
-
/* Provide default composite pid manipulation macros for systems that
don't have threads. */
@@ -3470,19 +3455,6 @@ do_detach (signo)
* is resumed.
*/
-/* These could go in a header file, but the many and various
- definitions of gregset_t would make it tricky and ugly. Several
- different native operating systems (notably Solaris and Linux) have
- various different definitions for gregset_t and fpregset_t. We
- have been kludging around this problem for a while, it would be
- nice if someday we came up with a prettier way of handling it
- (FIXME). */
-
-extern void fill_gregset (gdb_gregset_t *, int);
-extern void fill_fpregset (gdb_fpregset_t *, int);
-extern void supply_gregset (gdb_gregset_t *);
-extern void supply_fpregset (gdb_fpregset_t *);
-
static void
procfs_fetch_registers (regno)
int regno;
diff --git a/gdb/ptx4-nat.c b/gdb/ptx4-nat.c
index a7acee27149..2ff79953eb2 100644
--- a/gdb/ptx4-nat.c
+++ b/gdb/ptx4-nat.c
@@ -26,6 +26,9 @@
#include <sys/param.h>
#include <fcntl.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* Given a pointer to a general register set in /proc format (gregset_t *),
unpack the register contents and supply them as gdb's idea of the current
register values. */
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 77e3fb14e9b..bca8be8507c 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -72,19 +72,8 @@ extern struct target_ops procfs_ops; /* target vector for procfs.c */
extern struct target_ops core_ops; /* target vector for corelow.c */
extern char *procfs_pid_to_str PARAMS ((int pid));
-/* Note that these prototypes differ slightly from those used in procfs.c
- for of two reasons. One, we can't use gregset_t, as that's got a whole
- different meaning under Solaris (also, see above). Two, we can't use the
- pointer form here as these are actually arrays of ints (for Sparc's at
- least), and are automatically coerced into pointers to ints when used as
- parameters. That makes it impossible to avoid a compiler warning when
- passing pr{g fp}regset_t's from a parameter to an argument of one of
- these functions. */
-
-extern void supply_gregset PARAMS ((const prgregset_t));
-extern void fill_gregset PARAMS ((prgregset_t, int));
-extern void supply_fpregset PARAMS ((const prfpregset_t *));
-extern void fill_fpregset PARAMS ((prfpregset_t *, int));
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
/* This struct is defined by us, but mainly used for the proc_service interface.
We don't have much use for it, except as a handy place to get a real pid
@@ -660,8 +649,8 @@ sol_thread_fetch_registers (regno)
because the td routines call ps_lget* which affect the values stored in the
registers array. */
- supply_gregset (gregset);
- supply_fpregset (&fpregset);
+ supply_gregset ((gdb_gregset_t *) &gregset);
+ supply_fpregset ((gdb_fpregset_t *) &fpregset);
#if 0
/* thread_db doesn't seem to handle this right */
@@ -688,7 +677,7 @@ sol_thread_store_registers (regno)
thread_t thread;
td_thrhandle_t thandle;
td_err_e val;
- prgregset_t regset;
+ prgregset_t gregset;
prfpregset_t fpregset;
#if 0
int xregsize;
@@ -716,7 +705,7 @@ sol_thread_store_registers (regno)
char old_value[REGISTER_SIZE];
memcpy (old_value, &registers[REGISTER_BYTE (regno)], REGISTER_SIZE);
- val = p_td_thr_getgregs (&thandle, regset);
+ val = p_td_thr_getgregs (&thandle, gregset);
if (val != TD_OK)
error ("sol_thread_store_registers: td_thr_getgregs %s",
td_err_string (val));
@@ -746,10 +735,10 @@ sol_thread_store_registers (regno)
#endif
}
- fill_gregset (regset, regno);
- fill_fpregset (&fpregset, regno);
+ fill_gregset ((gdb_gregset_t *) &gregset, regno);
+ fill_fpregset ((gdb_fpregset_t *) &fpregset, regno);
- val = p_td_thr_setgregs (&thandle, regset);
+ val = p_td_thr_setgregs (&thandle, gregset);
if (val != TD_OK)
error ("sol_thread_store_registers: td_thr_setgregs %s",
td_err_string (val));
@@ -1163,7 +1152,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
procfs_ops.to_fetch_registers (-1);
else
orig_core_ops.to_fetch_registers (-1);
- fill_gregset (gregset, -1);
+ fill_gregset ((gdb_gregset_t *) gregset, -1);
do_cleanups (old_chain);
@@ -1182,7 +1171,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
inferior_pid = BUILD_LWP (lwpid, PIDGET (inferior_pid));
- supply_gregset (gregset);
+ supply_gregset ((gdb_gregset_t *) gregset);
if (target_has_execution)
procfs_ops.to_store_registers (-1);
else
@@ -1295,7 +1284,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
procfs_ops.to_fetch_registers (-1);
else
orig_core_ops.to_fetch_registers (-1);
- fill_fpregset (fpregset, -1);
+ fill_fpregset ((gdb_fpregset_t *) fpregset, -1);
do_cleanups (old_chain);
@@ -1314,7 +1303,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
inferior_pid = BUILD_LWP (lwpid, PIDGET (inferior_pid));
- supply_fpregset (fpregset);
+ supply_fpregset ((gdb_fpregset_t *) fpregset);
if (target_has_execution)
procfs_ops.to_store_registers (-1);
else
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index e69a00a8182..0a901b1e2d7 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -39,6 +39,9 @@
#include "symfile.h" /* for 'entry_point_address' */
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/*
* Some local macros that have multi-arch and non-multi-arch versions:
*/
@@ -1431,15 +1434,13 @@ sunos4_skip_trampoline_code (pc)
*/
/* *INDENT-ON* */
-
-
/* Given a pointer to a general register set in /proc format (gregset_t *),
unpack the register contents and supply them as gdb's idea of the current
register values. */
void
supply_gregset (gregsetp)
- prgregset_t *gregsetp;
+ gdb_gregset_t *gregsetp;
{
prgreg_t *regp = (prgreg_t *) gregsetp;
int regi, offset = 0;
@@ -1561,7 +1562,7 @@ supply_gregset (gregsetp)
void
fill_gregset (gregsetp, regno)
- prgregset_t *gregsetp;
+ gdb_gregset_t *gregsetp;
int regno;
{
prgreg_t *regp = (prgreg_t *) gregsetp;
@@ -1643,7 +1644,7 @@ fill_gregset (gregsetp, regno)
void
supply_fpregset (fpregsetp)
- prfpregset_t *fpregsetp;
+ gdb_fpregset_t *fpregsetp;
{
register int regi;
char *from;
@@ -1682,7 +1683,7 @@ supply_fpregset (fpregsetp)
void
fill_fpregset (fpregsetp, regno)
- prfpregset_t *fpregsetp;
+ gdb_fpregset_t *fpregsetp;
int regno;
{
int regi;
diff --git a/gdb/uw-thread.c b/gdb/uw-thread.c
index e3650a93b51..17e98fd3d62 100644
--- a/gdb/uw-thread.c
+++ b/gdb/uw-thread.c
@@ -112,6 +112,8 @@
#include <synch.h> /* for UnixWare 2.x */
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
/* Whether to emit debugging output. */