summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2018-01-30 14:41:17 +0000
committerYao Qi <yao.qi@linaro.org>2018-02-07 09:56:49 +0000
commitaa3a1b12baa9b28f038b9495ab4b3e6eb9750e96 (patch)
tree1f0a7686e71c577aa6386c7133771a6f134b4a91
parent9d8da229109644f66a2ecf933ed3ad23c51c786f (diff)
downloadbinutils-gdb-users/qiyao/regcache-split-4-2.tar.gz
Pass readable_regcache to gdbarch method read_pcusers/qiyao/regcache-split-4-2
We can pass readable_regcache to gdbarch method read_pc where it is allowed to do read from regcache. gdb: 2018-01-30 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.
-rw-r--r--gdb/avr-tdep.c5
-rw-r--r--gdb/gdbarch.c2
-rw-r--r--gdb/gdbarch.h4
-rwxr-xr-xgdb/gdbarch.sh2
-rw-r--r--gdb/hppa-tdep.c6
-rw-r--r--gdb/ia64-tdep.c6
-rw-r--r--gdb/mips-tdep.c4
-rw-r--r--gdb/spu-tdep.c5
8 files changed, 18 insertions, 16 deletions
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 7f88e8f5fdb..c44a3aa9677 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -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);
}
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 705a6d36b0b..62cb9a5d88a 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -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);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 249ad614fc8..30c2bf3af3a 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -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);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 8477dd7e91e..10a2aa9f6f2 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -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
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index cc9434e14eb..84dbd667485 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -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
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 6c9b341af80..4f02f053758 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -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);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 2c1a8f0d9e5..05f27a516c9 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -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;
}
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index a632c0656e9..695b5cca0dc 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -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);
}