aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/hppa-hpux-nat.c24
-rw-r--r--gdb/hppa-hpux-tdep.c14
-rw-r--r--gdb/hppa-linux-nat.c18
-rw-r--r--gdb/hppa-tdep.c6
5 files changed, 53 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c169973..386a863 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
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.
+
+2007-10-08 Markus Deuling <deuling@de.ibm.com>
+
* cris-tdep.c (cris_sigcontext_addr, cris_sigtramp_frame_unwind_cache)
(cris_scan_prologue, crisv32_scan_prologue, find_step_target)
(cris_software_single_step, cris_supply_gregset): Use get_regcache_arch
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);
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index e7188e5..cf1c1d1 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -299,6 +299,7 @@ hppa_hpux_in_solib_return_trampoline (CORE_ADDR pc, char *name)
static CORE_ADDR
hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
long orig_pc = pc;
long prev_inst, curr_inst, loc;
struct minimal_symbol *msym;
@@ -315,13 +316,13 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
itself. Bit 31 has meaning too, but only for MPE. */
if (pc & 0x2)
pc = (CORE_ADDR) read_memory_integer
- (pc & ~0x3, gdbarch_ptr_bit (current_gdbarch) / 8);
+ (pc & ~0x3, gdbarch_ptr_bit (gdbarch) / 8);
}
if (pc == hppa_symbol_address("$$dyncall_external"))
{
pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22);
pc = (CORE_ADDR) read_memory_integer
- (pc & ~0x3, gdbarch_ptr_bit (current_gdbarch) / 8);
+ (pc & ~0x3, gdbarch_ptr_bit (gdbarch) / 8);
}
else if (pc == hppa_symbol_address("_sr4export"))
pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22);
@@ -517,7 +518,7 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{
return (read_memory_integer
(get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24,
- gdbarch_ptr_bit (current_gdbarch) / 8)) & ~0x3;
+ gdbarch_ptr_bit (gdbarch) / 8)) & ~0x3;
}
/* What about be,n 0(sr0,%rp)? It's just another way we return to
@@ -530,7 +531,7 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
mtsp %r1,%sr0 if we want to do sanity checking. */
return (read_memory_integer
(get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24,
- gdbarch_ptr_bit (current_gdbarch) / 8)) & ~0x3;
+ gdbarch_ptr_bit (gdbarch) / 8)) & ~0x3;
}
/* Haven't found the branch yet, but we're still in the stub.
@@ -1422,6 +1423,7 @@ static void
hppa_hpux_unwind_adjust_stub (struct frame_info *next_frame, CORE_ADDR base,
struct trad_frame_saved_reg *saved_regs)
{
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
int optimized, realreg;
enum lval_type lval;
CORE_ADDR addr;
@@ -1441,14 +1443,14 @@ hppa_hpux_unwind_adjust_stub (struct frame_info *next_frame, CORE_ADDR base,
if (u && u->stub_unwind.stub_type == EXPORT)
{
stubpc = read_memory_integer
- (base - 24, gdbarch_ptr_bit (current_gdbarch) / 8);
+ (base - 24, gdbarch_ptr_bit (gdbarch) / 8);
trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc);
}
else if (hppa_symbol_address ("__gcc_plt_call")
== get_pc_function_start (val))
{
stubpc = read_memory_integer
- (base - 8, gdbarch_ptr_bit (current_gdbarch) / 8);
+ (base - 8, gdbarch_ptr_bit (gdbarch) / 8);
trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc);
}
}
diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c
index 87db5a4..def0f86 100644
--- a/gdb/hppa-linux-nat.c
+++ b/gdb/hppa-linux-nat.c
@@ -216,10 +216,11 @@ static const int greg_map[] =
static void
fetch_register (struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
int val;
- if (gdbarch_cannot_fetch_register (current_gdbarch, regno))
+ if (gdbarch_cannot_fetch_register (gdbarch, regno))
{
regcache_raw_supply (regcache, regno, NULL);
return;
@@ -234,7 +235,7 @@ fetch_register (struct regcache *regcache, int regno)
val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
if (errno != 0)
error (_("Couldn't read register %s (#%d): %s."),
- gdbarch_register_name (current_gdbarch, regno),
+ gdbarch_register_name (gdbarch, regno),
regno, safe_strerror (errno));
regcache_raw_supply (regcache, regno, &val);
@@ -245,10 +246,11 @@ fetch_register (struct regcache *regcache, int regno)
static void
store_register (const struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
int val;
- if (gdbarch_cannot_store_register (current_gdbarch, regno))
+ if (gdbarch_cannot_store_register (gdbarch, regno))
return;
/* GNU/Linux LWP ID's are process ID's. */
@@ -261,7 +263,7 @@ store_register (const struct regcache *regcache, int regno)
ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
if (errno != 0)
error (_("Couldn't write register %s (#%d): %s."),
- gdbarch_register_name (current_gdbarch, regno),
+ gdbarch_register_name (gdbarch, regno),
regno, safe_strerror (errno));
}
@@ -274,7 +276,9 @@ hppa_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0;
+ regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
fetch_register (regcache, regno);
}
else
@@ -292,7 +296,9 @@ hppa_linux_store_inferior_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0;
+ regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
store_register (regcache, regno);
}
else
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 10ac7ec..f3cff64 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2461,7 +2461,7 @@ hppa_stub_unwind_sniffer (struct frame_info *next_frame)
if (pc == 0
|| (tdep->in_solib_call_trampoline != NULL
&& tdep->in_solib_call_trampoline (pc, NULL))
- || gdbarch_in_solib_return_trampoline (current_gdbarch, pc, NULL))
+ || gdbarch_in_solib_return_trampoline (gdbarch, pc, NULL))
return &hppa_stub_frame_unwind;
return NULL;
}
@@ -3195,9 +3195,9 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
static void
-hppa_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+hppa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
fprintf_unfiltered (file, "bytes_per_address = %d\n",
tdep->bytes_per_address);