#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.
*/
#include <sys/utsname.h>
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
extern int arm_apcs_32;
#define typeNone 0x00
#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
#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));
#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
#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. */
--- /dev/null
+/* 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);
#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
#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
#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
#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
#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));
#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))
#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
#ifndef USE_PROC_FS
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
void
supply_gregset (gregsetp)
gregset_t *gregsetp;
#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. */
#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
#include <fcntl.h>
#include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
int
kernel_u_size ()
{
#include "proc-utils.h"
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
/* =================== TARGET_OPS "MODULE" =================== */
/*
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. */
* 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;
#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. */
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
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 */
thread_t thread;
td_thrhandle_t thandle;
td_err_e val;
- prgregset_t regset;
+ prgregset_t gregset;
prfpregset_t fpregset;
#if 0
int xregsize;
char old_value[REGISTER_SIZE];
memcpy (old_value, ®isters[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));
#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));
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);
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
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);
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
#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:
*/
*/
/* *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;
void
fill_gregset (gregsetp, regno)
- prgregset_t *gregsetp;
+ gdb_gregset_t *gregsetp;
int regno;
{
prgreg_t *regp = (prgreg_t *) gregsetp;
void
supply_fpregset (fpregsetp)
- prfpregset_t *fpregsetp;
+ gdb_fpregset_t *fpregsetp;
{
register int regi;
char *from;
void
fill_fpregset (fpregsetp, regno)
- prfpregset_t *fpregsetp;
+ gdb_fpregset_t *fpregsetp;
int regno;
{
int regi;
#include <synch.h> /* for UnixWare 2.x */
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
/* Whether to emit debugging output. */