aboutsummaryrefslogtreecommitdiff
path: root/gdb/hppa-hpux-nat.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-10-08 12:50:56 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-10-08 12:50:56 +0000
commit464963c92cc07668165c0e503994b41cde3daa4b (patch)
treec0ca0d91497447cff4919e9eb982ee2d6bf8e5c4 /gdb/hppa-hpux-nat.c
parent7fbe2eba67086bb413f4187d3dedc8fb3457ac3e (diff)
downloadgdb-464963c92cc07668165c0e503994b41cde3daa4b.zip
gdb-464963c92cc07668165c0e503994b41cde3daa4b.tar.gz
gdb-464963c92cc07668165c0e503994b41cde3daa4b.tar.bz2
2007-10-08 Markus Deuling <deuling@de.ibm.com>
* hppa-tdep.c (hppa_stub_unwind_sniffer, hppa_dump_tdep): Replace current_gdbarch by gdbarch. * hppa-linux-nat.c (fetch_register, store_register) (hppa_linux_fetch_inferior_registers) (hppa_linux_store_inferior_registers): Use get_regcache_arch or get_frame_arch to get at the current architecture by regcache or by frame, respectively. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code (hppa_hpux_unwind_adjust_stub): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_register, hppa_hpux_store_register) (hppa_hpux_fetch_inferior_registers) (hppa_hpux_store_inferior_registers): Likewise.
Diffstat (limited to 'gdb/hppa-hpux-nat.c')
-rw-r--r--gdb/hppa-hpux-nat.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gdb/hppa-hpux-nat.c b/gdb/hppa-hpux-nat.c
index 4a0f75f..31932b1 100644
--- a/gdb/hppa-hpux-nat.c
+++ b/gdb/hppa-hpux-nat.c
@@ -87,6 +87,7 @@ hppa_hpux_save_state_offset (struct regcache *regcache, int regnum)
static void
hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR addr;
size_t size;
PTRACE_TYPE_RET *buf;
@@ -97,7 +98,7 @@ hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
/* This isn't really an address, but ptrace thinks of it as one. */
addr = hppa_hpux_save_state_offset (regcache, regnum);
- size = register_size (current_gdbarch, regnum);
+ size = register_size (gdbarch, regnum);
gdb_assert (size == 4 || size == 8);
buf = alloca (size);
@@ -108,7 +109,7 @@ hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
if (ttrace (TT_LWP_RUREGS, pid, lwp, addr, size, (uintptr_t)buf) == -1)
error (_("Couldn't read register %s (#%d): %s"),
- gdbarch_register_name (current_gdbarch, regnum),
+ gdbarch_register_name (gdbarch, regnum),
regnum, safe_strerror (errno));
}
#else
@@ -122,7 +123,7 @@ hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
buf[i] = ptrace (PT_RUREGS, pid, (PTRACE_TYPE_ARG3) addr, 0, 0);
if (errno != 0)
error (_("Couldn't read register %s (#%d): %s"),
- gdbarch_register_name (current_gdbarch, regnum),
+ gdbarch_register_name (gdbarch, regnum),
regnum, safe_strerror (errno));
addr += sizeof (PTRACE_TYPE_RET);
@@ -145,7 +146,9 @@ static void
hppa_hpux_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
- for (regnum = 0; regnum < gdbarch_num_regs (current_gdbarch); regnum++)
+ for (regnum = 0;
+ regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+ regnum++)
hppa_hpux_fetch_register (regcache, regnum);
else
hppa_hpux_fetch_register (regcache, regnum);
@@ -156,7 +159,8 @@ hppa_hpux_fetch_inferior_registers (struct regcache *regcache, int regnum)
static void
hppa_hpux_store_register (struct regcache *regcache, int regnum)
{
- CORE_ADDR addr;
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ CORE_ADDR addr
size_t size;
PTRACE_TYPE_RET *buf;
pid_t pid;
@@ -165,7 +169,7 @@ hppa_hpux_store_register (struct regcache *regcache, int regnum)
/* This isn't really an address, but ptrace thinks of it as one. */
addr = hppa_hpux_save_state_offset (regcache, regnum);
- size = register_size (current_gdbarch, regnum);
+ size = register_size (gdbarch, regnum);
gdb_assert (size == 4 || size == 8);
buf = alloca (size);
@@ -187,7 +191,7 @@ hppa_hpux_store_register (struct regcache *regcache, int regnum)
if (ttrace (TT_LWP_WUREGS, pid, lwp, addr, size, (uintptr_t)buf) == -1)
error (_("Couldn't write register %s (#%d): %s"),
- gdbarch_register_name (current_gdbarch, regnum),
+ gdbarch_register_name (gdbarch, regnum),
regnum, safe_strerror (errno));
}
#else
@@ -201,7 +205,7 @@ hppa_hpux_store_register (struct regcache *regcache, int regnum)
ptrace (PT_WUREGS, pid, (PTRACE_TYPE_ARG3) addr, buf[i], 0);
if (errno != 0)
error (_("Couldn't write register %s (#%d): %s"),
- gdbarch_register_name (current_gdbarch, regnum),
+ gdbarch_register_name (gdbarch, regnum),
regnum, safe_strerror (errno));
addr += sizeof (PTRACE_TYPE_RET);
@@ -217,7 +221,9 @@ static void
hppa_hpux_store_inferior_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
- for (regnum = 0; regnum < gdbarch_num_regs (current_gdbarch); regnum++)
+ for (regnum = 0;
+ regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+ regnum++)
hppa_hpux_store_register (regcache, regnum);
else
hppa_hpux_store_register (regcache, regnum);