aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2006-01-14 12:24:36 +0000
committerMark Kettenis <kettenis@gnu.org>2006-01-14 12:24:36 +0000
commit20776c7d553eb9e3dddbef1e0385952b869689cf (patch)
treedd0351ab12d53a46738bf5ae69c68c706ceabae9 /gdb
parent6da866186a9826152254528a505fec13adfcfc6e (diff)
downloadgdb-20776c7d553eb9e3dddbef1e0385952b869689cf.zip
gdb-20776c7d553eb9e3dddbef1e0385952b869689cf.tar.gz
gdb-20776c7d553eb9e3dddbef1e0385952b869689cf.tar.bz2
* hppa-tdep.h (enum hppa_regnum): Add HPPA_FP31R_REGNUM.
* hppabsd-nat.c (hppabsd_fpregset_supplies_p) (hppabsd_supply_fpregset, hppabsd_collect_fpregset): New functions. (hppabsd_fetch_registers, hppabsd_store_registers): Handle floating-point registers. print_scalar_formatted (valaddr, type, format, 0, stream); val_print_type_code_flags (type, valaddr, stream); print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); val_print_type_code_flags (type, valaddr + embedded_offset, stream); for (reg = 16; reg < 31; reg++) /* We may have to apply a StackGhost cookie. */ fs->regs.reg[31].how = DWARF2_FRAME_REG_SAVED_WCOOKIE; fs->regs.reg[31].loc.offset = 15 * size; int regnum; buf, 0, size); { ULONGEST wcookie = extract_unsigned_integer (buf, len); gdb_assert (len == size); *lvalp = not_lval; *addrp = 0; if (valuep) { ULONGEST value = extract_unsigned_integer (valuep, size); store_unsigned_integer (valuep, size, value ^ wcookie); } } apply StackGhost cookie. */ print_scalar_formatted (valaddr, type, format, 0, stream); val_print_type_code_flags (type, valaddr, stream); || (TYPE_CODE (t) == TYPE_CODE_FLAGS) case TYPE_CODE_FLAGS: case TYPE_CODE_FLAGS: void *fpregs, int regnum) { regcache_raw_collect (regcache, i, regs); regcache_raw_collect (regcache, i + 1, regs + 4); } (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't write floating point status")); print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); val_print_type_code_flags (type, valaddr + embedded_offset, stream); || regnum == PC_REGNUM); || regnum == tdep->ppc_fpscr_regnum); regnum, &regs, sizeof regs); regnum, &fpregs, sizeof fpregs); regnum, &regs, sizeof regs); regnum, &fpregs, sizeof fpregs); const char *sect_name, size_t sect_size) struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) if (lr_reg == -1) { /* bcl 20,xx,.+4 is used to get the current PC, with or without prediction bits. If the LR has already been saved, we can skip it. */ continue; } extract_unsigned_integer ((gdb_byte *)&(MEMBER), sizeof (MEMBER)) builtin_type_void_data_ptr); lmo->r_version_size); builtin_type_void_data_ptr); lm = ldsomap = solib_svr4_r_ldsomap (); || (X_I (insn) == 1 && X_RS1 (insn) == 0 && (insn & 0x7f) == 0)) { /* OpenBSD system call. */ ULONGEST number; regcache_cooked_read_unsigned (current_regcache, SPARC_G1_REGNUM, &number); if (number & 0x400) return sparc_address_from_register (SPARC_G2_REGNUM); if (number & 0x800) return sparc_address_from_register (SPARC_G7_REGNUM); } gdb_byte *buffer; gdb_byte *check = xmalloc (len); (unsigned int *)cache_ovly_table, cache_novlys * 4); cache_ovly_table[i], 4); error (_(""%s" exists in this program but is not a function."), name); return value_of_variable (sym, NULL); struct ui_file *stream) { if (TYPE_FIELD_NAME (type, bitpos)) fprintf_filtered (stream, "%s ", TYPE_FIELD_NAME (type, bitpos)); else fprintf_filtered (stream, "#%d ", bitpos); } const gdb_byte *valaddr, struct ui_file *stream); i386-sol2-tdep.o sol2-tdep.o corelow.o solib.o solib-svr4.o sol2-tdep.o solib.o solib-svr4.o
Diffstat (limited to 'gdb')
-rw-r--r--gdb/hppa-tdep.h1
-rw-r--r--gdb/hppabsd-nat.c68
2 files changed, 69 insertions, 0 deletions
diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h
index 699a4f8..adaddae 100644
--- a/gdb/hppa-tdep.h
+++ b/gdb/hppa-tdep.h
@@ -68,6 +68,7 @@ enum hppa_regnum
HPPA_FP0_REGNUM = 64, /* First floating-point. */
HPPA_FP4_REGNUM = 72,
HPPA64_FP4_REGNUM = 68,
+ HPPA_FP31R_REGNUM = 127, /* Last floating-point. */
HPPA_ARG0_REGNUM = 26, /* The first argument of a callee. */
HPPA_ARG1_REGNUM = 25, /* The second argument of a callee. */
diff --git a/gdb/hppabsd-nat.c b/gdb/hppabsd-nat.c
index 438aaa5..0ffc018 100644
--- a/gdb/hppabsd-nat.c
+++ b/gdb/hppabsd-nat.c
@@ -37,6 +37,12 @@ hppabsd_gregset_supplies_p (int regnum)
return (regnum >= HPPA_R0_REGNUM && regnum <= HPPA_PCOQ_TAIL_REGNUM);
}
+static int
+hppabsd_fpregset_supplies_p (int regnum)
+{
+ return (regnum >= HPPA_FP0_REGNUM && regnum <= HPPA_FP31R_REGNUM);
+}
+
/* Supply the general-purpose registers stored in GREGS to REGCACHE. */
static void
@@ -53,6 +59,22 @@ hppabsd_supply_gregset (struct regcache *regcache, const void *gregs)
regcache_raw_supply (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 33 * 4);
}
+/* Supply the floating-point registers stored in FPREGS to REGCACHE. */
+
+static void
+hppabsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
+{
+ const char *regs = fpregs;
+ int regnum;
+
+ for (regnum = HPPA_FP0_REGNUM; regnum <= HPPA_FP31R_REGNUM;
+ regnum += 2, regs += 8)
+ {
+ regcache_raw_supply (regcache, regnum, regs);
+ regcache_raw_supply (regcache, regnum + 1, regs + 4);
+ }
+}
+
/* Collect the general-purpose registers from REGCACHE and store them
in GREGS. */
@@ -76,6 +98,26 @@ hppabsd_collect_gregset (const struct regcache *regcache,
if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM)
regcache_raw_collect (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 33 * 4);
}
+
+/* Collect the floating-point registers from REGCACHE and store them
+ in FPREGS. */
+
+static void
+hppabsd_collect_fpregset (struct regcache *regcache,
+ void *fpregs, int regnum)
+{
+ char *regs = fpregs;
+ int i;
+
+ for (i = HPPA_FP0_REGNUM; i <= HPPA_FP31R_REGNUM; i += 2, regs += 8)
+ {
+ if (regnum == -1 || regnum == i || regnum == i + 1)
+ {
+ regcache_raw_collect (regcache, i, regs);
+ regcache_raw_collect (regcache, i + 1, regs + 4);
+ }
+ }
+}
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
@@ -96,6 +138,17 @@ hppabsd_fetch_registers (int regnum)
hppabsd_supply_gregset (regcache, &regs);
}
+
+ if (regnum == -1 || hppabsd_fpregset_supplies_p (regnum))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ perror_with_name (_("Couldn't get floating point status"));
+
+ hppabsd_supply_fpregset (current_regcache, &fpregs);
+ }
}
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
@@ -118,6 +171,21 @@ hppabsd_store_registers (int regnum)
(PTRACE_TYPE_ARG3) &regs, 0) == -1)
perror_with_name (_("Couldn't write registers"));
}
+
+ if (regnum == -1 || hppabsd_fpregset_supplies_p (regnum))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ perror_with_name (_("Couldn't get floating point status"));
+
+ hppabsd_collect_fpregset (current_regcache, &fpregs, regnum);
+
+ if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ perror_with_name (_("Couldn't write floating point status"));
+ }
}
/* Provide a prototype to silence -Wmissing-prototypes. */