* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument.

(write_pc): Likewise.  Remove default implementation, add predicate.
	* gdbarch.c, gdbarch.h: Regenerate.
	* regcache.c (read_pc_pid): Use current regcache instead of calling
	read_register_pid.
	(write_pc_pid): Check gdbarch_write_pc predicate, implement default
	case inline.
	(generic_target_write_pc): Remove.
	* inferior.h (generic_target_write_pc): Remove.
	* frv-tdep.c (frv_gdbarch_init): Do not install it.
	* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
	* rs6000-tdep.c (rs6000_gdbarch_init): Likewise.
	* sh64-tdep.c (sh64_gdbarch_init): Likewise.
	* sh-tdep.c (sh_gdbarch_init): Likewise.
	* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.

	* avr-tdep.c (avr_read_pc): Add REGCACHE argument.  Remove PTID
	argument.  Use REGCACHE instead of calling read_register_pid.
	* hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise.
	* hppa-tdep.c (hppa_read_pc): Likewise.
	* hppa-tdep.h (hppa_read_pc): Likewise.
	* ia64-tdep.c (ia64_read_pc): Likewise.
	* m32r-tdep.c (m32r_read_pc): Likewise.
	* mep-tdep.c (mep_read_pc): Likewise.
	* mn10300-tdep.c (mn10300_read_pc): Likewise.
	* spu-tdep.c (spu_read_pc): Likewise.

	* arm-tdep.c (arm_write_pc): Add REGCACHE argument.  Remove PTID
	argument.  Use REGCACHE instead of calling write_register_pid.
	* avr-tdep.c (avr_write_pc): Likewise.
	* hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise.
	* hppa-tdep.c (hppa_write_pc): Likewise.
	* hppa-tdep.h (hppa_write_pc): Likewise.
	* i386-linux-tdep.c (i386_linux_write_pc): Likewise.
	* amd64-linux-tdep.c (amd64_linux_write_pc): Likewise.
	* ia64-linux-tdep.c (ia64_linux_write_pc): Likewise.
	* ia64-tdep.c (ia64_write_pc): Likewise.
	* ia64-tdep.h (ia64_write_pc): Likewise.
	* m32r-tdep.c (m32r_write_pc): Likewise.
	* m88k-tdep.c (m88k_write_pc): Likewise.
	* mep-tdep.c (mep_write_pc): Likewise.
	* mips-tdep.c (mips_write_pc): Likewise.
	* mips-linux-tdep.c (mips_linux_write_pc): Likewise.
	* mn10300-tdep.c (mn10300_write_pc): Likewise.
	* sparc-tdep.c (sparc_write_pc): Likewise.
	* spu-tdep.c (spu_write_pc): Likewise.

	* mips-tdep.c (read_signed_register): Remove.
	(read_signed_register_pid): Likewise.
	(mips_read_pc): Add REGCACHE argument.  Remove PTID argument.
	Use REGCACHE instead of calling read_signed_register_pid.
This commit is contained in:
Ulrich Weigand 2007-06-15 22:44:56 +00:00
parent e4fd649ae2
commit 61a1198acf
31 changed files with 196 additions and 230 deletions

View File

@ -1,3 +1,57 @@
2007-06-15 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument.
(write_pc): Likewise. Remove default implementation, add predicate.
* gdbarch.c, gdbarch.h: Regenerate.
* regcache.c (read_pc_pid): Use current regcache instead of calling
read_register_pid.
(write_pc_pid): Check gdbarch_write_pc predicate, implement default
case inline.
(generic_target_write_pc): Remove.
* inferior.h (generic_target_write_pc): Remove.
* frv-tdep.c (frv_gdbarch_init): Do not install it.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise.
* rs6000-tdep.c (rs6000_gdbarch_init): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise.
* avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID
argument. Use REGCACHE instead of calling read_register_pid.
* hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise.
* hppa-tdep.c (hppa_read_pc): Likewise.
* hppa-tdep.h (hppa_read_pc): Likewise.
* ia64-tdep.c (ia64_read_pc): Likewise.
* m32r-tdep.c (m32r_read_pc): Likewise.
* mep-tdep.c (mep_read_pc): Likewise.
* mn10300-tdep.c (mn10300_read_pc): Likewise.
* spu-tdep.c (spu_read_pc): Likewise.
* arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID
argument. Use REGCACHE instead of calling write_register_pid.
* avr-tdep.c (avr_write_pc): Likewise.
* hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise.
* hppa-tdep.c (hppa_write_pc): Likewise.
* hppa-tdep.h (hppa_write_pc): Likewise.
* i386-linux-tdep.c (i386_linux_write_pc): Likewise.
* amd64-linux-tdep.c (amd64_linux_write_pc): Likewise.
* ia64-linux-tdep.c (ia64_linux_write_pc): Likewise.
* ia64-tdep.c (ia64_write_pc): Likewise.
* ia64-tdep.h (ia64_write_pc): Likewise.
* m32r-tdep.c (m32r_write_pc): Likewise.
* m88k-tdep.c (m88k_write_pc): Likewise.
* mep-tdep.c (mep_write_pc): Likewise.
* mips-tdep.c (mips_write_pc): Likewise.
* mips-linux-tdep.c (mips_linux_write_pc): Likewise.
* mn10300-tdep.c (mn10300_write_pc): Likewise.
* sparc-tdep.c (sparc_write_pc): Likewise.
* spu-tdep.c (spu_write_pc): Likewise.
* mips-tdep.c (read_signed_register): Remove.
(read_signed_register_pid): Likewise.
(mips_read_pc): Add REGCACHE argument. Remove PTID argument.
Use REGCACHE instead of calling read_signed_register_pid.
2007-06-15 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.sh (push_dummy_code): Add REGCACHE argument.

View File

@ -237,9 +237,9 @@ amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
/* Set the program counter for process PTID to PC. */
static void
amd64_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
write_register_pid (AMD64_RIP_REGNUM, pc, ptid);
regcache_cooked_write_unsigned (regcache, AMD64_RIP_REGNUM, pc);
/* We must be careful with modifying the program counter. If we
just interrupted a system call, the kernel might try to restart
@ -255,7 +255,7 @@ amd64_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
when we resume the inferior on return from a function call from
within GDB. In all other cases the system call will not be
restarted. */
write_register_pid (AMD64_LINUX_ORIG_RAX_REGNUM, -1, ptid);
regcache_cooked_write_unsigned (regcache, AMD64_LINUX_ORIG_RAX_REGNUM, -1);
}
static void

View File

@ -2588,18 +2588,20 @@ arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym)
}
static void
arm_write_pc (CORE_ADDR pc, ptid_t ptid)
arm_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
write_register_pid (ARM_PC_REGNUM, pc, ptid);
regcache_cooked_write_unsigned (regcache, ARM_PC_REGNUM, pc);
/* If necessary, set the T bit. */
if (arm_apcs_32)
{
CORE_ADDR val = read_register_pid (ARM_PS_REGNUM, ptid);
ULONGEST val;
regcache_cooked_read_unsigned (regcache, ARM_PS_REGNUM, &val);
if (arm_pc_is_thumb (pc))
write_register_pid (ARM_PS_REGNUM, val | 0x20, ptid);
regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM, val | 0x20);
else
write_register_pid (ARM_PS_REGNUM, val & ~(CORE_ADDR) 0x20, ptid);
regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM,
val & ~(ULONGEST) 0x20);
}
}

View File

@ -312,29 +312,18 @@ avr_pointer_to_address (struct type *type, const gdb_byte *buf)
}
static CORE_ADDR
avr_read_pc (ptid_t ptid)
avr_read_pc (struct regcache *regcache)
{
ptid_t save_ptid;
ULONGEST pc;
CORE_ADDR retval;
save_ptid = inferior_ptid;
inferior_ptid = ptid;
regcache_cooked_read_unsigned (current_regcache, AVR_PC_REGNUM, &pc);
inferior_ptid = save_ptid;
retval = avr_make_iaddr (pc);
return retval;
regcache_cooked_read_unsigned (regcache, AVR_PC_REGNUM, &pc);
return avr_make_iaddr (pc);
}
static void
avr_write_pc (CORE_ADDR val, ptid_t ptid)
avr_write_pc (struct regcache *regcache, CORE_ADDR val)
{
ptid_t save_ptid;
save_ptid = inferior_ptid;
inferior_ptid = ptid;
write_register (AVR_PC_REGNUM, avr_convert_iaddr_to_raw (val));
inferior_ptid = save_ptid;
regcache_cooked_write_unsigned (regcache, AVR_PC_REGNUM,
avr_convert_iaddr_to_raw (val));
}
static int

View File

@ -1517,8 +1517,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Settings that should be unnecessary. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
/* Hardware watchpoint / breakpoint support. */
switch (info.bfd_arch_info->mach)
{

View File

@ -406,7 +406,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->ptr_bit = current_gdbarch->int_bit;
current_gdbarch->bfd_vma_bit = gdbarch_bfd_arch_info (current_gdbarch)->bits_per_address;
current_gdbarch->char_signed = -1;
current_gdbarch->write_pc = generic_target_write_pc;
current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
current_gdbarch->num_regs = -1;
current_gdbarch->sp_regnum = -1;
@ -524,7 +523,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
if (current_gdbarch->char_signed == -1)
current_gdbarch->char_signed = 1;
/* Skip verify of read_pc, has predicate */
/* Skip verify of write_pc, invalid_p == 0 */
/* Skip verify of write_pc, has predicate */
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
/* Skip verify of pseudo_register_read, has predicate */
/* Skip verify of pseudo_register_write, has predicate */
@ -1006,21 +1005,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: push_dummy_code = <0x%lx>\n",
(long) current_gdbarch->push_dummy_code);
#ifdef TARGET_READ_PC_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"TARGET_READ_PC_P()",
XSTRING (TARGET_READ_PC_P ()));
#endif
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_read_pc_p() = %d\n",
gdbarch_read_pc_p (current_gdbarch));
#ifdef TARGET_READ_PC
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"TARGET_READ_PC(ptid)",
XSTRING (TARGET_READ_PC (ptid)));
#endif
fprintf_unfiltered (file,
"gdbarch_dump: read_pc = <0x%lx>\n",
(long) current_gdbarch->read_pc);
@ -1164,12 +1151,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: vtable_function_descriptors = %s\n",
paddr_d (current_gdbarch->vtable_function_descriptors));
#ifdef TARGET_WRITE_PC
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"TARGET_WRITE_PC(val, ptid)",
XSTRING (TARGET_WRITE_PC (val, ptid)));
#endif
"gdbarch_dump: gdbarch_write_pc_p() = %d\n",
gdbarch_write_pc_p (current_gdbarch));
fprintf_unfiltered (file,
"gdbarch_dump: write_pc = <0x%lx>\n",
(long) current_gdbarch->write_pc);
@ -1467,13 +1451,13 @@ gdbarch_read_pc_p (struct gdbarch *gdbarch)
}
CORE_ADDR
gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid)
gdbarch_read_pc (struct gdbarch *gdbarch, struct regcache *regcache)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->read_pc != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
return gdbarch->read_pc (ptid);
return gdbarch->read_pc (regcache);
}
void
@ -1483,14 +1467,21 @@ set_gdbarch_read_pc (struct gdbarch *gdbarch,
gdbarch->read_pc = read_pc;
}
int
gdbarch_write_pc_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
return gdbarch->write_pc != NULL;
}
void
gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid)
gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->write_pc != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
gdbarch->write_pc (val, ptid);
gdbarch->write_pc (regcache, val);
}
void

View File

@ -151,40 +151,17 @@ extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit);
extern int gdbarch_char_signed (struct gdbarch *gdbarch);
extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed);
#if defined (TARGET_READ_PC)
/* Legacy for systems yet to multi-arch TARGET_READ_PC */
#if !defined (TARGET_READ_PC_P)
#define TARGET_READ_PC_P() (1)
#endif
#endif
extern int gdbarch_read_pc_p (struct gdbarch *gdbarch);
#if !defined (GDB_TM_FILE) && defined (TARGET_READ_PC_P)
#error "Non multi-arch definition of TARGET_READ_PC"
#endif
#if !defined (TARGET_READ_PC_P)
#define TARGET_READ_PC_P() (gdbarch_read_pc_p (current_gdbarch))
#endif
typedef CORE_ADDR (gdbarch_read_pc_ftype) (ptid_t ptid);
extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid);
typedef CORE_ADDR (gdbarch_read_pc_ftype) (struct regcache *regcache);
extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, struct regcache *regcache);
extern void set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc);
#if !defined (GDB_TM_FILE) && defined (TARGET_READ_PC)
#error "Non multi-arch definition of TARGET_READ_PC"
#endif
#if !defined (TARGET_READ_PC)
#define TARGET_READ_PC(ptid) (gdbarch_read_pc (current_gdbarch, ptid))
#endif
typedef void (gdbarch_write_pc_ftype) (CORE_ADDR val, ptid_t ptid);
extern void gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid);
extern int gdbarch_write_pc_p (struct gdbarch *gdbarch);
typedef void (gdbarch_write_pc_ftype) (struct regcache *regcache, CORE_ADDR val);
extern void gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val);
extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftype *write_pc);
#if !defined (GDB_TM_FILE) && defined (TARGET_WRITE_PC)
#error "Non multi-arch definition of TARGET_WRITE_PC"
#endif
#if !defined (TARGET_WRITE_PC)
#define TARGET_WRITE_PC(val, ptid) (gdbarch_write_pc (current_gdbarch, val, ptid))
#endif
/* Function for getting target's idea of a frame pointer. FIXME: GDB's
whole scheme for dealing with "frames" and "frame pointers" needs a

View File

@ -420,8 +420,8 @@ v::int:bfd_vma_bit:::8 * sizeof (void*):gdbarch_bfd_arch_info (current_gdbarch)-
# One if \`char' acts like \`signed char', zero if \`unsigned char'.
v::int:char_signed:::1:-1:1
#
F:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid
f:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid:0:generic_target_write_pc::0
F::CORE_ADDR:read_pc:struct regcache *regcache:regcache
F::void:write_pc:struct regcache *regcache, CORE_ADDR val:regcache, val
# Function for getting target's idea of a frame pointer. FIXME: GDB's
# whole scheme for dealing with "frames" and "frame pointers" needs a
# serious shakedown.

View File

@ -1372,29 +1372,33 @@ hppa_hpux_regset_from_core_section (struct gdbarch *gdbarch,
#define HPPA_HPUX_SS_INSYSCALL 0x02
static CORE_ADDR
hppa_hpux_read_pc (ptid_t ptid)
hppa_hpux_read_pc (struct regcache *regcache)
{
ULONGEST flags;
/* If we're currently in a system call return the contents of %r31. */
flags = read_register_pid (HPPA_FLAGS_REGNUM, ptid);
regcache_cooked_read_unsigned (regcache, HPPA_FLAGS_REGNUM, &flags);
if (flags & HPPA_HPUX_SS_INSYSCALL)
return read_register_pid (HPPA_R31_REGNUM, ptid) & ~0x3;
{
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, HPPA_R31_REGNUM, &pc);
return pc & ~0x3;
}
return hppa_read_pc (ptid);
return hppa_read_pc (regcache);
}
static void
hppa_hpux_write_pc (CORE_ADDR pc, ptid_t ptid)
hppa_hpux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
ULONGEST flags;
/* If we're currently in a system call also write PC into %r31. */
flags = read_register_pid (HPPA_FLAGS_REGNUM, ptid);
regcache_cooked_read_unsigned (regcache, HPPA_FLAGS_REGNUM, &flags);
if (flags & HPPA_HPUX_SS_INSYSCALL)
write_register_pid (HPPA_R31_REGNUM, pc | 0x3, ptid);
regcache_cooked_write_unsigned (regcache, HPPA_R31_REGNUM, pc | 0x3);
return hppa_write_pc (pc, ptid);
return hppa_write_pc (regcache, pc);
}
static CORE_ADDR

View File

@ -56,11 +56,11 @@ hppa_dwarf_reg_to_regnum (int reg)
#endif
static void
hppa_linux_target_write_pc (CORE_ADDR v, ptid_t ptid)
hppa_linux_target_write_pc (struct regcache *regcache, CORE_ADDR v)
{
/* Probably this should be done by the kernel, but it isn't. */
write_register_pid (HPPA_PCOQ_HEAD_REGNUM, v | 0x3, ptid);
write_register_pid (HPPA_PCOQ_TAIL_REGNUM, (v + 4) | 0x3, ptid);
regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_HEAD_REGNUM, v | 0x3);
regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_TAIL_REGNUM, (v + 4) | 0x3);
}
/* An instruction to match. */

View File

@ -1274,13 +1274,13 @@ hppa64_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
}
CORE_ADDR
hppa_read_pc (ptid_t ptid)
hppa_read_pc (struct regcache *regcache)
{
ULONGEST ipsw;
CORE_ADDR pc;
ULONGEST pc;
ipsw = read_register_pid (HPPA_IPSW_REGNUM, ptid);
pc = read_register_pid (HPPA_PCOQ_HEAD_REGNUM, ptid);
regcache_cooked_read_unsigned (regcache, HPPA_IPSW_REGNUM, &ipsw);
regcache_cooked_read_unsigned (regcache, HPPA_PCOQ_HEAD_REGNUM, &pc);
/* If the current instruction is nullified, then we are effectively
still executing the previous instruction. Pretend we are still
@ -1294,10 +1294,10 @@ hppa_read_pc (ptid_t ptid)
}
void
hppa_write_pc (CORE_ADDR pc, ptid_t ptid)
hppa_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
write_register_pid (HPPA_PCOQ_HEAD_REGNUM, pc, ptid);
write_register_pid (HPPA_PCOQ_TAIL_REGNUM, pc + 4, ptid);
regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_HEAD_REGNUM, pc);
regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_TAIL_REGNUM, pc + 4);
}
/* return the alignment of a type in bytes. Structures have the maximum

View File

@ -233,8 +233,8 @@ extern void
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, gdb_byte *valuep);
extern CORE_ADDR hppa_read_pc (ptid_t ptid);
extern void hppa_write_pc (CORE_ADDR pc, ptid_t ptid);
extern CORE_ADDR hppa_read_pc (struct regcache *regcache);
extern void hppa_write_pc (struct regcache *regcache, CORE_ADDR pc);
extern CORE_ADDR hppa_unwind_pc (struct gdbarch *gdbarch,
struct frame_info *next_frame);

View File

@ -317,9 +317,9 @@ i386_linux_sigcontext_addr (struct frame_info *next_frame)
/* Set the program counter for process PTID to PC. */
static void
i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
write_register_pid (I386_EIP_REGNUM, pc, ptid);
regcache_cooked_write_unsigned (regcache, I386_EIP_REGNUM, pc);
/* We must be careful with modifying the program counter. If we
just interrupted a system call, the kernel might try to restart
@ -335,7 +335,7 @@ i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
when we resume the inferior on return from a function call from
within GDB. In all other cases the system call will not be
restarted. */
write_register_pid (I386_LINUX_ORIG_EAX_REGNUM, -1, ptid);
regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1);
}

View File

@ -100,9 +100,9 @@ ia64_linux_sigcontext_register_address (CORE_ADDR sp, int regno)
}
static void
ia64_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
ia64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
ia64_write_pc (pc, ptid);
ia64_write_pc (regcache, pc);
/* We must be careful with modifying the instruction-pointer: if we
just interrupt a system call, the kernel would ordinarily try to
@ -113,7 +113,7 @@ ia64_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
The clearing of r10 is safe as long as ia64_write_pc() is only
called as part of setting up an inferior call. */
write_register_pid (IA64_GR10_REGNUM, 0, ptid);
regcache_cooked_write_unsigned (regcache, IA64_GR10_REGNUM, 0);
}
static void

View File

@ -637,27 +637,32 @@ ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
}
static CORE_ADDR
ia64_read_pc (ptid_t ptid)
ia64_read_pc (struct regcache *regcache)
{
CORE_ADDR psr_value = read_register_pid (IA64_PSR_REGNUM, ptid);
CORE_ADDR pc_value = read_register_pid (IA64_IP_REGNUM, ptid);
int slot_num = (psr_value >> 41) & 3;
ULONGEST psr_value, pc_value;
int slot_num;
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr_value);
regcache_cooked_read_unsigned (regcache, IA64_IP_REGNUM, &pc_value);
slot_num = (psr_value >> 41) & 3;
return pc_value | (slot_num * SLOT_MULTIPLIER);
}
void
ia64_write_pc (CORE_ADDR new_pc, ptid_t ptid)
ia64_write_pc (struct regcache *regcache, CORE_ADDR new_pc)
{
int slot_num = (int) (new_pc & 0xf) / SLOT_MULTIPLIER;
CORE_ADDR psr_value = read_register_pid (IA64_PSR_REGNUM, ptid);
ULONGEST psr_value;
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr_value);
psr_value &= ~(3LL << 41);
psr_value |= (CORE_ADDR)(slot_num & 0x3) << 41;
psr_value |= (ULONGEST)(slot_num & 0x3) << 41;
new_pc &= ~0xfLL;
write_register_pid (IA64_PSR_REGNUM, psr_value, ptid);
write_register_pid (IA64_IP_REGNUM, new_pc, ptid);
regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr_value);
regcache_cooked_write_unsigned (regcache, IA64_IP_REGNUM, new_pc);
}
#define IS_NaT_COLLECTION_ADDR(addr) ((((addr) >> 3) & 0x3f) == 0x3f)

View File

@ -202,6 +202,6 @@ struct gdbarch_tdep
int (*pc_in_sigtramp) (CORE_ADDR);
};
extern void ia64_write_pc (CORE_ADDR, ptid_t);
extern void ia64_write_pc (struct regcache *, CORE_ADDR);
#endif /* ia64-tdep.h */

View File

@ -172,8 +172,6 @@ extern void write_pc (CORE_ADDR);
extern void write_pc_pid (CORE_ADDR, ptid_t);
extern void generic_target_write_pc (CORE_ADDR, ptid_t);
extern CORE_ADDR unsigned_pointer_to_address (struct type *type,
const gdb_byte *buf);
extern void unsigned_address_to_pointer (struct type *type, gdb_byte *buf,

View File

@ -643,27 +643,17 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
}
static CORE_ADDR
m32r_read_pc (ptid_t ptid)
m32r_read_pc (struct regcache *regcache)
{
ptid_t save_ptid;
ULONGEST pc;
save_ptid = inferior_ptid;
inferior_ptid = ptid;
regcache_cooked_read_unsigned (current_regcache, M32R_PC_REGNUM, &pc);
inferior_ptid = save_ptid;
regcache_cooked_read_unsigned (regcache, M32R_PC_REGNUM, &pc);
return pc;
}
static void
m32r_write_pc (CORE_ADDR val, ptid_t ptid)
m32r_write_pc (struct regcache *regcache, CORE_ADDR val)
{
ptid_t save_ptid;
save_ptid = inferior_ptid;
inferior_ptid = ptid;
write_register (M32R_PC_REGNUM, val);
inferior_ptid = save_ptid;
regcache_cooked_write_unsigned (regcache, M32R_PC_REGNUM, val);
}
static CORE_ADDR

View File

@ -1502,8 +1502,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
/* Set register info. */
set_gdbarch_fp0_regnum (gdbarch, -1);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM);
set_gdbarch_register_name (gdbarch, m68hc11_register_name);
set_gdbarch_register_type (gdbarch, m68hc11_register_type);

View File

@ -122,7 +122,7 @@ m88k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
}
static void
m88k_write_pc (CORE_ADDR pc, ptid_t ptid)
m88k_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
/* According to the MC88100 RISC Microprocessor User's Manual,
section 6.4.3.1.2:
@ -140,9 +140,9 @@ m88k_write_pc (CORE_ADDR pc, ptid_t ptid)
with it. We could even (presumably) give it a totally bogus
value. */
write_register_pid (M88K_SXIP_REGNUM, pc, ptid);
write_register_pid (M88K_SNIP_REGNUM, pc | 2, ptid);
write_register_pid (M88K_SFIP_REGNUM, (pc + 4) | 2, ptid);
regcache_cooked_write_unsigned (regcache, M88K_SXIP_REGNUM, pc);
regcache_cooked_write_unsigned (regcache, M88K_SNIP_REGNUM, pc | 2);
regcache_cooked_write_unsigned (regcache, M88K_SFIP_REGNUM, (pc + 4) | 2);
}

View File

@ -1121,31 +1121,17 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
static CORE_ADDR
mep_read_pc (ptid_t ptid)
mep_read_pc (struct regcache *regcache)
{
ptid_t saved_ptid;
CORE_ADDR pc;
saved_ptid = inferior_ptid;
inferior_ptid = ptid;
pc = read_register (MEP_PC_REGNUM);
inferior_ptid = saved_ptid;
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, MEP_PC_REGNUM, &pc);
return pc;
}
static void
mep_write_pc (CORE_ADDR pc, ptid_t ptid)
mep_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
ptid_t saved_ptid;
saved_ptid = inferior_ptid;
inferior_ptid = ptid;
write_register (MEP_PC_REGNUM, pc);
inferior_ptid = saved_ptid;
regcache_cooked_write_unsigned (regcache, MEP_PC_REGNUM, pc);
}

View File

@ -1054,13 +1054,13 @@ mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
}
static void
mips_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
mips_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
write_register_pid (PC_REGNUM, pc, ptid);
regcache_cooked_write_unsigned (regcache, PC_REGNUM, pc);
/* Clear the syscall restart flag. */
if (mips_linux_restart_reg_p (current_gdbarch))
write_register_pid (MIPS_RESTART_REGNUM, 0, ptid);
regcache_cooked_write_unsigned (regcache, MIPS_RESTART_REGNUM, 0);
}
/* Return 1 if MIPS_RESTART_REGNUM is usable. */

View File

@ -266,36 +266,6 @@ unmake_mips16_addr (CORE_ADDR addr)
return ((addr) & ~(CORE_ADDR) 1);
}
/* Return the contents of register REGNUM as a signed integer. */
static LONGEST
read_signed_register (int regnum)
{
LONGEST val;
regcache_cooked_read_signed (current_regcache, regnum, &val);
return val;
}
static LONGEST
read_signed_register_pid (int regnum, ptid_t ptid)
{
ptid_t save_ptid;
LONGEST retval;
if (ptid_equal (ptid, inferior_ptid))
return read_signed_register (regnum);
save_ptid = inferior_ptid;
inferior_ptid = ptid;
retval = read_signed_register (regnum);
inferior_ptid = save_ptid;
return retval;
}
/* Return the MIPS ABI associated with GDBARCH. */
enum mips_abi
mips_abi (struct gdbarch *gdbarch)
@ -926,9 +896,12 @@ mips_pc_is_mips16 (CORE_ADDR memaddr)
all registers should be sign extended for simplicity? */
static CORE_ADDR
mips_read_pc (ptid_t ptid)
mips_read_pc (struct regcache *regcache)
{
return read_signed_register_pid (mips_regnum (current_gdbarch)->pc, ptid);
ULONGEST pc;
int regnum = mips_regnum (get_regcache_arch (regcache))->pc;
regcache_cooked_read_signed (regcache, regnum, &pc);
return pc;
}
static CORE_ADDR
@ -963,9 +936,10 @@ mips_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
}
static void
mips_write_pc (CORE_ADDR pc, ptid_t ptid)
mips_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
write_register_pid (mips_regnum (current_gdbarch)->pc, pc, ptid);
int regnum = mips_regnum (get_regcache_arch (regcache))->pc;
regcache_cooked_write_unsigned (regcache, regnum, pc);
}
/* Fetch and return instruction from the specified location. If the PC

View File

@ -269,15 +269,17 @@ mn10300_register_type (struct gdbarch *gdbarch, int reg)
}
static CORE_ADDR
mn10300_read_pc (ptid_t ptid)
mn10300_read_pc (struct regcache *regcache)
{
return read_register_pid (E_PC_REGNUM, ptid);
ULONGEST val;
regcache_cooked_read_unsigned (regcache, E_PC_REGNUM, &val);
return val;
}
static void
mn10300_write_pc (CORE_ADDR val, ptid_t ptid)
mn10300_write_pc (struct regcache *regcache, CORE_ADDR val)
{
return write_register_pid (E_PC_REGNUM, val, ptid);
regcache_cooked_write_unsigned (regcache, E_PC_REGNUM, val);
}
/* The breakpoint instruction must be the same size as the smallest

View File

@ -887,6 +887,9 @@ regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
CORE_ADDR
read_pc_pid (ptid_t ptid)
{
struct regcache *regcache = current_regcache;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
ptid_t saved_inferior_ptid;
CORE_ADDR pc_val;
@ -894,12 +897,13 @@ read_pc_pid (ptid_t ptid)
saved_inferior_ptid = inferior_ptid;
inferior_ptid = ptid;
if (TARGET_READ_PC_P ())
pc_val = TARGET_READ_PC (ptid);
if (gdbarch_read_pc_p (gdbarch))
pc_val = gdbarch_read_pc (gdbarch, regcache);
/* Else use per-frame method on get_current_frame. */
else if (PC_REGNUM >= 0)
{
CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid);
ULONGEST raw_val;
regcache_cooked_read_unsigned (regcache, PC_REGNUM, &raw_val);
pc_val = gdbarch_addr_bits_remove (current_gdbarch, raw_val);
}
else
@ -915,26 +919,25 @@ read_pc (void)
return read_pc_pid (inferior_ptid);
}
void
generic_target_write_pc (CORE_ADDR pc, ptid_t ptid)
{
if (PC_REGNUM >= 0)
write_register_pid (PC_REGNUM, pc, ptid);
else
internal_error (__FILE__, __LINE__,
_("generic_target_write_pc"));
}
void
write_pc_pid (CORE_ADDR pc, ptid_t ptid)
{
struct regcache *regcache = current_regcache;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
ptid_t saved_inferior_ptid;
/* In case ptid != inferior_ptid. */
saved_inferior_ptid = inferior_ptid;
inferior_ptid = ptid;
TARGET_WRITE_PC (pc, ptid);
if (gdbarch_write_pc_p (gdbarch))
gdbarch_write_pc (gdbarch, regcache, pc);
else if (PC_REGNUM >= 0)
regcache_cooked_write_unsigned (regcache, PC_REGNUM, pc);
else
internal_error (__FILE__, __LINE__,
_("write_pc_pid: Unable to update PC"));
inferior_ptid = saved_inferior_ptid;
}

View File

@ -3498,8 +3498,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_num_regs (gdbarch, v->nregs);
set_gdbarch_num_pseudo_regs (gdbarch, v->npregs);
set_gdbarch_register_name (gdbarch, rs6000_register_name);

View File

@ -2669,8 +2669,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_return_value (gdbarch, sh_return_value_nofpu);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
sh_extract_struct_value_address);

View File

@ -2486,8 +2486,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh64);
set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_return_value (gdbarch, sh64_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
sh64_extract_struct_value_address);

View File

@ -1348,12 +1348,12 @@ sparc_software_single_step (struct frame_info *frame)
}
static void
sparc_write_pc (CORE_ADDR pc, ptid_t ptid)
sparc_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
write_register_pid (tdep->pc_regnum, pc, ptid);
write_register_pid (tdep->npc_regnum, pc + 4, ptid);
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
}
/* Unglobalize NAME. */

View File

@ -938,19 +938,22 @@ spu_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
}
static CORE_ADDR
spu_read_pc (ptid_t ptid)
spu_read_pc (struct regcache *regcache)
{
CORE_ADDR pc = read_register_pid (SPU_PC_REGNUM, ptid);
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &pc);
/* Mask off interrupt enable bit. */
return pc & -4;
}
static void
spu_write_pc (CORE_ADDR pc, ptid_t ptid)
spu_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
/* Keep interrupt enabled state unchanged. */
CORE_ADDR old_pc = read_register_pid (SPU_PC_REGNUM, ptid);
write_register_pid (SPU_PC_REGNUM, (pc & -4) | (old_pc & 3), ptid);
ULONGEST old_pc;
regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &old_pc);
regcache_cooked_write_unsigned (regcache, SPU_PC_REGNUM,
(pc & -4) | (old_pc & 3));
}

View File

@ -825,8 +825,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
/* Stack grows up. */
set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);