+2007-11-16 Markus Deuling <deuling@de.ibm.com>
+
+ * m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
+ the current architecture by regcache.
+ * ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
+ * ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
+ (fetch_register, supply_vrregset, fetch_ppc_registers)
+ (store_altivec_register, store_spe_register, store_register)
+ (fill_vrregset, store_ppc_registers): Likewise.
+ * ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
+ * win32-nat.c (do_win32_fetch_inferior_registers)
+ (do_win32_store_inferior_registers): Likewise.
+ * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
+ * remote-m32r-sdi.c (m32r_fetch_registers)
+ (m32r_store_registers): Likewise.
+ * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
+
+ * trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
+ gdbarch.
+ * user-regs.c (user_reg_map_name_to_regnum): Likewise.
+ * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
+ (do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
+ (ppc64_sysv_abi_return_value): Likewise.
+ * m32c-tdep.c (m32c_register_reggroup_p): Likewise.
+ * m2-lang.c (build_m2_types): Likewise.
+ * ppc-linux-tdep.c (ppc_linux_sigtramp_cache
+ * ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
+ * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
+ * rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
+
+ * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
+ get at the current architecture by frame_info.
+ * gcore.c (derive_stack_segment): Likewise.
+
+ * shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
+ (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
+ gdbarch to GETREGS_SUPPLIES call.
+
2007-11-16 Ulrich Weigand <uweigand@de.ibm.com>
* elfread.c (ST_REGULAR, ST_DYNAMIC, ST_SYNTHETIC): New defines.
/* Save frame pointer of TOS frame. */
*top = get_frame_base (fi);
/* If current stack pointer is more "inner", use that instead. */
- if (gdbarch_inner_than (current_gdbarch, get_frame_sp (fi), *top))
+ if (gdbarch_inner_than (get_frame_arch (fi), get_frame_sp (fi), *top))
*top = get_frame_sp (fi);
/* Find prev-most frame. */
/* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */
builtin_m2_type->builtin_int =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ init_type (TYPE_CODE_INT,
+ gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
0, "INTEGER", (struct objfile *) NULL);
builtin_m2_type->builtin_card =
init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"CARDINAL", (struct objfile *) NULL);
builtin_m2_type->builtin_real =
init_type (TYPE_CODE_FLT,
- gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
0,
"REAL", (struct objfile *) NULL);
builtin_m2_type->builtin_char =
"CHAR", (struct objfile *) NULL);
builtin_m2_type->builtin_bool =
init_type (TYPE_CODE_BOOL,
- gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+ gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"BOOLEAN", (struct objfile *) NULL);
m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct m32c_reg *reg = &tdep->regs[regnum];
/* The anonymous raw registers aren't in any groups. */
{
int regno;
int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
for (regno = 0; regno < num_regs; regno++)
if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0)
if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
monitor_supply_register (regcache,
- gdbarch_sp_regnum (current_gdbarch), val);
+ gdbarch_sp_regnum (gdbarch), val);
else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
monitor_supply_register (regcache,
- gdbarch_sp_regnum (current_gdbarch), val);
+ gdbarch_sp_regnum (gdbarch), val);
}
}
}
int ret;
int offset = 0;
gdb_vrregset_t regs;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s);
if (ret < 0)
vector. VRSAVE is at the end of the array in a 4 bytes slot, so
there is no need to define an offset for it. */
if (regno == (tdep->ppc_vrsave_regnum - 1))
- offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
regcache_raw_supply (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
static void
fetch_spe_register (struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0])
- == register_size (current_gdbarch, tdep->ppc_ev0_upper_regnum));
+ == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
gdb_assert (sizeof (evrregs.acc)
- == register_size (current_gdbarch, tdep->ppc_acc_regnum));
+ == register_size (gdbarch, tdep->ppc_acc_regnum));
gdb_assert (sizeof (evrregs.spefscr)
- == register_size (current_gdbarch, tdep->ppc_spefscr_regnum));
+ == register_size (gdbarch, tdep->ppc_spefscr_regnum));
get_spe_registers (tid, &evrregs);
static void
fetch_register (struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr = ppc_register_u_addr (regno);
int bytes_transferred;
if (regaddr == -1)
{
- memset (buf, '\0', register_size (current_gdbarch, regno)); /* Supply zeroes */
+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
regcache_raw_supply (regcache, regno, buf);
return;
}
32-bit platform, 64-bit floating-point registers will require two
transfers. */
for (bytes_transferred = 0;
- bytes_transferred < register_size (current_gdbarch, regno);
+ bytes_transferred < register_size (gdbarch, regno);
bytes_transferred += sizeof (long))
{
errno = 0;
{
char message[128];
sprintf (message, "reading register %s (#%d)",
- gdbarch_register_name (current_gdbarch, regno), regno);
+ gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message);
}
}
/* Now supply the register. Keep in mind that the regcache's idea
of the register's size may not be a multiple of sizeof
(long). */
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
{
/* Little-endian values are always found at the left end of the
bytes transferred. */
regcache_raw_supply (regcache, regno, buf);
}
- else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
/* Big-endian values are found at the right end of the bytes
transferred. */
- size_t padding = (bytes_transferred
- - register_size (current_gdbarch, regno));
+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
regcache_raw_supply (regcache, regno, buf + padding);
}
else
internal_error (__FILE__, __LINE__,
_("fetch_register: unexpected byte order: %d"),
- gdbarch_byte_order (current_gdbarch));
+ gdbarch_byte_order (gdbarch));
}
static void
supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
- int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
+ int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
for (i = 0; i < num_of_vrregs; i++)
{
fetch_ppc_registers (struct regcache *regcache, int tid)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
for (i = 0; i < ppc_num_gprs; i++)
fetch_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
fetch_register (regcache, tid, tdep->ppc_fp0_regnum + i);
- fetch_register (regcache, tid, gdbarch_pc_regnum (current_gdbarch));
+ fetch_register (regcache, tid, gdbarch_pc_regnum (gdbarch));
if (tdep->ppc_ps_regnum != -1)
fetch_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1)
int ret;
int offset = 0;
gdb_vrregset_t regs;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s);
if (ret < 0)
/* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes
long on the hardware. */
if (regno == (tdep->ppc_vrsave_regnum - 1))
- offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
regcache_raw_collect (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
static void
store_spe_register (const struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0])
- == register_size (current_gdbarch, tdep->ppc_ev0_upper_regnum));
+ == register_size (gdbarch, tdep->ppc_ev0_upper_regnum));
gdb_assert (sizeof (evrregs.acc)
- == register_size (current_gdbarch, tdep->ppc_acc_regnum));
+ == register_size (gdbarch, tdep->ppc_acc_regnum));
gdb_assert (sizeof (evrregs.spefscr)
- == register_size (current_gdbarch, tdep->ppc_spefscr_regnum));
+ == register_size (gdbarch, tdep->ppc_spefscr_regnum));
if (regno == -1)
/* Since we're going to write out every register, the code below
static void
store_register (const struct regcache *regcache, int tid, int regno)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr = ppc_register_u_addr (regno);
int i;
idea of the register's size may not be a multiple of sizeof
(long). */
memset (buf, 0, sizeof buf);
- bytes_to_transfer = align_up (register_size (current_gdbarch, regno),
- sizeof (long));
- if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
{
/* Little-endian values always sit at the left end of the buffer. */
regcache_raw_collect (regcache, regno, buf);
}
- else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
/* Big-endian values sit at the right end of the buffer. */
- size_t padding = (bytes_to_transfer
- - register_size (current_gdbarch, regno));
+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
regcache_raw_collect (regcache, regno, buf + padding);
}
{
char message[128];
sprintf (message, "writing register %s (#%d)",
- gdbarch_register_name (current_gdbarch, regno), regno);
+ gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message);
}
}
fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
- int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum);
- int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum);
+ int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
+ int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
for (i = 0; i < num_of_vrregs; i++)
{
store_ppc_registers (const struct regcache *regcache, int tid)
{
int i;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
for (i = 0; i < ppc_num_gprs; i++)
store_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
store_register (regcache, tid, tdep->ppc_fp0_regnum + i);
- store_register (regcache, tid, gdbarch_pc_regnum (current_gdbarch));
+ store_register (regcache, tid, gdbarch_pc_regnum (gdbarch));
if (tdep->ppc_ps_regnum != -1)
store_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
base = frame_unwind_register_unsigned (next_frame,
- gdbarch_sp_regnum (current_gdbarch));
+ gdbarch_sp_regnum (gdbarch));
if (bias > 0 && frame_pc_unwind (next_frame) != func)
/* See below, some signal trampolines increment the stack as their
first instruction, need to compensate for that. */
trad_frame_set_reg_addr (this_cache, regnum, gpregs + i * tdep->wordsize);
}
trad_frame_set_reg_addr (this_cache,
- gdbarch_pc_regnum (current_gdbarch),
+ gdbarch_pc_regnum (gdbarch),
gpregs + 32 * tdep->wordsize);
trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum,
gpregs + 35 * tdep->wordsize);
/* Floating point registers. */
for (i = 0; i < 32; i++)
{
- int regnum = i + gdbarch_fp0_regnum (current_gdbarch);
+ int regnum = i + gdbarch_fp0_regnum (gdbarch);
trad_frame_set_reg_addr (this_cache, regnum,
fpregs + i * tdep->wordsize);
}
int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ULONGEST saved_sp;
int argspace = 0; /* 0 is an initial wrong guess. */
int write_pass;
gdb_assert (tdep->wordsize == 4);
- regcache_cooked_read_unsigned (regcache,
- gdbarch_sp_regnum (current_gdbarch),
+ regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
&saved_sp);
/* Go through the argument list twice.
else if (TYPE_CODE (type) == TYPE_CODE_FLT
&& len == 16
&& !tdep->soft_float
- && (gdbarch_long_double_format (current_gdbarch)
+ && (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
/* IBM long double passed in two FP registers if
}
}
else if (len == 16 && TYPE_CODE (type) == TYPE_CODE_FLT
- && (gdbarch_long_double_format (current_gdbarch)
+ && (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
/* Soft-float IBM long double passed in four consecutive
}
/* Update %sp. */
- regcache_cooked_write_signed (regcache,
- gdbarch_sp_regnum (current_gdbarch), sp);
+ regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
/* Write the backchain (it occupies WORDSIZED bytes). */
write_memory_signed_integer (sp, tdep->wordsize, saved_sp);
if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16
&& !tdep->soft_float
- && (gdbarch_long_double_format (current_gdbarch)
- == floatformats_ibm_long_double))
+ && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
{
/* IBM long double stored in f1 and f2. */
if (readbuf)
}
if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16
- && (gdbarch_long_double_format (current_gdbarch)
- == floatformats_ibm_long_double))
+ && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
{
/* Soft-float IBM long double stored in r3, r4, r5, r6. */
if (readbuf)
int struct_return, CORE_ADDR struct_addr)
{
CORE_ADDR func_addr = find_function_addr (function, NULL);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ULONGEST back_chain;
/* See for-loop comment below. */
int write_pass;
/* By this stage in the proceedings, SP has been decremented by "red
zone size" + "struct return size". Fetch the stack-pointer from
before this and use that as the BACK_CHAIN. */
- regcache_cooked_read_unsigned (regcache,
- gdbarch_sp_regnum (current_gdbarch),
+ regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
&back_chain);
/* Go through the argument list twice.
}
else if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16
- && (gdbarch_long_double_format (current_gdbarch)
+ && (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
/* IBM long double stored in two doublewords of the
freg++;
}
else if (TYPE_LENGTH (type) == 16
- && (gdbarch_long_double_format (current_gdbarch)
+ && (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
if (write_pass)
}
/* Update %sp. */
- regcache_cooked_write_signed (regcache,
- gdbarch_sp_regnum (current_gdbarch), sp);
+ regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
/* Write the backchain (it occupies WORDSIZED bytes). */
write_memory_signed_integer (sp, tdep->wordsize, back_chain);
{
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype =
- register_type (current_gdbarch, tdep->ppc_fp0_regnum);
+ register_type (gdbarch, tdep->ppc_fp0_regnum);
if (writebuf != NULL)
{
convert_typed_floating ((const bfd_byte *) writebuf +
{
struct switchframe sf;
struct callframe cf;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int i;
/* The stack pointer shouldn't be zero. */
read_memory(cf.sp, (gdb_byte *)&cf, sizeof(cf));
regcache_raw_supply (regcache, tdep->ppc_lr_regnum, &cf.lr);
- regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), &cf.lr);
+ regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &cf.lr);
return 1;
}
int i;
base = frame_unwind_register_unsigned (next_frame,
- gdbarch_sp_regnum (current_gdbarch));
+ gdbarch_sp_regnum (gdbarch));
if (self == &ppcnbsd2_sigtramp)
addr = base + 0x10 + 2 * tdep->wordsize;
else
addr += tdep->wordsize;
trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, addr);
addr += tdep->wordsize;
- trad_frame_set_reg_addr (this_cache,
- gdbarch_pc_regnum (current_gdbarch),
+ trad_frame_set_reg_addr (this_cache, gdbarch_pc_regnum (gdbarch),
addr); /* SRR0? */
addr += tdep->wordsize;
static int
ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct switchframe sf;
struct callframe cf;
int i, regnum;
return 0;
read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf);
- regcache_raw_supply (regcache, gdbarch_sp_regnum (current_gdbarch), &sf.sp);
+ regcache_raw_supply (regcache, gdbarch_sp_regnum (gdbarch), &sf.sp);
regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.cr);
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
for (i = 0, regnum = tdep->ppc_gp0_regnum + 13; i < 19; i++, regnum++)
regcache_raw_supply (regcache, regnum, &sf.fixreg[i]);
read_memory (sf.sp, (gdb_byte *)&cf, sizeof cf);
- regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), &cf.lr);
+ regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &cf.lr);
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.r30);
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31);
sigcontext_offset = (0x10000 - (insn & 0x0000ffff)) + 8;
base = frame_unwind_register_unsigned (next_frame,
- gdbarch_sp_regnum (current_gdbarch));
+ gdbarch_sp_regnum (gdbarch));
addr = base + sigcontext_offset + 2 * tdep->wordsize;
for (i = 0; i < ppc_num_gprs; i++, addr += tdep->wordsize)
{
addr += tdep->wordsize;
trad_frame_set_reg_addr (cache, tdep->ppc_ctr_regnum, addr);
addr += tdep->wordsize;
- trad_frame_set_reg_addr (cache, gdbarch_pc_regnum (current_gdbarch), addr);
+ trad_frame_set_reg_addr (cache, gdbarch_pc_regnum (gdbarch), addr);
/* SRR0? */
addr += tdep->wordsize;
procinfo *pi;
int pid = PIDGET (inferior_ptid);
int tid = TIDGET (inferior_ptid);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* First look up procinfo for the main process. */
pi = find_procinfo_or_die (pid, 0);
supply_gregset (regcache, (const gdb_gregset_t *) gregs);
- if (gdbarch_fp0_regnum (current_gdbarch) >= 0) /* Do we have an FPU? */
+ if (gdbarch_fp0_regnum (gdbarch) >= 0) /* Do we have an FPU? */
{
gdb_fpregset_t *fpregs;
- if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (current_gdbarch))
- || regnum == gdbarch_pc_regnum (current_gdbarch)
- || regnum == gdbarch_sp_regnum (current_gdbarch))
+ if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch))
+ || regnum == gdbarch_pc_regnum (gdbarch)
+ || regnum == gdbarch_sp_regnum (gdbarch))
return; /* Not a floating point register. */
fpregs = proc_get_fpregs (pi);
procinfo *pi;
int pid = PIDGET (inferior_ptid);
int tid = TIDGET (inferior_ptid);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* First find procinfo for main process. */
pi = find_procinfo_or_die (pid, 0);
if (!proc_set_gregs (pi))
proc_error (pi, "store_registers, set_gregs", __LINE__);
- if (gdbarch_fp0_regnum (current_gdbarch) >= 0) /* Do we have an FPU? */
+ if (gdbarch_fp0_regnum (gdbarch) >= 0) /* Do we have an FPU? */
{
gdb_fpregset_t *fpregs;
- if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (current_gdbarch))
- || regnum == gdbarch_pc_regnum (current_gdbarch)
- || regnum == gdbarch_sp_regnum (current_gdbarch))
+ if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch))
+ || regnum == gdbarch_pc_regnum (gdbarch)
+ || regnum == gdbarch_sp_regnum (gdbarch))
return; /* Not a floating point register. */
fpregs = proc_get_fpregs (pi);
{
int regno;
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0;
+ regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
m32r_fetch_register (regcache, regno);
}
{
int regno;
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0;
+ regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno++)
m32r_store_register (regcache, regno);
registers_changed ();
static void
gdbsim_fetch_register (struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno == -1)
{
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
gdbsim_fetch_register (regcache, regno);
return;
}
- switch (gdbarch_register_sim_regno (current_gdbarch, regno))
+ switch (gdbarch_register_sim_regno (gdbarch, regno))
{
case LEGACY_SIM_REGNO_IGNORE:
break;
static int warn_user = 1;
char buf[MAX_REGISTER_SIZE];
int nr_bytes;
- gdb_assert (regno >= 0 && regno < gdbarch_num_regs (current_gdbarch));
+ gdb_assert (regno >= 0 && regno < gdbarch_num_regs (gdbarch));
memset (buf, 0, MAX_REGISTER_SIZE);
nr_bytes = sim_fetch_register (gdbsim_desc,
gdbarch_register_sim_regno
- (current_gdbarch, regno),
+ (gdbarch, regno),
buf,
- register_size (current_gdbarch, regno));
- if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno) && warn_user)
+ register_size (gdbarch, regno));
+ if (nr_bytes > 0
+ && nr_bytes != register_size (gdbarch, regno) && warn_user)
{
fprintf_unfiltered (gdb_stderr,
"Size of register %s (%d/%d) incorrect (%d instead of %d))",
- gdbarch_register_name (current_gdbarch, regno),
+ gdbarch_register_name (gdbarch, regno),
regno,
gdbarch_register_sim_regno
- (current_gdbarch, regno),
- nr_bytes, register_size (current_gdbarch, regno));
+ (gdbarch, regno),
+ nr_bytes, register_size (gdbarch, regno));
warn_user = 0;
}
/* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
{
printf_filtered ("gdbsim_fetch_register: %d", regno);
/* FIXME: We could print something more intelligible. */
- dump_mem (buf, register_size (current_gdbarch, regno));
+ dump_mem (buf, register_size (gdbarch, regno));
}
break;
}
static void
gdbsim_store_register (struct regcache *regcache, int regno)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno == -1)
{
- for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+ for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
gdbsim_store_register (regcache, regno);
return;
}
- else if (gdbarch_register_sim_regno (current_gdbarch, regno) >= 0)
+ else if (gdbarch_register_sim_regno (gdbarch, regno) >= 0)
{
char tmp[MAX_REGISTER_SIZE];
int nr_bytes;
regcache_cooked_read (regcache, regno, tmp);
nr_bytes = sim_store_register (gdbsim_desc,
gdbarch_register_sim_regno
- (current_gdbarch, regno),
- tmp, register_size (current_gdbarch, regno));
- if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno))
+ (gdbarch, regno),
+ tmp, register_size (gdbarch, regno));
+ if (nr_bytes > 0 && nr_bytes != register_size (gdbarch, regno))
internal_error (__FILE__, __LINE__,
_("Register size different to expected"));
/* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
{
printf_filtered ("gdbsim_store_register: %d", regno);
/* FIXME: We could print something more intelligible. */
- dump_mem (tmp, register_size (current_gdbarch, regno));
+ dump_mem (tmp, register_size (gdbarch, regno));
}
}
}
}
/* Handle PC register and Stack Pointer correctly. */
- if (regnum == gdbarch_pc_regnum (current_gdbarch))
+ if (regnum == gdbarch_pc_regnum (gdbarch))
reg->how = DWARF2_FRAME_REG_RA;
- else if (regnum == gdbarch_sp_regnum (current_gdbarch))
+ else if (regnum == gdbarch_sp_regnum (gdbarch))
reg->how = DWARF2_FRAME_REG_CFA;
}
/* Determine if PT_GETREGS fetches this register. */
-#define GETREGS_SUPPLIES(regno) \
+#define GETREGS_SUPPLIES(gdbarch, regno) \
(((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \
-|| (regno) == gdbarch_pc_regnum (current_gdbarch) || (regno) == PR_REGNUM \
+|| (regno) == gdbarch_pc_regnum (gdbarch) || (regno) == PR_REGNUM \
|| (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \
|| (regno) == SR_REGNUM)
static void
shnbsd_fetch_inferior_registers (struct regcache *regcache, int regno)
{
- if (regno == -1 || GETREGS_SUPPLIES (regno))
+ if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
{
struct reg inferior_registers;
static void
shnbsd_store_inferior_registers (struct regcache *regcache, int regno)
{
- if (regno == -1 || GETREGS_SUPPLIES (regno))
+ if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
{
struct reg inferior_registers;
{
int regnum;
struct gdbarch *gdbarch = get_frame_arch (next_frame);
- int numregs = gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch);
+ int numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
struct trad_frame_saved_reg *this_saved_regs
= FRAME_OBSTACK_CALLOC (numregs, struct trad_frame_saved_reg);
for (regnum = 0; regnum < numregs; regnum++)
if ((len < 0 && strcmp (reg->name, name))
|| (len == strlen (reg->name)
&& strncmp (reg->name, name, len) == 0))
- return gdbarch_num_regs (current_gdbarch)
- + gdbarch_num_pseudo_regs (current_gdbarch) + nr;
+ return gdbarch_num_regs (gdbarch)
+ + gdbarch_num_pseudo_regs (gdbarch) + nr;
}
}
regcache_raw_supply (regcache, r, context_offset);
else
{
- for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
+ for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++)
do_win32_fetch_inferior_registers (regcache, r);
}
((char *) ¤t_thread->context) + mappings[r]);
else
{
- for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
+ for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++)
do_win32_store_inferior_registers (regcache, r);
}
}
regcache_raw_supply (regcache, r, context_offset);
else
{
- for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
+ for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++)
do_win32_fetch_inferior_registers (regcache, r);
}
((char *) ¤t_thread->context) + mappings[r]);
else
{
- for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
+ for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++)
do_win32_store_inferior_registers (regcache, r);
}
}