Pass readable_regcache to gdbarch method read_pc

We can pass readable_regcache to gdbarch method read_pc where it is
allowed to do read from regcache.

gdb:

2018-02-21  Yao Qi  <yao.qi@linaro.org>

	* avr-tdep.c (avr_read_pc): Change parameter type to
	readable_regcache.
	* gdbarch.sh (read_pc): Likewise.
	* gdbarch.c: Re-generated.
	* gdbarch.h: Re-generated.
	* hppa-tdep.c (hppa_read_pc): Change parameter type to
	readable_regcache.
	* ia64-tdep.c (ia64_read_pc): Likewise.
	* mips-tdep.c (mips_read_pc): Likewise.
	* spu-tdep.c (spu_read_pc): Likewise.
This commit is contained in:
Yao Qi 2018-02-21 11:20:03 +00:00
parent 4c74fe6b84
commit c113ed0ca2
9 changed files with 31 additions and 16 deletions

View File

@ -1,3 +1,16 @@
2018-02-21 Yao Qi <yao.qi@linaro.org>
* avr-tdep.c (avr_read_pc): Change parameter type to
readable_regcache.
* gdbarch.sh (read_pc): Likewise.
* gdbarch.c: Re-generated.
* gdbarch.h: Re-generated.
* hppa-tdep.c (hppa_read_pc): Change parameter type to
readable_regcache.
* ia64-tdep.c (ia64_read_pc): Likewise.
* mips-tdep.c (mips_read_pc): Likewise.
* spu-tdep.c (spu_read_pc): Likewise.
2018-02-21 Yao Qi <yao.qi@linaro.org>
* Makefile.in (COMMON_SFILES): Add regcache-dump.c

View File

@ -367,10 +367,11 @@ avr_integer_to_address (struct gdbarch *gdbarch,
}
static CORE_ADDR
avr_read_pc (struct regcache *regcache)
avr_read_pc (readable_regcache *regcache)
{
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, AVR_PC_REGNUM, &pc);
regcache->cooked_read (AVR_PC_REGNUM, &pc);
return avr_make_iaddr (pc);
}

View File

@ -1906,7 +1906,7 @@ gdbarch_read_pc_p (struct gdbarch *gdbarch)
}
CORE_ADDR
gdbarch_read_pc (struct gdbarch *gdbarch, struct regcache *regcache)
gdbarch_read_pc (struct gdbarch *gdbarch, readable_regcache *regcache)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->read_pc != NULL);

View File

@ -245,8 +245,8 @@ extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed);
extern int gdbarch_read_pc_p (struct gdbarch *gdbarch);
typedef CORE_ADDR (gdbarch_read_pc_ftype) (struct regcache *regcache);
extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, struct regcache *regcache);
typedef CORE_ADDR (gdbarch_read_pc_ftype) (readable_regcache *regcache);
extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, readable_regcache *regcache);
extern void set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc);
extern int gdbarch_write_pc_p (struct gdbarch *gdbarch);

View File

@ -422,7 +422,7 @@ v;int;dwarf2_addr_size;;;sizeof (void*);0;gdbarch_ptr_bit (gdbarch) / TARGET_CHA
# One if \`char' acts like \`signed char', zero if \`unsigned char'.
v;int;char_signed;;;1;-1;1
#
F;CORE_ADDR;read_pc;struct regcache *regcache;regcache
F;CORE_ADDR;read_pc;readable_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

View File

@ -1304,13 +1304,13 @@ hppa64_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
}
CORE_ADDR
hppa_read_pc (struct regcache *regcache)
hppa_read_pc (readable_regcache *regcache)
{
ULONGEST ipsw;
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, HPPA_IPSW_REGNUM, &ipsw);
regcache_cooked_read_unsigned (regcache, HPPA_PCOQ_HEAD_REGNUM, &pc);
regcache->cooked_read (HPPA_IPSW_REGNUM, &ipsw);
regcache->cooked_read (HPPA_PCOQ_HEAD_REGNUM, &pc);
/* If the current instruction is nullified, then we are effectively
still executing the previous instruction. Pretend we are still

View File

@ -876,13 +876,13 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
}
static CORE_ADDR
ia64_read_pc (struct regcache *regcache)
ia64_read_pc (readable_regcache *regcache)
{
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);
regcache->cooked_read (IA64_PSR_REGNUM, &psr_value);
regcache->cooked_read (IA64_IP_REGNUM, &pc_value);
slot_num = (psr_value >> 41) & 3;
return pc_value | (slot_num * SLOT_MULTIPLIER);

View File

@ -1362,12 +1362,12 @@ mips_in_frame_stub (CORE_ADDR pc)
all registers should be sign extended for simplicity? */
static CORE_ADDR
mips_read_pc (struct regcache *regcache)
mips_read_pc (readable_regcache *regcache)
{
int regnum = gdbarch_pc_regnum (regcache->arch ());
LONGEST pc;
regcache_cooked_read_signed (regcache, regnum, &pc);
regcache->cooked_read (regnum, &pc);
return pc;
}

View File

@ -1176,11 +1176,12 @@ spu_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
}
static CORE_ADDR
spu_read_pc (struct regcache *regcache)
spu_read_pc (readable_regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, SPU_PC_REGNUM, &pc);
regcache->cooked_read (SPU_PC_REGNUM, &pc);
/* Mask off interrupt enable bit. */
return SPUADDR (tdep->id, pc & -4);
}