2007-10-09 Markus Deuling <deuling@de.ibm.com>
* i386-linux-nat.c (fetch_register): Use get_regcache_arch to get at the current architecture by regcache. (store_register, supply_gregset, fill_gregset, i386_linux_resume) (i386_linux_fetch_inferior_registers) (i386_linux_store_inferior_registers): Likewise. * i386gnu-nat.c (gnu_fetch_registers, gnu_store_registers): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386v4-nat.c (supply_fpregset, fill_fpregset): Likewise. * i386-tdep.c (i386_unwind_pc): Replace current_gdbarch by gdbarch. (i386_extract_return_value, i386_store_return_value): Likewise. * i386-tdep.c (i386_frame_prev_register): Use get_frame_arch to get at the current architecture by frame_info. (i386_sigtramp_frame_cache, i386_get_longjmp_target) (i386_register_to_value, i386_value_to_register): Likewise.
This commit is contained in:
parent
9b072297d8
commit
875f8d0e3a
|
@ -1,3 +1,20 @@
|
||||||
|
2007-10-09 Markus Deuling <deuling@de.ibm.com>
|
||||||
|
|
||||||
|
* i386-linux-nat.c (fetch_register): Use get_regcache_arch to get at
|
||||||
|
the current architecture by regcache.
|
||||||
|
(store_register, supply_gregset, fill_gregset, i386_linux_resume)
|
||||||
|
(i386_linux_fetch_inferior_registers)
|
||||||
|
(i386_linux_store_inferior_registers): Likewise.
|
||||||
|
* i386gnu-nat.c (gnu_fetch_registers, gnu_store_registers): Likewise.
|
||||||
|
* i386-nto-tdep.c (i386nto_supply_gregset): Likewise.
|
||||||
|
* i386v4-nat.c (supply_fpregset, fill_fpregset): Likewise.
|
||||||
|
* i386-tdep.c (i386_unwind_pc): Replace current_gdbarch by gdbarch.
|
||||||
|
(i386_extract_return_value, i386_store_return_value): Likewise.
|
||||||
|
* i386-tdep.c (i386_frame_prev_register): Use get_frame_arch to get at
|
||||||
|
the current architecture by frame_info.
|
||||||
|
(i386_sigtramp_frame_cache, i386_get_longjmp_target)
|
||||||
|
(i386_register_to_value, i386_value_to_register): Likewise.
|
||||||
|
|
||||||
2007-10-09 Markus Deuling <deuling@de.ibm.com>
|
2007-10-09 Markus Deuling <deuling@de.ibm.com>
|
||||||
|
|
||||||
* monitor.c (monitor_supply_register): Use get_regcache_arch to get at
|
* monitor.c (monitor_supply_register): Use get_regcache_arch to get at
|
||||||
|
|
|
@ -161,7 +161,7 @@ fetch_register (struct regcache *regcache, int regno)
|
||||||
val = ptrace (PTRACE_PEEKUSER, tid, 4 * regmap[regno], 0);
|
val = ptrace (PTRACE_PEEKUSER, tid, 4 * regmap[regno], 0);
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
error (_("Couldn't read register %s (#%d): %s."),
|
error (_("Couldn't read register %s (#%d): %s."),
|
||||||
gdbarch_register_name (current_gdbarch, regno),
|
gdbarch_register_name (get_regcache_arch (regcache), regno),
|
||||||
regno, safe_strerror (errno));
|
regno, safe_strerror (errno));
|
||||||
|
|
||||||
regcache_raw_supply (regcache, regno, &val);
|
regcache_raw_supply (regcache, regno, &val);
|
||||||
|
@ -189,7 +189,7 @@ store_register (const struct regcache *regcache, int regno)
|
||||||
ptrace (PTRACE_POKEUSER, tid, 4 * regmap[regno], val);
|
ptrace (PTRACE_POKEUSER, tid, 4 * regmap[regno], val);
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
error (_("Couldn't write register %s (#%d): %s."),
|
error (_("Couldn't write register %s (#%d): %s."),
|
||||||
gdbarch_register_name (current_gdbarch, regno),
|
gdbarch_register_name (get_regcache_arch (regcache), regno),
|
||||||
regno, safe_strerror (errno));
|
regno, safe_strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,8 @@ supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
|
||||||
for (i = 0; i < I386_NUM_GREGS; i++)
|
for (i = 0; i < I386_NUM_GREGS; i++)
|
||||||
regcache_raw_supply (regcache, i, regp + regmap[i]);
|
regcache_raw_supply (regcache, i, regp + regmap[i]);
|
||||||
|
|
||||||
if (I386_LINUX_ORIG_EAX_REGNUM < gdbarch_num_regs (current_gdbarch))
|
if (I386_LINUX_ORIG_EAX_REGNUM
|
||||||
|
< gdbarch_num_regs (get_regcache_arch (regcache)))
|
||||||
regcache_raw_supply (regcache, I386_LINUX_ORIG_EAX_REGNUM,
|
regcache_raw_supply (regcache, I386_LINUX_ORIG_EAX_REGNUM,
|
||||||
regp + ORIG_EAX);
|
regp + ORIG_EAX);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +231,8 @@ fill_gregset (const struct regcache *regcache,
|
||||||
regcache_raw_collect (regcache, i, regp + regmap[i]);
|
regcache_raw_collect (regcache, i, regp + regmap[i]);
|
||||||
|
|
||||||
if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
|
if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
|
||||||
&& I386_LINUX_ORIG_EAX_REGNUM < gdbarch_num_regs (current_gdbarch))
|
&& I386_LINUX_ORIG_EAX_REGNUM
|
||||||
|
< gdbarch_num_regs (get_regcache_arch (regcache)))
|
||||||
regcache_raw_collect (regcache, I386_LINUX_ORIG_EAX_REGNUM,
|
regcache_raw_collect (regcache, I386_LINUX_ORIG_EAX_REGNUM,
|
||||||
regp + ORIG_EAX);
|
regp + ORIG_EAX);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +460,7 @@ i386_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < gdbarch_num_regs (current_gdbarch); i++)
|
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
|
||||||
if (regno == -1 || regno == i)
|
if (regno == -1 || regno == i)
|
||||||
fetch_register (regcache, i);
|
fetch_register (regcache, i);
|
||||||
|
|
||||||
|
@ -530,7 +532,7 @@ i386_linux_store_inferior_registers (struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < gdbarch_num_regs (current_gdbarch); i++)
|
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
|
||||||
if (regno == -1 || regno == i)
|
if (regno == -1 || regno == i)
|
||||||
store_register (regcache, i);
|
store_register (regcache, i);
|
||||||
|
|
||||||
|
@ -756,8 +758,8 @@ i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
|
||||||
|
|
||||||
request = PTRACE_SINGLESTEP;
|
request = PTRACE_SINGLESTEP;
|
||||||
|
|
||||||
regcache_cooked_read_unsigned (regcache,
|
regcache_cooked_read_unsigned
|
||||||
gdbarch_pc_regnum (current_gdbarch), &pc);
|
(regcache, gdbarch_pc_regnum (get_regcache_arch (regcache)), &pc);
|
||||||
|
|
||||||
/* Returning from a signal trampoline is done by calling a
|
/* Returning from a signal trampoline is done by calling a
|
||||||
special system call (sigreturn or rt_sigreturn, see
|
special system call (sigreturn or rt_sigreturn, see
|
||||||
|
|
|
@ -81,10 +81,11 @@ nto_reg_offset (int regnum)
|
||||||
static void
|
static void
|
||||||
i386nto_supply_gregset (struct regcache *regcache, char *gpregs)
|
i386nto_supply_gregset (struct regcache *regcache, char *gpregs)
|
||||||
{
|
{
|
||||||
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
|
||||||
if(tdep->gregset == NULL)
|
if(tdep->gregset == NULL)
|
||||||
tdep->gregset = regset_alloc (current_gdbarch, i386_supply_gregset,
|
tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset,
|
||||||
i386_collect_gregset);
|
i386_collect_gregset);
|
||||||
|
|
||||||
gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
|
gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
|
||||||
|
|
|
@ -912,7 +912,7 @@ i386_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||||
{
|
{
|
||||||
gdb_byte buf[8];
|
gdb_byte buf[8];
|
||||||
|
|
||||||
frame_unwind_register (next_frame, gdbarch_pc_regnum (current_gdbarch), buf);
|
frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
|
||||||
return extract_typed_address (buf, builtin_type_void_func_ptr);
|
return extract_typed_address (buf, builtin_type_void_func_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1098,7 +1098,7 @@ i386_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
||||||
{
|
{
|
||||||
/* Read the value in from memory. */
|
/* Read the value in from memory. */
|
||||||
read_memory (*addrp, valuep,
|
read_memory (*addrp, valuep,
|
||||||
register_size (current_gdbarch, regnum));
|
register_size (get_frame_arch (next_frame), regnum));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1131,7 +1131,7 @@ static struct i386_frame_cache *
|
||||||
i386_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
|
i386_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct i386_frame_cache *cache;
|
struct i386_frame_cache *cache;
|
||||||
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
gdb_byte buf[4];
|
gdb_byte buf[4];
|
||||||
|
|
||||||
|
@ -1278,7 +1278,7 @@ i386_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
|
||||||
|
|
||||||
/* Don't use I386_ESP_REGNUM here, since this function is also used
|
/* Don't use I386_ESP_REGNUM here, since this function is also used
|
||||||
for AMD64. */
|
for AMD64. */
|
||||||
get_frame_register (frame, gdbarch_sp_regnum (current_gdbarch), buf);
|
get_frame_register (frame, gdbarch_sp_regnum (get_frame_arch (frame)), buf);
|
||||||
sp = extract_typed_address (buf, builtin_type_void_data_ptr);
|
sp = extract_typed_address (buf, builtin_type_void_data_ptr);
|
||||||
if (target_read_memory (sp + len, buf, len))
|
if (target_read_memory (sp + len, buf, len))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1384,8 +1384,8 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int low_size = register_size (current_gdbarch, LOW_RETURN_REGNUM);
|
int low_size = register_size (gdbarch, LOW_RETURN_REGNUM);
|
||||||
int high_size = register_size (current_gdbarch, HIGH_RETURN_REGNUM);
|
int high_size = register_size (gdbarch, HIGH_RETURN_REGNUM);
|
||||||
|
|
||||||
if (len <= low_size)
|
if (len <= low_size)
|
||||||
{
|
{
|
||||||
|
@ -1456,8 +1456,8 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int low_size = register_size (current_gdbarch, LOW_RETURN_REGNUM);
|
int low_size = register_size (gdbarch, LOW_RETURN_REGNUM);
|
||||||
int high_size = register_size (current_gdbarch, HIGH_RETURN_REGNUM);
|
int high_size = register_size (gdbarch, HIGH_RETURN_REGNUM);
|
||||||
|
|
||||||
if (len <= low_size)
|
if (len <= low_size)
|
||||||
regcache_raw_write_part (regcache, LOW_RETURN_REGNUM, 0, len, valbuf);
|
regcache_raw_write_part (regcache, LOW_RETURN_REGNUM, 0, len, valbuf);
|
||||||
|
@ -1908,7 +1908,7 @@ i386_register_to_value (struct frame_info *frame, int regnum,
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
gdb_assert (regnum != -1);
|
gdb_assert (regnum != -1);
|
||||||
gdb_assert (register_size (current_gdbarch, regnum) == 4);
|
gdb_assert (register_size (get_frame_arch (frame), regnum) == 4);
|
||||||
|
|
||||||
get_frame_register (frame, regnum, to);
|
get_frame_register (frame, regnum, to);
|
||||||
regnum = i386_next_regnum (regnum);
|
regnum = i386_next_regnum (regnum);
|
||||||
|
@ -1939,7 +1939,7 @@ i386_value_to_register (struct frame_info *frame, int regnum,
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
{
|
{
|
||||||
gdb_assert (regnum != -1);
|
gdb_assert (regnum != -1);
|
||||||
gdb_assert (register_size (current_gdbarch, regnum) == 4);
|
gdb_assert (register_size (get_frame_arch (frame), regnum) == 4);
|
||||||
|
|
||||||
put_frame_register (frame, regnum, from);
|
put_frame_register (frame, regnum, from);
|
||||||
regnum = i386_next_regnum (regnum);
|
regnum = i386_next_regnum (regnum);
|
||||||
|
|
|
@ -149,7 +149,8 @@ gnu_fetch_registers (struct regcache *regcache, int regno)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
proc_debug (thread, "fetching register %s",
|
proc_debug (thread, "fetching register %s",
|
||||||
gdbarch_register_name (current_gdbarch, regno));
|
gdbarch_register_name (get_regcache_arch (regcache),
|
||||||
|
regno));
|
||||||
|
|
||||||
regcache_raw_supply (regcache, regno,
|
regcache_raw_supply (regcache, regno,
|
||||||
REG_ADDR (state, regno));
|
REG_ADDR (state, regno));
|
||||||
|
@ -203,6 +204,7 @@ void
|
||||||
gnu_store_registers (struct regcache *regcache, int regno)
|
gnu_store_registers (struct regcache *regcache, int regno)
|
||||||
{
|
{
|
||||||
struct proc *thread;
|
struct proc *thread;
|
||||||
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||||
|
|
||||||
/* Make sure we know about new threads. */
|
/* Make sure we know about new threads. */
|
||||||
inf_update_procs (current_inferior);
|
inf_update_procs (current_inferior);
|
||||||
|
@ -243,11 +245,11 @@ gnu_store_registers (struct regcache *regcache, int regno)
|
||||||
if ((thread->fetched_regs & (1 << check_regno))
|
if ((thread->fetched_regs & (1 << check_regno))
|
||||||
&& memcpy (REG_ADDR (&old_state, check_regno),
|
&& memcpy (REG_ADDR (&old_state, check_regno),
|
||||||
REG_ADDR (state, check_regno),
|
REG_ADDR (state, check_regno),
|
||||||
register_size (current_gdbarch, check_regno)))
|
register_size (gdbarch, check_regno)))
|
||||||
/* Register CHECK_REGNO has changed! Ack! */
|
/* Register CHECK_REGNO has changed! Ack! */
|
||||||
{
|
{
|
||||||
warning (_("Register %s changed after the thread was aborted"),
|
warning (_("Register %s changed after the thread was aborted"),
|
||||||
gdbarch_register_name (current_gdbarch, check_regno));
|
gdbarch_register_name (gdbarch, check_regno));
|
||||||
if (regno >= 0 && regno != check_regno)
|
if (regno >= 0 && regno != check_regno)
|
||||||
/* Update GDB's copy of the register. */
|
/* Update GDB's copy of the register. */
|
||||||
regcache_raw_supply (regcache, check_regno,
|
regcache_raw_supply (regcache, check_regno,
|
||||||
|
@ -270,7 +272,7 @@ gnu_store_registers (struct regcache *regcache, int regno)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
proc_debug (thread, "storing register %s",
|
proc_debug (thread, "storing register %s",
|
||||||
gdbarch_register_name (current_gdbarch, regno));
|
gdbarch_register_name (gdbarch, regno));
|
||||||
|
|
||||||
gdb_assert (regcache_valid_p (regcache, regno));
|
gdb_assert (regcache_valid_p (regcache, regno));
|
||||||
regcache_raw_collect (regcache, regno, REG_ADDR (state, regno));
|
regcache_raw_collect (regcache, regno, REG_ADDR (state, regno));
|
||||||
|
|
|
@ -137,7 +137,7 @@ fill_gregset (const struct regcache *regcache,
|
||||||
void
|
void
|
||||||
supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
|
supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
|
||||||
{
|
{
|
||||||
if (gdbarch_fp0_regnum (current_gdbarch) == 0)
|
if (gdbarch_fp0_regnum (get_regcache_arch (regcache)) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
i387_supply_fsave (regcache, -1, fpregsetp);
|
i387_supply_fsave (regcache, -1, fpregsetp);
|
||||||
|
@ -151,7 +151,7 @@ void
|
||||||
fill_fpregset (const struct regcache *regcache,
|
fill_fpregset (const struct regcache *regcache,
|
||||||
fpregset_t *fpregsetp, int regno)
|
fpregset_t *fpregsetp, int regno)
|
||||||
{
|
{
|
||||||
if (gdbarch_fp0_regnum (current_gdbarch) == 0)
|
if (gdbarch_fp0_regnum (get_regcache_arch (regcache)) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
i387_collect_fsave (regcache, regno, fpregsetp);
|
i387_collect_fsave (regcache, regno, fpregsetp);
|
||||||
|
|
Loading…
Reference in New Issue