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.
This commit is contained in:
Markus Deuling
2007-11-16 04:53:46 +00:00
parent 49f964133f
commit 40a6adc1f8
21 changed files with 171 additions and 122 deletions

View File

@ -1,3 +1,41 @@
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> 2007-11-16 Ulrich Weigand <uweigand@de.ibm.com>
* elfread.c (ST_REGULAR, ST_DYNAMIC, ST_SYNTHETIC): New defines. * elfread.c (ST_REGULAR, ST_DYNAMIC, ST_SYNTHETIC): New defines.

View File

@ -184,7 +184,7 @@ derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
/* Save frame pointer of TOS frame. */ /* Save frame pointer of TOS frame. */
*top = get_frame_base (fi); *top = get_frame_base (fi);
/* If current stack pointer is more "inner", use that instead. */ /* 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); *top = get_frame_sp (fi);
/* Find prev-most frame. */ /* Find prev-most frame. */

View File

@ -569,16 +569,16 @@ build_m2_types (struct gdbarch *gdbarch)
/* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */ /* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */
builtin_m2_type->builtin_int = builtin_m2_type->builtin_int =
init_type (TYPE_CODE_INT, init_type (TYPE_CODE_INT,
gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
0, "INTEGER", (struct objfile *) NULL); 0, "INTEGER", (struct objfile *) NULL);
builtin_m2_type->builtin_card = builtin_m2_type->builtin_card =
init_type (TYPE_CODE_INT, init_type (TYPE_CODE_INT,
gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, TYPE_FLAG_UNSIGNED,
"CARDINAL", (struct objfile *) NULL); "CARDINAL", (struct objfile *) NULL);
builtin_m2_type->builtin_real = builtin_m2_type->builtin_real =
init_type (TYPE_CODE_FLT, init_type (TYPE_CODE_FLT,
gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
0, 0,
"REAL", (struct objfile *) NULL); "REAL", (struct objfile *) NULL);
builtin_m2_type->builtin_char = builtin_m2_type->builtin_char =
@ -587,7 +587,7 @@ build_m2_types (struct gdbarch *gdbarch)
"CHAR", (struct objfile *) NULL); "CHAR", (struct objfile *) NULL);
builtin_m2_type->builtin_bool = builtin_m2_type->builtin_bool =
init_type (TYPE_CODE_BOOL, init_type (TYPE_CODE_BOOL,
gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, TYPE_FLAG_UNSIGNED,
"BOOLEAN", (struct objfile *) NULL); "BOOLEAN", (struct objfile *) NULL);

View File

@ -265,7 +265,7 @@ int
m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum, m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group) 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]; struct m32c_reg *reg = &tdep->regs[regnum];
/* The anonymous raw registers aren't in any groups. */ /* The anonymous raw registers aren't in any groups. */

View File

@ -213,6 +213,7 @@ m32r_supply_register (struct regcache *regcache, char *regname,
{ {
int regno; int regno;
int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]); int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
for (regno = 0; regno < num_regs; regno++) for (regno = 0; regno < num_regs; regno++)
if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0) if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0)
@ -275,10 +276,10 @@ m32r_supply_register (struct regcache *regcache, char *regname,
if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */ if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
monitor_supply_register (regcache, monitor_supply_register (regcache,
gdbarch_sp_regnum (current_gdbarch), val); gdbarch_sp_regnum (gdbarch), val);
else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */ else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
monitor_supply_register (regcache, monitor_supply_register (regcache,
gdbarch_sp_regnum (current_gdbarch), val); gdbarch_sp_regnum (gdbarch), val);
} }
} }
} }

View File

@ -227,8 +227,9 @@ fetch_altivec_register (struct regcache *regcache, int tid, int regno)
int ret; int ret;
int offset = 0; int offset = 0;
gdb_vrregset_t regs; gdb_vrregset_t regs;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); struct gdbarch *gdbarch = get_regcache_arch (regcache);
int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
ret = ptrace (PTRACE_GETVRREGS, tid, 0, &regs); ret = ptrace (PTRACE_GETVRREGS, tid, 0, &regs);
if (ret < 0) if (ret < 0)
@ -246,7 +247,7 @@ fetch_altivec_register (struct regcache *regcache, int tid, int regno)
vector. VRSAVE is at the end of the array in a 4 bytes slot, so 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. */ there is no need to define an offset for it. */
if (regno == (tdep->ppc_vrsave_regnum - 1)) 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, regcache_raw_supply (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
@ -289,15 +290,16 @@ get_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
static void static void
fetch_spe_register (struct regcache *regcache, int tid, int regno) 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; struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0]) 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) 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) 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); get_spe_registers (tid, &evrregs);
@ -327,7 +329,8 @@ fetch_spe_register (struct regcache *regcache, int tid, int regno)
static void static void
fetch_register (struct regcache *regcache, int tid, int regno) 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. */ /* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr = ppc_register_u_addr (regno); CORE_ADDR regaddr = ppc_register_u_addr (regno);
int bytes_transferred; int bytes_transferred;
@ -357,7 +360,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
if (regaddr == -1) 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); regcache_raw_supply (regcache, regno, buf);
return; return;
} }
@ -366,7 +369,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
32-bit platform, 64-bit floating-point registers will require two 32-bit platform, 64-bit floating-point registers will require two
transfers. */ transfers. */
for (bytes_transferred = 0; for (bytes_transferred = 0;
bytes_transferred < register_size (current_gdbarch, regno); bytes_transferred < register_size (gdbarch, regno);
bytes_transferred += sizeof (long)) bytes_transferred += sizeof (long))
{ {
errno = 0; errno = 0;
@ -377,7 +380,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{ {
char message[128]; char message[128];
sprintf (message, "reading register %s (#%d)", sprintf (message, "reading register %s (#%d)",
gdbarch_register_name (current_gdbarch, regno), regno); gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message); perror_with_name (message);
} }
} }
@ -385,34 +388,34 @@ fetch_register (struct regcache *regcache, int tid, int regno)
/* Now supply the register. Keep in mind that the regcache's idea /* Now supply the register. Keep in mind that the regcache's idea
of the register's size may not be a multiple of sizeof of the register's size may not be a multiple of sizeof
(long). */ (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 /* Little-endian values are always found at the left end of the
bytes transferred. */ bytes transferred. */
regcache_raw_supply (regcache, regno, buf); 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 /* Big-endian values are found at the right end of the bytes
transferred. */ transferred. */
size_t padding = (bytes_transferred size_t padding = (bytes_transferred - register_size (gdbarch, regno));
- register_size (current_gdbarch, regno));
regcache_raw_supply (regcache, regno, buf + padding); regcache_raw_supply (regcache, regno, buf + padding);
} }
else else
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
_("fetch_register: unexpected byte order: %d"), _("fetch_register: unexpected byte order: %d"),
gdbarch_byte_order (current_gdbarch)); gdbarch_byte_order (gdbarch));
} }
static void static void
supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp) supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{ {
int i; 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 num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum); int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
for (i = 0; i < num_of_vrregs; i++) for (i = 0; i < num_of_vrregs; i++)
{ {
@ -452,14 +455,15 @@ static void
fetch_ppc_registers (struct regcache *regcache, int tid) fetch_ppc_registers (struct regcache *regcache, int tid)
{ {
int i; 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++) for (i = 0; i < ppc_num_gprs; i++)
fetch_register (regcache, tid, tdep->ppc_gp0_regnum + i); fetch_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0) if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++) for (i = 0; i < ppc_num_fprs; i++)
fetch_register (regcache, tid, tdep->ppc_fp0_regnum + 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) if (tdep->ppc_ps_regnum != -1)
fetch_register (regcache, tid, tdep->ppc_ps_regnum); fetch_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1) if (tdep->ppc_cr_regnum != -1)
@ -507,8 +511,9 @@ store_altivec_register (const struct regcache *regcache, int tid, int regno)
int ret; int ret;
int offset = 0; int offset = 0;
gdb_vrregset_t regs; gdb_vrregset_t regs;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); struct gdbarch *gdbarch = get_regcache_arch (regcache);
int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
ret = ptrace (PTRACE_GETVRREGS, tid, 0, &regs); ret = ptrace (PTRACE_GETVRREGS, tid, 0, &regs);
if (ret < 0) if (ret < 0)
@ -524,7 +529,7 @@ store_altivec_register (const struct regcache *regcache, int tid, int regno)
/* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes /* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes
long on the hardware. */ long on the hardware. */
if (regno == (tdep->ppc_vrsave_regnum - 1)) 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, regcache_raw_collect (regcache, regno,
regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset);
@ -569,15 +574,16 @@ set_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
static void static void
store_spe_register (const struct regcache *regcache, int tid, int regno) 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; struct gdb_evrregset_t evrregs;
gdb_assert (sizeof (evrregs.evr[0]) 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) 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) gdb_assert (sizeof (evrregs.spefscr)
== register_size (current_gdbarch, tdep->ppc_spefscr_regnum)); == register_size (gdbarch, tdep->ppc_spefscr_regnum));
if (regno == -1) if (regno == -1)
/* Since we're going to write out every register, the code below /* Since we're going to write out every register, the code below
@ -623,7 +629,8 @@ store_spe_register (const struct regcache *regcache, int tid, int regno)
static void static void
store_register (const struct regcache *regcache, int tid, int regno) 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. */ /* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr = ppc_register_u_addr (regno); CORE_ADDR regaddr = ppc_register_u_addr (regno);
int i; int i;
@ -648,18 +655,16 @@ store_register (const struct regcache *regcache, int tid, int regno)
idea of the register's size may not be a multiple of sizeof idea of the register's size may not be a multiple of sizeof
(long). */ (long). */
memset (buf, 0, sizeof buf); memset (buf, 0, sizeof buf);
bytes_to_transfer = align_up (register_size (current_gdbarch, regno), bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
sizeof (long)); if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
{ {
/* Little-endian values always sit at the left end of the buffer. */ /* Little-endian values always sit at the left end of the buffer. */
regcache_raw_collect (regcache, regno, buf); 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. */ /* Big-endian values sit at the right end of the buffer. */
size_t padding = (bytes_to_transfer size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
- register_size (current_gdbarch, regno));
regcache_raw_collect (regcache, regno, buf + padding); regcache_raw_collect (regcache, regno, buf + padding);
} }
@ -681,7 +686,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
{ {
char message[128]; char message[128];
sprintf (message, "writing register %s (#%d)", sprintf (message, "writing register %s (#%d)",
gdbarch_register_name (current_gdbarch, regno), regno); gdbarch_register_name (gdbarch, regno), regno);
perror_with_name (message); perror_with_name (message);
} }
} }
@ -691,10 +696,11 @@ static void
fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp) fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp)
{ {
int i; 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 num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum);
int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum); int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum);
for (i = 0; i < num_of_vrregs; i++) for (i = 0; i < num_of_vrregs; i++)
{ {
@ -736,14 +742,15 @@ static void
store_ppc_registers (const struct regcache *regcache, int tid) store_ppc_registers (const struct regcache *regcache, int tid)
{ {
int i; 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++) for (i = 0; i < ppc_num_gprs; i++)
store_register (regcache, tid, tdep->ppc_gp0_regnum + i); store_register (regcache, tid, tdep->ppc_gp0_regnum + i);
if (tdep->ppc_fp0_regnum >= 0) if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++) for (i = 0; i < ppc_num_fprs; i++)
store_register (regcache, tid, tdep->ppc_fp0_regnum + 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) if (tdep->ppc_ps_regnum != -1)
store_register (regcache, tid, tdep->ppc_ps_regnum); store_register (regcache, tid, tdep->ppc_ps_regnum);
if (tdep->ppc_cr_regnum != -1) if (tdep->ppc_cr_regnum != -1)

View File

@ -753,7 +753,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame,
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
base = frame_unwind_register_unsigned (next_frame, 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) if (bias > 0 && frame_pc_unwind (next_frame) != func)
/* See below, some signal trampolines increment the stack as their /* See below, some signal trampolines increment the stack as their
first instruction, need to compensate for that. */ first instruction, need to compensate for that. */
@ -773,7 +773,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame,
trad_frame_set_reg_addr (this_cache, regnum, gpregs + i * tdep->wordsize); trad_frame_set_reg_addr (this_cache, regnum, gpregs + i * tdep->wordsize);
} }
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache,
gdbarch_pc_regnum (current_gdbarch), gdbarch_pc_regnum (gdbarch),
gpregs + 32 * tdep->wordsize); gpregs + 32 * tdep->wordsize);
trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum,
gpregs + 35 * tdep->wordsize); gpregs + 35 * tdep->wordsize);
@ -789,7 +789,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame,
/* Floating point registers. */ /* Floating point registers. */
for (i = 0; i < 32; i++) 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, trad_frame_set_reg_addr (this_cache, regnum,
fpregs + i * tdep->wordsize); fpregs + i * tdep->wordsize);
} }

View File

@ -48,15 +48,14 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) 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; ULONGEST saved_sp;
int argspace = 0; /* 0 is an initial wrong guess. */ int argspace = 0; /* 0 is an initial wrong guess. */
int write_pass; int write_pass;
gdb_assert (tdep->wordsize == 4); gdb_assert (tdep->wordsize == 4);
regcache_cooked_read_unsigned (regcache, regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
gdbarch_sp_regnum (current_gdbarch),
&saved_sp); &saved_sp);
/* Go through the argument list twice. /* Go through the argument list twice.
@ -146,7 +145,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else if (TYPE_CODE (type) == TYPE_CODE_FLT else if (TYPE_CODE (type) == TYPE_CODE_FLT
&& len == 16 && len == 16
&& !tdep->soft_float && !tdep->soft_float
&& (gdbarch_long_double_format (current_gdbarch) && (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double)) == floatformats_ibm_long_double))
{ {
/* IBM long double passed in two FP registers if /* IBM long double passed in two FP registers if
@ -208,7 +207,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
} }
else if (len == 16 && TYPE_CODE (type) == TYPE_CODE_FLT 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)) == floatformats_ibm_long_double))
{ {
/* Soft-float IBM long double passed in four consecutive /* Soft-float IBM long double passed in four consecutive
@ -375,8 +374,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
/* Update %sp. */ /* Update %sp. */
regcache_cooked_write_signed (regcache, regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
gdbarch_sp_regnum (current_gdbarch), sp);
/* Write the backchain (it occupies WORDSIZED bytes). */ /* Write the backchain (it occupies WORDSIZED bytes). */
write_memory_signed_integer (sp, tdep->wordsize, saved_sp); write_memory_signed_integer (sp, tdep->wordsize, saved_sp);
@ -438,8 +436,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
if (TYPE_CODE (type) == TYPE_CODE_FLT if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16 && TYPE_LENGTH (type) == 16
&& !tdep->soft_float && !tdep->soft_float
&& (gdbarch_long_double_format (current_gdbarch) && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
== floatformats_ibm_long_double))
{ {
/* IBM long double stored in f1 and f2. */ /* IBM long double stored in f1 and f2. */
if (readbuf) if (readbuf)
@ -458,8 +455,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
} }
if (TYPE_CODE (type) == TYPE_CODE_FLT if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16 && TYPE_LENGTH (type) == 16
&& (gdbarch_long_double_format (current_gdbarch) && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
== floatformats_ibm_long_double))
{ {
/* Soft-float IBM long double stored in r3, r4, r5, r6. */ /* Soft-float IBM long double stored in r3, r4, r5, r6. */
if (readbuf) if (readbuf)
@ -736,7 +732,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
CORE_ADDR func_addr = find_function_addr (function, NULL); 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; ULONGEST back_chain;
/* See for-loop comment below. */ /* See for-loop comment below. */
int write_pass; int write_pass;
@ -763,8 +759,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* By this stage in the proceedings, SP has been decremented by "red /* By this stage in the proceedings, SP has been decremented by "red
zone size" + "struct return size". Fetch the stack-pointer from zone size" + "struct return size". Fetch the stack-pointer from
before this and use that as the BACK_CHAIN. */ before this and use that as the BACK_CHAIN. */
regcache_cooked_read_unsigned (regcache, regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
gdbarch_sp_regnum (current_gdbarch),
&back_chain); &back_chain);
/* Go through the argument list twice. /* Go through the argument list twice.
@ -878,7 +873,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
else if (TYPE_CODE (type) == TYPE_CODE_FLT else if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16 && TYPE_LENGTH (type) == 16
&& (gdbarch_long_double_format (current_gdbarch) && (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double)) == floatformats_ibm_long_double))
{ {
/* IBM long double stored in two doublewords of the /* IBM long double stored in two doublewords of the
@ -1033,7 +1028,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
freg++; freg++;
} }
else if (TYPE_LENGTH (type) == 16 else if (TYPE_LENGTH (type) == 16
&& (gdbarch_long_double_format (current_gdbarch) && (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double)) == floatformats_ibm_long_double))
{ {
if (write_pass) if (write_pass)
@ -1071,8 +1066,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
/* Update %sp. */ /* Update %sp. */
regcache_cooked_write_signed (regcache, regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
gdbarch_sp_regnum (current_gdbarch), sp);
/* Write the backchain (it occupies WORDSIZED bytes). */ /* Write the backchain (it occupies WORDSIZED bytes). */
write_memory_signed_integer (sp, tdep->wordsize, back_chain); write_memory_signed_integer (sp, tdep->wordsize, back_chain);
@ -1231,7 +1225,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype,
{ {
gdb_byte regval[MAX_REGISTER_SIZE]; gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = struct type *regtype =
register_type (current_gdbarch, tdep->ppc_fp0_regnum); register_type (gdbarch, tdep->ppc_fp0_regnum);
if (writebuf != NULL) if (writebuf != NULL)
{ {
convert_typed_floating ((const bfd_byte *) writebuf + convert_typed_floating ((const bfd_byte *) writebuf +

View File

@ -146,7 +146,8 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
{ {
struct switchframe sf; struct switchframe sf;
struct callframe cf; 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; int i;
/* The stack pointer shouldn't be zero. */ /* The stack pointer shouldn't be zero. */
@ -167,7 +168,7 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
read_memory(cf.sp, (gdb_byte *)&cf, sizeof(cf)); read_memory(cf.sp, (gdb_byte *)&cf, sizeof(cf));
regcache_raw_supply (regcache, tdep->ppc_lr_regnum, &cf.lr); 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; return 1;
} }

View File

@ -114,7 +114,7 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
int i; int i;
base = frame_unwind_register_unsigned (next_frame, base = frame_unwind_register_unsigned (next_frame,
gdbarch_sp_regnum (current_gdbarch)); gdbarch_sp_regnum (gdbarch));
if (self == &ppcnbsd2_sigtramp) if (self == &ppcnbsd2_sigtramp)
addr = base + 0x10 + 2 * tdep->wordsize; addr = base + 0x10 + 2 * tdep->wordsize;
else else
@ -132,8 +132,7 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
addr += tdep->wordsize; addr += tdep->wordsize;
trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, addr); trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, addr);
addr += tdep->wordsize; addr += tdep->wordsize;
trad_frame_set_reg_addr (this_cache, trad_frame_set_reg_addr (this_cache, gdbarch_pc_regnum (gdbarch),
gdbarch_pc_regnum (current_gdbarch),
addr); /* SRR0? */ addr); /* SRR0? */
addr += tdep->wordsize; addr += tdep->wordsize;

View File

@ -148,7 +148,8 @@ ppcobsd_store_registers (struct regcache *regcache, int regnum)
static int static int
ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 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 switchframe sf;
struct callframe cf; struct callframe cf;
int i, regnum; int i, regnum;
@ -167,14 +168,14 @@ ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 0; return 0;
read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf); 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_cr_regnum, &sf.cr);
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2); regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
for (i = 0, regnum = tdep->ppc_gp0_regnum + 13; i < 19; i++, regnum++) for (i = 0, regnum = tdep->ppc_gp0_regnum + 13; i < 19; i++, regnum++)
regcache_raw_supply (regcache, regnum, &sf.fixreg[i]); regcache_raw_supply (regcache, regnum, &sf.fixreg[i]);
read_memory (sf.sp, (gdb_byte *)&cf, sizeof cf); 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 + 30, &cf.r30);
regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31); regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31);

View File

@ -186,7 +186,7 @@ ppcobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
sigcontext_offset = (0x10000 - (insn & 0x0000ffff)) + 8; sigcontext_offset = (0x10000 - (insn & 0x0000ffff)) + 8;
base = frame_unwind_register_unsigned (next_frame, base = frame_unwind_register_unsigned (next_frame,
gdbarch_sp_regnum (current_gdbarch)); gdbarch_sp_regnum (gdbarch));
addr = base + sigcontext_offset + 2 * tdep->wordsize; addr = base + sigcontext_offset + 2 * tdep->wordsize;
for (i = 0; i < ppc_num_gprs; i++, addr += tdep->wordsize) for (i = 0; i < ppc_num_gprs; i++, addr += tdep->wordsize)
{ {
@ -201,7 +201,7 @@ ppcobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
addr += tdep->wordsize; addr += tdep->wordsize;
trad_frame_set_reg_addr (cache, tdep->ppc_ctr_regnum, addr); trad_frame_set_reg_addr (cache, tdep->ppc_ctr_regnum, addr);
addr += tdep->wordsize; 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? */ /* SRR0? */
addr += tdep->wordsize; addr += tdep->wordsize;

View File

@ -3687,6 +3687,7 @@ procfs_fetch_registers (struct regcache *regcache, int regnum)
procinfo *pi; procinfo *pi;
int pid = PIDGET (inferior_ptid); int pid = PIDGET (inferior_ptid);
int tid = TIDGET (inferior_ptid); int tid = TIDGET (inferior_ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* First look up procinfo for the main process. */ /* First look up procinfo for the main process. */
pi = find_procinfo_or_die (pid, 0); pi = find_procinfo_or_die (pid, 0);
@ -3707,13 +3708,13 @@ procfs_fetch_registers (struct regcache *regcache, int regnum)
supply_gregset (regcache, (const gdb_gregset_t *) gregs); 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; gdb_fpregset_t *fpregs;
if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (current_gdbarch)) if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch))
|| regnum == gdbarch_pc_regnum (current_gdbarch) || regnum == gdbarch_pc_regnum (gdbarch)
|| regnum == gdbarch_sp_regnum (current_gdbarch)) || regnum == gdbarch_sp_regnum (gdbarch))
return; /* Not a floating point register. */ return; /* Not a floating point register. */
fpregs = proc_get_fpregs (pi); fpregs = proc_get_fpregs (pi);
@ -3752,6 +3753,7 @@ procfs_store_registers (struct regcache *regcache, int regnum)
procinfo *pi; procinfo *pi;
int pid = PIDGET (inferior_ptid); int pid = PIDGET (inferior_ptid);
int tid = TIDGET (inferior_ptid); int tid = TIDGET (inferior_ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
/* First find procinfo for main process. */ /* First find procinfo for main process. */
pi = find_procinfo_or_die (pid, 0); pi = find_procinfo_or_die (pid, 0);
@ -3774,13 +3776,13 @@ procfs_store_registers (struct regcache *regcache, int regnum)
if (!proc_set_gregs (pi)) if (!proc_set_gregs (pi))
proc_error (pi, "store_registers, set_gregs", __LINE__); 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; gdb_fpregset_t *fpregs;
if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (current_gdbarch)) if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch))
|| regnum == gdbarch_pc_regnum (current_gdbarch) || regnum == gdbarch_pc_regnum (gdbarch)
|| regnum == gdbarch_sp_regnum (current_gdbarch)) || regnum == gdbarch_sp_regnum (gdbarch))
return; /* Not a floating point register. */ return; /* Not a floating point register. */
fpregs = proc_get_fpregs (pi); fpregs = proc_get_fpregs (pi);

View File

@ -908,7 +908,9 @@ m32r_fetch_registers (struct regcache *regcache)
{ {
int 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_fetch_register (regcache, regno); m32r_fetch_register (regcache, regno);
} }
@ -957,7 +959,9 @@ m32r_store_registers (struct regcache *regcache)
{ {
int 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); m32r_store_register (regcache, regno);
registers_changed (); registers_changed ();

View File

@ -279,14 +279,15 @@ one2one_register_sim_regno (int regnum)
static void static void
gdbsim_fetch_register (struct regcache *regcache, int regno) gdbsim_fetch_register (struct regcache *regcache, int regno)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno == -1) 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); gdbsim_fetch_register (regcache, regno);
return; return;
} }
switch (gdbarch_register_sim_regno (current_gdbarch, regno)) switch (gdbarch_register_sim_regno (gdbarch, regno))
{ {
case LEGACY_SIM_REGNO_IGNORE: case LEGACY_SIM_REGNO_IGNORE:
break; break;
@ -306,22 +307,23 @@ gdbsim_fetch_register (struct regcache *regcache, int regno)
static int warn_user = 1; static int warn_user = 1;
char buf[MAX_REGISTER_SIZE]; char buf[MAX_REGISTER_SIZE];
int nr_bytes; 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); memset (buf, 0, MAX_REGISTER_SIZE);
nr_bytes = sim_fetch_register (gdbsim_desc, nr_bytes = sim_fetch_register (gdbsim_desc,
gdbarch_register_sim_regno gdbarch_register_sim_regno
(current_gdbarch, regno), (gdbarch, regno),
buf, buf,
register_size (current_gdbarch, regno)); register_size (gdbarch, regno));
if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno) && warn_user) if (nr_bytes > 0
&& nr_bytes != register_size (gdbarch, regno) && warn_user)
{ {
fprintf_unfiltered (gdb_stderr, fprintf_unfiltered (gdb_stderr,
"Size of register %s (%d/%d) incorrect (%d instead of %d))", "Size of register %s (%d/%d) incorrect (%d instead of %d))",
gdbarch_register_name (current_gdbarch, regno), gdbarch_register_name (gdbarch, regno),
regno, regno,
gdbarch_register_sim_regno gdbarch_register_sim_regno
(current_gdbarch, regno), (gdbarch, regno),
nr_bytes, register_size (current_gdbarch, regno)); nr_bytes, register_size (gdbarch, regno));
warn_user = 0; warn_user = 0;
} }
/* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
@ -334,7 +336,7 @@ gdbsim_fetch_register (struct regcache *regcache, int regno)
{ {
printf_filtered ("gdbsim_fetch_register: %d", regno); printf_filtered ("gdbsim_fetch_register: %d", regno);
/* FIXME: We could print something more intelligible. */ /* FIXME: We could print something more intelligible. */
dump_mem (buf, register_size (current_gdbarch, regno)); dump_mem (buf, register_size (gdbarch, regno));
} }
break; break;
} }
@ -345,22 +347,23 @@ gdbsim_fetch_register (struct regcache *regcache, int regno)
static void static void
gdbsim_store_register (struct regcache *regcache, int regno) gdbsim_store_register (struct regcache *regcache, int regno)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno == -1) 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); gdbsim_store_register (regcache, regno);
return; 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]; char tmp[MAX_REGISTER_SIZE];
int nr_bytes; int nr_bytes;
regcache_cooked_read (regcache, regno, tmp); regcache_cooked_read (regcache, regno, tmp);
nr_bytes = sim_store_register (gdbsim_desc, nr_bytes = sim_store_register (gdbsim_desc,
gdbarch_register_sim_regno gdbarch_register_sim_regno
(current_gdbarch, regno), (gdbarch, regno),
tmp, register_size (current_gdbarch, regno)); tmp, register_size (gdbarch, regno));
if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno)) if (nr_bytes > 0 && nr_bytes != register_size (gdbarch, regno))
internal_error (__FILE__, __LINE__, internal_error (__FILE__, __LINE__,
_("Register size different to expected")); _("Register size different to expected"));
/* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
@ -370,7 +373,7 @@ gdbsim_store_register (struct regcache *regcache, int regno)
{ {
printf_filtered ("gdbsim_store_register: %d", regno); printf_filtered ("gdbsim_store_register: %d", regno);
/* FIXME: We could print something more intelligible. */ /* FIXME: We could print something more intelligible. */
dump_mem (tmp, register_size (current_gdbarch, regno)); dump_mem (tmp, register_size (gdbarch, regno));
} }
} }
} }

View File

@ -3145,9 +3145,9 @@ ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
} }
/* Handle PC register and Stack Pointer correctly. */ /* 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; 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; reg->how = DWARF2_FRAME_REG_CFA;
} }

View File

@ -33,16 +33,16 @@
/* Determine if PT_GETREGS fetches this register. */ /* Determine if PT_GETREGS fetches this register. */
#define GETREGS_SUPPLIES(regno) \ #define GETREGS_SUPPLIES(gdbarch, regno) \
(((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \ (((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) == MACH_REGNUM || (regno) == MACL_REGNUM \
|| (regno) == SR_REGNUM) || (regno) == SR_REGNUM)
static void static void
shnbsd_fetch_inferior_registers (struct regcache *regcache, int regno) 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; struct reg inferior_registers;
@ -60,7 +60,7 @@ shnbsd_fetch_inferior_registers (struct regcache *regcache, int regno)
static void static void
shnbsd_store_inferior_registers (struct regcache *regcache, int regno) 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; struct reg inferior_registers;

View File

@ -51,8 +51,7 @@ trad_frame_alloc_saved_regs (struct frame_info *next_frame)
{ {
int regnum; int regnum;
struct gdbarch *gdbarch = get_frame_arch (next_frame); struct gdbarch *gdbarch = get_frame_arch (next_frame);
int numregs = gdbarch_num_regs (current_gdbarch) int numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
+ gdbarch_num_pseudo_regs (current_gdbarch);
struct trad_frame_saved_reg *this_saved_regs struct trad_frame_saved_reg *this_saved_regs
= FRAME_OBSTACK_CALLOC (numregs, struct trad_frame_saved_reg); = FRAME_OBSTACK_CALLOC (numregs, struct trad_frame_saved_reg);
for (regnum = 0; regnum < numregs; regnum++) for (regnum = 0; regnum < numregs; regnum++)

View File

@ -154,8 +154,8 @@ user_reg_map_name_to_regnum (struct gdbarch *gdbarch, const char *name,
if ((len < 0 && strcmp (reg->name, name)) if ((len < 0 && strcmp (reg->name, name))
|| (len == strlen (reg->name) || (len == strlen (reg->name)
&& strncmp (reg->name, name, len) == 0)) && strncmp (reg->name, name, len) == 0))
return gdbarch_num_regs (current_gdbarch) return gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (current_gdbarch) + nr; + gdbarch_num_pseudo_regs (gdbarch) + nr;
} }
} }

View File

@ -400,7 +400,7 @@ do_win32_fetch_inferior_registers (struct regcache *regcache, int r)
regcache_raw_supply (regcache, r, context_offset); regcache_raw_supply (regcache, r, context_offset);
else 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); do_win32_fetch_inferior_registers (regcache, r);
} }
@ -427,7 +427,7 @@ do_win32_store_inferior_registers (const struct regcache *regcache, int r)
((char *) &current_thread->context) + mappings[r]); ((char *) &current_thread->context) + mappings[r]);
else 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); do_win32_store_inferior_registers (regcache, r);
} }
} }

View File

@ -400,7 +400,7 @@ do_win32_fetch_inferior_registers (struct regcache *regcache, int r)
regcache_raw_supply (regcache, r, context_offset); regcache_raw_supply (regcache, r, context_offset);
else 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); do_win32_fetch_inferior_registers (regcache, r);
} }
@ -427,7 +427,7 @@ do_win32_store_inferior_registers (const struct regcache *regcache, int r)
((char *) &current_thread->context) + mappings[r]); ((char *) &current_thread->context) + mappings[r]);
else 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); do_win32_store_inferior_registers (regcache, r);
} }
} }