aboutsummaryrefslogtreecommitdiff
path: root/gdb/alpha-linux-nat.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-04-26 00:13:12 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-04-26 00:13:12 +0000
commitb02f9d57327dbea7322242fb23f3040d5376acec (patch)
tree5e2d91e23bed37883ef76f62576ce26429ec4661 /gdb/alpha-linux-nat.c
parent4aee06340450257664f7d8300c6eb9b0bb43fd5f (diff)
downloadgdb-b02f9d57327dbea7322242fb23f3040d5376acec.zip
gdb-b02f9d57327dbea7322242fb23f3040d5376acec.tar.gz
gdb-b02f9d57327dbea7322242fb23f3040d5376acec.tar.bz2
* alpha-linux-tdep.c: Include "gdb_string.h", "regset.h",
and "regcache.h". (alpha_linux_supply_gregset, alpha_linux_supply_fpregset): New. (alpha_linux_gregset, alpha_linux_fpregset): New variables. (alpha_linux_regset_from_core_section): New function. (alpha_linux_init_abi): Install it. * alpha-linux-nat.c: Do not include "gdbcore.h". Include "alpha-tdep.h", <sys/ptrace.h>, <alpha/ptrace.h>, <sys/procfs.h>, and "gregset.h". (ALPHA_REGSET_BASE, ALPHA_REGSET_UNIQUE, ALPHA_UNIQUE_PTRACE_ADDR): Move from config/alpha/nm-linux.h. (supply_gregset, fill_gregset, supply_fpregset, fill_fpregset): Copy from alpha-nat.c. (alpha_linux_register_u_offset): Inline register_addr from alpha-nat.c. * alpha-nat.c: Remove #ifdef __linux__ section. (fetch_elf_core_registers, alpha_elf_core_fns): Remove. (_initialize_core_alpha): Do not register alpha_elf_core_fns. (ALPHA_UNIQUE_PTRACE_ADDR, ALPHA_REGSET_UNIQUE): Define unconditionally. (ALPHA_REGSET_BASE): Move from config/alpha/nm-osf.h. * config/alpha/alpha-linux.mh (NAT_FILE): Set to config/nm-linux.h. (NATDEPFILES): Remove alpha-nat.o. * config/alpha/nm-linux.h: Delete file. * config/alpha/nm-osf.h (ALPHA_REGSET_BASE): Move to alpha-nat.c. * Makefile.in (alpha-linux-nat.o): Update dependencies. (alpha-linux-tdep.o): Likewise.
Diffstat (limited to 'gdb/alpha-linux-nat.c')
-rw-r--r--gdb/alpha-linux-nat.c80
1 files changed, 75 insertions, 5 deletions
diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c
index 0186a94..8307a69 100644
--- a/gdb/alpha-linux-nat.c
+++ b/gdb/alpha-linux-nat.c
@@ -21,15 +21,85 @@
#include "defs.h"
#include "target.h"
#include "linux-nat.h"
-#include "gdbcore.h"
+
+#include "alpha-tdep.h"
+
+#include <sys/ptrace.h>
+#include <alpha/ptrace.h>
+
+#include <sys/procfs.h>
+#include "gregset.h"
+
+/* Given a pointer to either a gregset_t or fpregset_t, return a
+ pointer to the first register. */
+#define ALPHA_REGSET_BASE(regsetp) ((long *) (regsetp))
+
+/* Given a pointer to a gregset_t, locate the UNIQUE value. */
+#define ALPHA_REGSET_UNIQUE(regsetp) ((long *)(regsetp) + 32)
+
+/* The address of UNIQUE for ptrace. */
+#define ALPHA_UNIQUE_PTRACE_ADDR 65
+
+
+/*
+ * See the comment in m68k-tdep.c regarding the utility of these functions.
+ */
+
+void
+supply_gregset (gdb_gregset_t *gregsetp)
+{
+ long *regp = ALPHA_REGSET_BASE (gregsetp);
+ void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
+
+ /* PC is in slot 32. */
+ alpha_supply_int_regs (-1, regp, regp + 31, unique);
+}
+
+void
+fill_gregset (gdb_gregset_t *gregsetp, int regno)
+{
+ long *regp = ALPHA_REGSET_BASE (gregsetp);
+ void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
+
+ /* PC is in slot 32. */
+ alpha_fill_int_regs (regno, regp, regp + 31, unique);
+}
+
+/*
+ * Now we do the same thing for floating-point registers.
+ * Again, see the comments in m68k-tdep.c.
+ */
+
+void
+supply_fpregset (gdb_fpregset_t *fpregsetp)
+{
+ long *regp = ALPHA_REGSET_BASE (fpregsetp);
+
+ /* FPCR is in slot 32. */
+ alpha_supply_fp_regs (-1, regp, regp + 31);
+}
+
+void
+fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+{
+ long *regp = ALPHA_REGSET_BASE (fpregsetp);
+
+ /* FPCR is in slot 32. */
+ alpha_fill_fp_regs (regno, regp, regp + 31);
+}
+
static CORE_ADDR
alpha_linux_register_u_offset (int regno)
{
- /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
- away. This requires disentangling the various definitions of it
- (particularly alpha-nat.c's). */
- return register_addr (regno, 0);
+ if (regno == PC_REGNUM)
+ return PC;
+ if (regno == ALPHA_UNIQUE_REGNUM)
+ return ALPHA_UNIQUE_PTRACE_ADDR;
+ if (regno < FP0_REGNUM)
+ return GPR_BASE + regno;
+ else
+ return FPR_BASE + regno - FP0_REGNUM;
}
void _initialialize_alpha_linux_nat (void);