aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2018-02-21 11:20:03 +0000
committerYao Qi <yao.qi@linaro.org>2018-02-21 11:20:03 +0000
commitc113ed0ca238bbcbc161f059ffe9b064e3ece333 (patch)
tree340c35692c16253bd46f44a8f978a989f685376c /gdb
parent4c74fe6b84d82066eb3f004bacd4a376cd82d140 (diff)
downloadgdb-c113ed0ca238bbcbc161f059ffe9b064e3ece333.zip
gdb-c113ed0ca238bbcbc161f059ffe9b064e3ece333.tar.gz
gdb-c113ed0ca238bbcbc161f059ffe9b064e3ece333.tar.bz2
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog13
-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
9 files changed, 31 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c1b1d48..e58bc38 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
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
* regcache-dump.c: New file.
* regcache.c: Move register_dump to regcache-dump.c.
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 7f88e8f..c44a3aa 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 705a6d3..62cb9a5 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 249ad61..30c2bf3 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 8477dd7..10a2aa9 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 cc9434e..84dbd66 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 6c9b341..4f02f05 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 2c1a8f0..05f27a5 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 a632c06..695b5cc 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);
}