aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@linaro.org>2021-01-14 15:43:28 -0300
committerLuis Machado <luis.machado@linaro.org>2021-01-19 14:43:34 -0300
commita9a87d3525c2c32c92f0bcfc450ef005fa1f2863 (patch)
tree96edb8ea0e7363200182efc5683c30a86408268b
parentbdec2917b1e94c7198ba39919f45060067952f43 (diff)
downloadfsf-binutils-gdb-a9a87d3525c2c32c92f0bcfc450ef005fa1f2863.zip
fsf-binutils-gdb-a9a87d3525c2c32c92f0bcfc450ef005fa1f2863.tar.gz
fsf-binutils-gdb-a9a87d3525c2c32c92f0bcfc450ef005fa1f2863.tar.bz2
trad-frame cleanups
With the new member functions for struct trad_frame_saved_reg, there is no need to invoke some of the set/get functions anymore. This patch removes those and adjusts all callers. Even though the most natural initial state of a saved register value is UNKNOWN, there are target backends relying on the previous initial state of REALREG set to a register's own number. I noticed this in at least a couple targets: aarch64 and riscv. Because of that, I decided to keep the reset function that sets the set of register values to REALREG. I can't exercise all the targets to make sure the initial state change won't break things, hence why it is risky to change the default. Validated with --enable-targets=all on aarch64-linux Ubuntu 18.04/20.04. gdb/ChangeLog 2021-01-19 Luis Machado <luis.machado@linaro.org> * trad-frame.h (trad_frame_saved_reg) <set_value_bytes>: Allocate memory and save data. (trad_frame_set_value, trad_frame_set_realreg, trad_frame_set_addr) (trad_frame_set_unknown, trad_frame_set_value_bytes) (trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p) (trad_frame_value_bytes_p): Remove. (trad_frame_reset_saved_regs): Adjust documentation. * trad-frame.c (trad_frame_alloc_saved_regs): Initialize via a constructor and reset the state of the registers. (trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p) (trad_frame_value_bytes_p, trad_frame_set_value) (trad_frame_set_realreg, trad_frame_set_addr) (trad_frame_set_unknown, trad_frame_set_value_bytes): Remove. (trad_frame_set_reg_realreg): Update to call member function. (trad_frame_set_reg_addr, trad_frame_set_reg_value_bytes): Likewise. (trad_frame_get_prev_register): Likewise. * aarch64-tdep.c (aarch64_analyze_prologue) (aarch64_analyze_prologue_test, aarch64_make_prologue_cache_1) (aarch64_prologue_prev_register): Update to use member functions. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise. * arc-tdep.c (arc_print_frame_cache, arc_make_frame_cache): Likewise. * arm-tdep.c (arm_make_prologue_cache, arm_exidx_fill_cache) (arm_make_epilogue_frame_cache): Likewise. * avr-tdep.c (avr_frame_unwind_cache) (avr_frame_prev_register): Likewise. * cris-tdep.c (cris_scan_prologue): Likewise. * csky-tdep.c (csky_frame_unwind_cache): Likewise. * frv-tdep.c (frv_analyze_prologue): Likewise. * hppa-tdep.c (hppa_frame_cache, hppa_fallback_frame_cache): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * mips-tdep.c (set_reg_offset, mips_insn16_frame_cache) (mips_micro_frame_cache, mips_insn32_frame_cache): Likewise. (reset_saved_regs): Adjust to set realreg. * riscv-tdep.c (riscv_scan_prologue, riscv_frame_cache): Adjust to call member functions. * rs6000-tdep.c (rs6000_frame_cache, rs6000_epilogue_frame_cache) * s390-tdep.c (s390_prologue_frame_unwind_cache) (s390_backchain_frame_unwind_cache): Likewise. * score-tdep.c (score7_analyze_prologue) (score3_analyze_prologue, score_make_prologue_cache): Likewise. * sparc-netbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc64-netbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * tilegx-tdep.c (tilegx_analyze_prologue) (tilegx_frame_cache): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * vax-tdep.c (vax_frame_cache): Likewise.
-rw-r--r--gdb/ChangeLog55
-rw-r--r--gdb/aarch64-tdep.c46
-rw-r--r--gdb/alpha-mdebug-tdep.c4
-rw-r--r--gdb/alpha-tdep.c8
-rw-r--r--gdb/arc-tdep.c4
-rw-r--r--gdb/arm-tdep.c10
-rw-r--r--gdb/avr-tdep.c6
-rw-r--r--gdb/cris-tdep.c3
-rw-r--r--gdb/csky-tdep.c2
-rw-r--r--gdb/frv-tdep.c2
-rw-r--r--gdb/hppa-tdep.c24
-rw-r--r--gdb/lm32-tdep.c4
-rw-r--r--gdb/m32r-tdep.c4
-rw-r--r--gdb/m68hc11-tdep.c4
-rw-r--r--gdb/mips-tdep.c22
-rw-r--r--gdb/riscv-tdep.c9
-rw-r--r--gdb/rs6000-tdep.c6
-rw-r--r--gdb/s390-tdep.c14
-rw-r--r--gdb/score-tdep.c18
-rw-r--r--gdb/sparc-netbsd-tdep.c2
-rw-r--r--gdb/sparc-sol2-tdep.c2
-rw-r--r--gdb/sparc64-netbsd-tdep.c2
-rw-r--r--gdb/sparc64-sol2-tdep.c2
-rw-r--r--gdb/tilegx-tdep.c16
-rw-r--r--gdb/trad-frame.c93
-rw-r--r--gdb/trad-frame.h46
-rw-r--r--gdb/v850-tdep.c5
-rw-r--r--gdb/vax-tdep.c2
28 files changed, 183 insertions, 232 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index aeb0894..3c8379c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,60 @@
2021-01-19 Luis Machado <luis.machado@linaro.org>
+ * trad-frame.h (trad_frame_saved_reg) <set_value_bytes>: Allocate
+ memory and save data.
+ (trad_frame_set_value, trad_frame_set_realreg, trad_frame_set_addr)
+ (trad_frame_set_unknown, trad_frame_set_value_bytes)
+ (trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
+ (trad_frame_value_bytes_p): Remove.
+ (trad_frame_reset_saved_regs): Adjust documentation.
+ * trad-frame.c (trad_frame_alloc_saved_regs): Initialize via a
+ constructor and reset the state of the registers.
+ (trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
+ (trad_frame_value_bytes_p, trad_frame_set_value)
+ (trad_frame_set_realreg, trad_frame_set_addr)
+ (trad_frame_set_unknown, trad_frame_set_value_bytes): Remove.
+ (trad_frame_set_reg_realreg): Update to call member function.
+ (trad_frame_set_reg_addr, trad_frame_set_reg_value_bytes): Likewise.
+ (trad_frame_get_prev_register): Likewise.
+
+ * aarch64-tdep.c (aarch64_analyze_prologue)
+ (aarch64_analyze_prologue_test, aarch64_make_prologue_cache_1)
+ (aarch64_prologue_prev_register): Update to use member functions.
+ * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
+ * alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise.
+ * arc-tdep.c (arc_print_frame_cache, arc_make_frame_cache): Likewise.
+ * arm-tdep.c (arm_make_prologue_cache, arm_exidx_fill_cache)
+ (arm_make_epilogue_frame_cache): Likewise.
+ * avr-tdep.c (avr_frame_unwind_cache)
+ (avr_frame_prev_register): Likewise.
+ * cris-tdep.c (cris_scan_prologue): Likewise.
+ * csky-tdep.c (csky_frame_unwind_cache): Likewise.
+ * frv-tdep.c (frv_analyze_prologue): Likewise.
+ * hppa-tdep.c (hppa_frame_cache, hppa_fallback_frame_cache): Likewise.
+ * lm32-tdep.c (lm32_frame_cache): Likewise.
+ * m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
+ * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
+ * mips-tdep.c (set_reg_offset, mips_insn16_frame_cache)
+ (mips_micro_frame_cache, mips_insn32_frame_cache): Likewise.
+ (reset_saved_regs): Adjust to set realreg.
+ * riscv-tdep.c (riscv_scan_prologue, riscv_frame_cache): Adjust to
+ call member functions.
+ * rs6000-tdep.c (rs6000_frame_cache, rs6000_epilogue_frame_cache)
+ * s390-tdep.c (s390_prologue_frame_unwind_cache)
+ (s390_backchain_frame_unwind_cache): Likewise.
+ * score-tdep.c (score7_analyze_prologue)
+ (score3_analyze_prologue, score_make_prologue_cache): Likewise.
+ * sparc-netbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
+ * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
+ * sparc64-netbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
+ * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
+ * tilegx-tdep.c (tilegx_analyze_prologue)
+ (tilegx_frame_cache): Likewise.
+ * v850-tdep.c (v850_frame_cache): Likewise.
+ * vax-tdep.c (vax_frame_cache): Likewise.
+
+2021-01-19 Luis Machado <luis.machado@linaro.org>
+
* frame.h (get_frame_register_bytes): Pass a gdb::array_view instead
of buffer + length.
(put_frame_register_bytes): Likewise.
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 7099f18..3e26a95 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -518,9 +518,10 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
}
if (tdep->has_pauth () && cache != nullptr)
- trad_frame_set_value (cache->saved_regs,
- tdep->pauth_ra_state_regnum,
- ra_state_val);
+ {
+ int regnum = tdep->pauth_ra_state_regnum;
+ cache->saved_regs[regnum].set_value (ra_state_val);
+ }
}
else
{
@@ -653,15 +654,17 @@ aarch64_analyze_prologue_test (void)
else if (i == AARCH64_LR_REGNUM)
SELF_CHECK (cache.saved_regs[i].addr () == -264);
else
- SELF_CHECK (cache.saved_regs[i].is_realreg ());
+ SELF_CHECK (cache.saved_regs[i].is_realreg ()
+ && cache.saved_regs[i].realreg () == i);
}
for (int i = 0; i < AARCH64_D_REGISTER_COUNT; i++)
{
- int regnum = gdbarch_num_regs (gdbarch);
+ int num_regs = gdbarch_num_regs (gdbarch);
+ int regnum = i + num_regs + AARCH64_D0_REGNUM;
- SELF_CHECK (cache.saved_regs[i + regnum
- + AARCH64_D0_REGNUM].is_realreg ());
+ SELF_CHECK (cache.saved_regs[regnum].is_realreg ()
+ && cache.saved_regs[regnum].realreg () == regnum);
}
}
@@ -693,20 +696,21 @@ aarch64_analyze_prologue_test (void)
else if (i == 19)
SELF_CHECK (cache.saved_regs[i].addr () == -48);
else
- SELF_CHECK (cache.saved_regs[i].is_realreg ());
+ SELF_CHECK (cache.saved_regs[i].is_realreg ()
+ && cache.saved_regs[i].realreg () == i);
}
for (int i = 0; i < AARCH64_D_REGISTER_COUNT; i++)
{
- int regnum = gdbarch_num_regs (gdbarch);
+ int num_regs = gdbarch_num_regs (gdbarch);
+ int regnum = i + num_regs + AARCH64_D0_REGNUM;
+
if (i == 0)
- SELF_CHECK (cache.saved_regs[i + regnum
- + AARCH64_D0_REGNUM].addr ()
- == -24);
+ SELF_CHECK (cache.saved_regs[regnum].addr () == -24);
else
- SELF_CHECK (cache.saved_regs[i + regnum
- + AARCH64_D0_REGNUM].is_realreg ());
+ SELF_CHECK (cache.saved_regs[regnum].is_realreg ()
+ && cache.saved_regs[regnum].realreg () == regnum);
}
}
@@ -850,15 +854,14 @@ aarch64_analyze_prologue_test (void)
else if (i == AARCH64_LR_REGNUM)
SELF_CHECK (cache.saved_regs[i].addr () == -40);
else
- SELF_CHECK (cache.saved_regs[i].is_realreg ());
+ SELF_CHECK (cache.saved_regs[i].is_realreg ()
+ && cache.saved_regs[i].realreg () == i);
}
if (tdep->has_pauth ())
{
- SELF_CHECK (trad_frame_value_p (cache.saved_regs,
- tdep->pauth_ra_state_regnum));
- SELF_CHECK (cache.saved_regs[tdep->pauth_ra_state_regnum].addr ()
- == 1);
+ int regnum = tdep->pauth_ra_state_regnum;
+ SELF_CHECK (cache.saved_regs[regnum].is_value ());
}
}
}
@@ -977,7 +980,7 @@ aarch64_make_prologue_cache_1 (struct frame_info *this_frame,
/* Calculate actual addresses of saved registers using offsets
determined by aarch64_analyze_prologue. */
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
- if (trad_frame_addr_p (cache->saved_regs, reg))
+ if (cache->saved_regs[reg].is_addr ())
cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
+ cache->prev_sp);
@@ -1076,8 +1079,7 @@ aarch64_prologue_prev_register (struct frame_info *this_frame,
lr = frame_unwind_register_unsigned (this_frame, AARCH64_LR_REGNUM);
if (tdep->has_pauth ()
- && trad_frame_value_p (cache->saved_regs,
- tdep->pauth_ra_state_regnum))
+ && cache->saved_regs[tdep->pauth_ra_state_regnum].is_value ())
lr = aarch64_frame_unmask_lr (tdep, this_frame, lr);
return frame_unwind_got_constant (this_frame, prev_regnum, lr);
diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
index 8024e4a..a062ad9 100644
--- a/gdb/alpha-mdebug-tdep.c
+++ b/gdb/alpha-mdebug-tdep.c
@@ -254,8 +254,8 @@ alpha_mdebug_frame_unwind_cache (struct frame_info *this_frame,
/* The stack pointer of the previous frame is computed by popping
the current stack frame. */
- if (!trad_frame_addr_p (info->saved_regs, ALPHA_SP_REGNUM))
- trad_frame_set_value (info->saved_regs, ALPHA_SP_REGNUM, vfp);
+ if (!info->saved_regs[ALPHA_SP_REGNUM].is_addr ())
+ info->saved_regs[ALPHA_SP_REGNUM].set_value (vfp);
return info;
}
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index d80109f..90ff813 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1289,7 +1289,7 @@ alpha_heuristic_frame_unwind_cache (struct frame_info *this_frame,
All it says is that the function we are scanning reused
that register for some computation of its own, and is now
saving its result. */
- if (trad_frame_addr_p(info->saved_regs, reg))
+ if (info->saved_regs[reg].is_addr ())
continue;
if (reg == 31)
@@ -1385,14 +1385,14 @@ alpha_heuristic_frame_unwind_cache (struct frame_info *this_frame,
/* Convert offsets to absolute addresses. See above about adding
one to the offsets to make all detected offsets non-zero. */
for (reg = 0; reg < ALPHA_NUM_REGS; ++reg)
- if (trad_frame_addr_p(info->saved_regs, reg))
+ if (info->saved_regs[reg].is_addr ())
info->saved_regs[reg].set_addr (info->saved_regs[reg].addr ()
+ val - 1);
/* The stack pointer of the previous frame is computed by popping
the current stack frame. */
- if (!trad_frame_addr_p (info->saved_regs, ALPHA_SP_REGNUM))
- trad_frame_set_value (info->saved_regs, ALPHA_SP_REGNUM, info->vfp);
+ if (!info->saved_regs[ALPHA_SP_REGNUM].is_addr ())
+ info->saved_regs[ALPHA_SP_REGNUM].set_value (info->vfp);
return info;
}
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 8385ad7..e00216e 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1652,7 +1652,7 @@ arc_print_frame_cache (struct gdbarch *gdbarch, const char *message,
for (int i = 0; i <= ARC_BLINK_REGNUM; i++)
{
- if (trad_frame_addr_p (cache->saved_regs, i))
+ if (cache->saved_regs[i].is_addr ())
arc_debug_printf ("saved register %s at %s %s",
gdbarch_register_name (gdbarch, i),
(addresses_known) ? "address" : "offset",
@@ -1716,7 +1716,7 @@ arc_make_frame_cache (struct frame_info *this_frame)
for (int i = 0; i <= ARC_LAST_CORE_REGNUM; i++)
{
- if (trad_frame_addr_p (cache->saved_regs, i))
+ if (cache->saved_regs[i].is_addr ())
cache->saved_regs[i].set_addr (cache->saved_regs[i].addr ()
+ cache->prev_sp);
}
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 9e4cf07..0184c25 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1906,7 +1906,7 @@ arm_make_prologue_cache (struct frame_info *this_frame)
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
- if (trad_frame_addr_p (cache->saved_regs, reg))
+ if (cache->saved_regs[reg].is_addr ())
cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
+ cache->prev_sp);
@@ -2366,7 +2366,7 @@ arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry)
actual value in the current frame. */
if (!vsp_valid)
{
- if (trad_frame_realreg_p (cache->saved_regs, ARM_SP_REGNUM))
+ if (cache->saved_regs[ARM_SP_REGNUM].is_realreg ())
{
int reg = cache->saved_regs[ARM_SP_REGNUM].realreg ();
vsp = get_frame_register_unsigned (this_frame, reg);
@@ -2452,7 +2452,7 @@ arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry)
{
/* We could only have updated PC by popping into it; if so, it
will show up as address. Otherwise, copy LR into PC. */
- if (!trad_frame_addr_p (cache->saved_regs, ARM_PC_REGNUM))
+ if (!cache->saved_regs[ARM_PC_REGNUM].is_addr ())
cache->saved_regs[ARM_PC_REGNUM]
= cache->saved_regs[ARM_LR_REGNUM];
@@ -2623,7 +2623,7 @@ arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry)
/* If we restore SP from a register, assume this was the frame register.
Otherwise just fall back to SP as frame register. */
- if (trad_frame_realreg_p (cache->saved_regs, ARM_SP_REGNUM))
+ if (cache->saved_regs[ARM_SP_REGNUM].is_realreg ())
cache->framereg = cache->saved_regs[ARM_SP_REGNUM].realreg ();
else
cache->framereg = ARM_SP_REGNUM;
@@ -2760,7 +2760,7 @@ arm_make_epilogue_frame_cache (struct frame_info *this_frame)
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
- if (trad_frame_addr_p (cache->saved_regs, reg))
+ if (cache->saved_regs[reg].is_addr ())
cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
+ cache->prev_sp);
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index e9493f1..815c6d4 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1050,8 +1050,8 @@ avr_frame_unwind_cache (struct frame_info *this_frame,
/* The previous frame's SP needed to be computed. Save the computed
value. */
tdep = gdbarch_tdep (gdbarch);
- trad_frame_set_value (info->saved_regs, AVR_SP_REGNUM,
- info->prev_sp - 1 + tdep->call_length);
+ info->saved_regs[AVR_SP_REGNUM].set_value (info->prev_sp
+ - 1 + tdep->call_length);
return info;
}
@@ -1113,7 +1113,7 @@ avr_frame_prev_register (struct frame_info *this_frame,
if (regnum == AVR_PC_REGNUM || regnum == AVR_PSEUDO_PC_REGNUM)
{
- if (trad_frame_addr_p (info->saved_regs, AVR_PC_REGNUM))
+ if (info->saved_regs[AVR_PC_REGNUM].is_addr ())
{
/* Reading the return PC from the PC register is slightly
abnormal. register_size(AVR_PC_REGNUM) says it is 4 bytes,
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index a33fdc1..e1c1418 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1259,8 +1259,7 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
/* The previous frame's SP needed to be computed. Save the computed
value. */
- trad_frame_set_value (info->saved_regs,
- gdbarch_sp_regnum (gdbarch), info->prev_sp);
+ info->saved_regs[gdbarch_sp_regnum (gdbarch)].set_value (info->prev_sp);
if (!info->leaf_function)
{
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 55ebca6..3ec18a2 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -1871,7 +1871,7 @@ csky_frame_unwind_cache (struct frame_info *this_frame)
func_end, this_frame, cache, lr_type);
/* gdbarch_sp_regnum contains the value and not the address. */
- trad_frame_set_value (cache->saved_regs, sp_regnum, cache->prev_sp);
+ cache->saved_regs[sp_regnum].set_value (cache->prev_sp);
return cache;
}
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 2db7319..f5edfc7 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -967,7 +967,7 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
info->saved_regs[pc_regnum] = info->saved_regs[lr_regnum];
/* Save the previous frame's computed SP value. */
- trad_frame_set_value (info->saved_regs, sp_regnum, info->prev_sp);
+ info->saved_regs[sp_regnum].set_value (info->prev_sp);
}
return last_prologue_pc;
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 786dda6..70a518e 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2163,7 +2163,7 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
paddress (gdbarch, cache->base));
}
else if (u->Save_SP
- && trad_frame_addr_p (cache->saved_regs, HPPA_SP_REGNUM))
+ && cache->saved_regs[HPPA_SP_REGNUM].is_addr ())
{
/* Both we're expecting the SP to be saved and the SP has been
saved. The entry SP value is saved at this frame's SP
@@ -2184,14 +2184,14 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
paddress (gdbarch, cache->base));
}
- trad_frame_set_value (cache->saved_regs, HPPA_SP_REGNUM, cache->base);
+ cache->saved_regs[HPPA_SP_REGNUM].set_value (cache->base);
}
/* The PC is found in the "return register", "Millicode" uses "r31"
as the return register while normal code uses "rp". */
if (u->Millicode)
{
- if (trad_frame_addr_p (cache->saved_regs, 31))
+ if (cache->saved_regs[31].is_addr ())
{
cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] = cache->saved_regs[31];
if (hppa_debug)
@@ -2200,14 +2200,14 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
else
{
ULONGEST r31 = get_frame_register_unsigned (this_frame, 31);
- trad_frame_set_value (cache->saved_regs, HPPA_PCOQ_HEAD_REGNUM, r31);
+ cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM].set_value (r31);
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (pc=r31) [frame] } ");
}
}
else
{
- if (trad_frame_addr_p (cache->saved_regs, HPPA_RP_REGNUM))
+ if (cache->saved_regs[HPPA_RP_REGNUM].is_addr ())
{
cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] =
cache->saved_regs[HPPA_RP_REGNUM];
@@ -2218,7 +2218,7 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
{
ULONGEST rp = get_frame_register_unsigned (this_frame,
HPPA_RP_REGNUM);
- trad_frame_set_value (cache->saved_regs, HPPA_PCOQ_HEAD_REGNUM, rp);
+ cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM].set_value (rp);
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (pc=rp) [frame] } ");
}
@@ -2238,11 +2238,11 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
on the stack, but it's been overwritten. The prologue analyzer will
set fp_in_r1 when it sees the copy insn so we know to get the value
from r1 instead. */
- if (u->Save_SP && !trad_frame_addr_p (cache->saved_regs, HPPA_FP_REGNUM)
+ if (u->Save_SP && !cache->saved_regs[HPPA_FP_REGNUM].is_addr ()
&& fp_in_r1)
{
ULONGEST r1 = get_frame_register_unsigned (this_frame, 1);
- trad_frame_set_value (cache->saved_regs, HPPA_FP_REGNUM, r1);
+ cache->saved_regs[HPPA_FP_REGNUM].set_value (r1);
}
{
@@ -2250,7 +2250,7 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
int reg;
for (reg = 0; reg < gdbarch_num_regs (gdbarch); reg++)
{
- if (trad_frame_addr_p (cache->saved_regs, reg))
+ if (cache->saved_regs[reg].is_addr ())
cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
+ cache->base);
}
@@ -2376,9 +2376,9 @@ hppa_fallback_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
cache->base -= frame_size;
- trad_frame_set_value (cache->saved_regs, HPPA_SP_REGNUM, cache->base);
+ cache->saved_regs[HPPA_SP_REGNUM].set_value (cache->base);
- if (trad_frame_addr_p (cache->saved_regs, HPPA_RP_REGNUM))
+ if (cache->saved_regs[HPPA_RP_REGNUM].is_addr ())
{
cache->saved_regs[HPPA_RP_REGNUM].set_addr (cache->saved_regs[HPPA_RP_REGNUM].addr ()
+ cache->base);
@@ -2389,7 +2389,7 @@ hppa_fallback_frame_cache (struct frame_info *this_frame, void **this_cache)
{
ULONGEST rp;
rp = get_frame_register_unsigned (this_frame, HPPA_RP_REGNUM);
- trad_frame_set_value (cache->saved_regs, HPPA_PCOQ_HEAD_REGNUM, rp);
+ cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM].set_value (rp);
}
return cache;
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 8f1961c..0a3bd07 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -417,7 +417,7 @@ lm32_frame_cache (struct frame_info *this_frame, void **this_prologue_cache)
/* Convert callee save offsets into addresses. */
for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
{
- if (trad_frame_addr_p (info->saved_regs, i))
+ if (info->saved_regs[i].is_addr ())
info->saved_regs[i].set_addr (this_base + info->saved_regs[i].addr ());
}
@@ -429,7 +429,7 @@ lm32_frame_cache (struct frame_info *this_frame, void **this_prologue_cache)
/* The previous frame's SP needed to be computed. Save the computed
value. */
- trad_frame_set_value (info->saved_regs, SIM_LM32_SP_REGNUM, prev_sp);
+ info->saved_regs[SIM_LM32_SP_REGNUM].set_value (prev_sp);
return info;
}
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 9259660..e504f37 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -632,7 +632,7 @@ m32r_frame_unwind_cache (struct frame_info *this_frame,
/* Adjust all the saved registers so that they contain addresses and
not offsets. */
for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
- if (trad_frame_addr_p (info->saved_regs, i))
+ if (info->saved_regs[i].is_addr ())
info->saved_regs[i].set_addr (info->prev_sp
+ info->saved_regs[i].addr ());
@@ -644,7 +644,7 @@ m32r_frame_unwind_cache (struct frame_info *this_frame,
/* The previous frame's SP needed to be computed. Save the computed
value. */
- trad_frame_set_value (info->saved_regs, M32R_SP_REGNUM, prev_sp);
+ info->saved_regs[M32R_SP_REGNUM].set_value (prev_sp);
return info;
}
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 2a12144..4a1d077 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -845,14 +845,14 @@ m68hc11_frame_unwind_cache (struct frame_info *this_frame,
/* Adjust all the saved registers so that they contain addresses and not
offsets. */
for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++)
- if (trad_frame_addr_p (info->saved_regs, i))
+ if (info->saved_regs[i].is_addr ())
{
info->saved_regs[i].set_addr (info->saved_regs[i].addr () + this_base);
}
/* The previous frame's SP needed to be computed. Save the computed
value. */
- trad_frame_set_value (info->saved_regs, HARD_SP_REGNUM, info->prev_sp);
+ info->saved_regs[HARD_SP_REGNUM].set_value (info->prev_sp);
return info;
}
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index e12dffb..61545ae 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -2444,7 +2444,8 @@ set_reg_offset (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache,
int regnum, CORE_ADDR offset)
{
if (this_cache != NULL
- && this_cache->saved_regs[regnum].is_realreg ())
+ && this_cache->saved_regs[regnum].is_realreg ()
+ && this_cache->saved_regs[regnum].realreg () == regnum)
{
this_cache->saved_regs[regnum + 0
* gdbarch_num_regs (gdbarch)].set_addr (offset);
@@ -2861,9 +2862,8 @@ mips_insn16_frame_cache (struct frame_info *this_frame, void **this_cache)
}
/* gdbarch_sp_regnum contains the value and not the address. */
- trad_frame_set_value (cache->saved_regs,
- gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM,
- cache->base);
+ cache->saved_regs[gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM].set_value (cache->base);
return (struct mips_frame_cache *) (*this_cache);
}
@@ -3296,9 +3296,8 @@ mips_micro_frame_cache (struct frame_info *this_frame, void **this_cache)
}
/* gdbarch_sp_regnum contains the value and not the address. */
- trad_frame_set_value (cache->saved_regs,
- gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM,
- cache->base);
+ cache->saved_regs[gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM].set_value (cache->base);
return (struct mips_frame_cache *) (*this_cache);
}
@@ -3388,8 +3387,10 @@ reset_saved_regs (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache)
const int num_regs = gdbarch_num_regs (gdbarch);
int i;
+ /* Reset the register values to their default state. Register i's value
+ is in register i. */
for (i = 0; i < num_regs; i++)
- this_cache->saved_regs[i].set_addr (-1);
+ this_cache->saved_regs[i].set_realreg (i);
}
}
@@ -3672,9 +3673,8 @@ mips_insn32_frame_cache (struct frame_info *this_frame, void **this_cache)
}
/* gdbarch_sp_regnum contains the value and not the address. */
- trad_frame_set_value (cache->saved_regs,
- gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM,
- cache->base);
+ cache->saved_regs[gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM].set_value (cache->base);
return (struct mips_frame_cache *) (*this_cache);
}
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index b16e7d7..460746a 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1864,7 +1864,7 @@ riscv_scan_prologue (struct gdbarch *gdbarch,
gdbarch_register_name (gdbarch, i),
plongest ((LONGEST) offset));
}
- trad_frame_set_addr (cache->regs, i, offset);
+ cache->regs[i].set_addr (offset);
}
}
}
@@ -3145,7 +3145,7 @@ riscv_frame_cache (struct frame_info *this_frame, void **this_cache)
numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
for (regno = 0; regno < numregs; ++regno)
{
- if (trad_frame_addr_p (cache->regs, regno))
+ if (cache->regs[regno].is_addr ())
cache->regs[regno].set_addr (cache->regs[regno].addr ()
+ cache->frame_base);
}
@@ -3154,14 +3154,13 @@ riscv_frame_cache (struct frame_info *this_frame, void **this_cache)
The previous $ra value is gone, this would have been stored be the
previous frame if required. */
cache->regs[gdbarch_pc_regnum (gdbarch)] = cache->regs[RISCV_RA_REGNUM];
- trad_frame_set_unknown (cache->regs, RISCV_RA_REGNUM);
+ cache->regs[RISCV_RA_REGNUM].set_unknown ();
/* Build the frame id. */
cache->this_id = frame_id_build (cache->frame_base, start_addr);
/* The previous $sp value is the frame base value. */
- trad_frame_set_value (cache->regs, gdbarch_sp_regnum (gdbarch),
- cache->frame_base);
+ cache->regs[gdbarch_sp_regnum (gdbarch)].set_value (cache->frame_base);
return cache;
}
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 62848a0..b09f631 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3566,8 +3566,7 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->base = (CORE_ADDR) backchain;
}
- trad_frame_set_value (cache->saved_regs,
- gdbarch_sp_regnum (gdbarch), cache->base);
+ cache->saved_regs[gdbarch_sp_regnum (gdbarch)].set_value (cache->base);
/* if != -1, fdata.saved_fpr is the smallest number of saved_fpr.
All fpr's from saved_fpr to fp31 are saved. */
@@ -3745,8 +3744,7 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->base = sp;
cache->initial_sp = sp;
- trad_frame_set_value (cache->saved_regs,
- gdbarch_pc_regnum (gdbarch), lr);
+ cache->saved_regs[gdbarch_pc_regnum (gdbarch)].set_value (lr);
}
catch (const gdb_exception_error &ex)
{
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index dbdace8..57ddd54 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -2451,10 +2451,10 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
/* Set up ABI call-saved/call-clobbered registers. */
for (i = 0; i < S390_NUM_REGS; i++)
if (!s390_register_call_saved (gdbarch, i))
- trad_frame_set_unknown (info->saved_regs, i);
+ info->saved_regs[i].set_unknown ();
/* CC is always call-clobbered. */
- trad_frame_set_unknown (info->saved_regs, S390_PSWM_REGNUM);
+ info->saved_regs[S390_PSWM_REGNUM].set_unknown ();
/* Record the addresses of all register spill slots the prologue parser
has recognized. Consider only registers defined as call-saved by the
@@ -2479,7 +2479,7 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
save area, use that -- we might only think the function frameless
because we're in the middle of the prologue ... */
if (size == 0
- && !trad_frame_addr_p (info->saved_regs, S390_PSWA_REGNUM))
+ && !info->saved_regs[S390_PSWA_REGNUM].is_addr ())
{
info->saved_regs[S390_PSWA_REGNUM].set_realreg (S390_RETADDR_REGNUM);
}
@@ -2490,8 +2490,8 @@ s390_prologue_frame_unwind_cache (struct frame_info *this_frame,
libc's thread_start routine. */
if (size > 0)
{
- if (!trad_frame_addr_p (info->saved_regs, S390_SP_REGNUM)
- || !trad_frame_addr_p (info->saved_regs, S390_PSWA_REGNUM))
+ if (!info->saved_regs[S390_SP_REGNUM].is_addr ()
+ || !info->saved_regs[S390_PSWA_REGNUM].is_addr ())
prev_sp = -1;
}
@@ -2524,10 +2524,10 @@ s390_backchain_frame_unwind_cache (struct frame_info *this_frame,
/* Set up ABI call-saved/call-clobbered registers. */
for (i = 0; i < S390_NUM_REGS; i++)
if (!s390_register_call_saved (gdbarch, i))
- trad_frame_set_unknown (info->saved_regs, i);
+ info->saved_regs[i].set_unknown ();
/* CC is always call-clobbered. */
- trad_frame_set_unknown (info->saved_regs, S390_PSWM_REGNUM);
+ info->saved_regs[S390_PSWM_REGNUM].set_unknown ();
/* Get the backchain. */
reg = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 4b9f647..531b308 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -1019,7 +1019,9 @@ score7_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
/* Save RA. */
if (ra_offset_p == 1)
{
- if (this_cache->saved_regs[SCORE_PC_REGNUM].is_realreg ())
+ if (this_cache->saved_regs[SCORE_PC_REGNUM].is_realreg ()
+ && this_cache->saved_regs[SCORE_PC_REGNUM].realreg ()
+ == SCORE_PC_REGNUM)
this_cache->saved_regs[SCORE_PC_REGNUM].set_addr (sp + sp_offset
- ra_offset);
}
@@ -1032,7 +1034,9 @@ score7_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
/* Save FP. */
if (fp_offset_p == 1)
{
- if (this_cache->saved_regs[SCORE_FP_REGNUM].is_realreg ())
+ if (this_cache->saved_regs[SCORE_FP_REGNUM].is_realreg ()
+ && this_cache->saved_regs[SCORE_FP_REGNUM].realreg ()
+ == SCORE_FP_REGNUM)
this_cache->saved_regs[SCORE_FP_REGNUM].set_addr (sp + sp_offset
- fp_offset);
}
@@ -1265,7 +1269,9 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
/* Save RA. */
if (ra_offset_p == 1)
{
- if (this_cache->saved_regs[SCORE_PC_REGNUM].is_realreg ())
+ if (this_cache->saved_regs[SCORE_PC_REGNUM].is_realreg ()
+ && this_cache->saved_regs[SCORE_PC_REGNUM].realreg ()
+ == SCORE_PC_REGNUM)
this_cache->saved_regs[SCORE_PC_REGNUM].set_addr (sp + sp_offset
- ra_offset);
}
@@ -1278,7 +1284,9 @@ score3_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
/* Save FP. */
if (fp_offset_p == 1)
{
- if (this_cache->saved_regs[SCORE_FP_REGNUM].is_realreg ())
+ if (this_cache->saved_regs[SCORE_FP_REGNUM].is_realreg ()
+ && this_cache->saved_regs[SCORE_FP_REGNUM].realreg ()
+ == SCORE_FP_REGNUM)
this_cache->saved_regs[SCORE_FP_REGNUM].set_addr (sp + sp_offset
- fp_offset);
}
@@ -1318,7 +1326,7 @@ score_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
}
/* Save SP. */
- trad_frame_set_value (cache->saved_regs, SCORE_SP_REGNUM, cache->base);
+ cache->saved_regs[SCORE_SP_REGNUM].set_value (cache->base);
return (struct score_frame_cache *) (*this_cache);
}
diff --git a/gdb/sparc-netbsd-tdep.c b/gdb/sparc-netbsd-tdep.c
index 2203039..c2de5b5 100644
--- a/gdb/sparc-netbsd-tdep.c
+++ b/gdb/sparc-netbsd-tdep.c
@@ -154,7 +154,7 @@ sparc32nbsd_sigcontext_saved_regs (struct frame_info *this_frame)
addr = saved_regs[SPARC_I7_REGNUM].addr ();
i7 = get_frame_memory_unsigned (this_frame, addr, 4);
- trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie);
+ saved_regs[SPARC_I7_REGNUM].set_value (i7 ^ wcookie);
}
}
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index 6b6d59e..ce92e7b 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -136,7 +136,7 @@ sparc32_sol2_sigtramp_frame_cache (struct frame_info *this_frame,
{
/* The register windows haven't been flushed. */
for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++)
- trad_frame_set_unknown (cache->saved_regs, regnum);
+ cache->saved_regs[regnum].set_unknown ();
}
else
{
diff --git a/gdb/sparc64-netbsd-tdep.c b/gdb/sparc64-netbsd-tdep.c
index f08edd4..7fa0c1a 100644
--- a/gdb/sparc64-netbsd-tdep.c
+++ b/gdb/sparc64-netbsd-tdep.c
@@ -139,7 +139,7 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
addr = saved_regs[SPARC_I7_REGNUM].addr ();
i7 = get_frame_memory_unsigned (this_frame, addr, 8);
- trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie);
+ saved_regs[SPARC_I7_REGNUM].set_value (i7 ^ wcookie);
}
}
diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c
index e664825..c4293c9 100644
--- a/gdb/sparc64-sol2-tdep.c
+++ b/gdb/sparc64-sol2-tdep.c
@@ -137,7 +137,7 @@ sparc64_sol2_sigtramp_frame_cache (struct frame_info *this_frame,
{
/* The register windows haven't been flushed. */
for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++)
- trad_frame_set_unknown (cache->saved_regs, regnum);
+ cache->saved_regs[regnum].set_unknown ();
}
else
{
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 7ff8794..9bd982f 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -459,12 +459,6 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
unsigned saved_register
= (unsigned) reverse_frame[operands[1]].value;
- /* realreg >= 0 and addr != -1 indicates that the
- value of saved_register is in memory location
- saved_address. The value of realreg is not
- meaningful in this case but it must be >= 0.
- See trad-frame.h. */
- cache->saved_regs[saved_register].set_realreg (saved_register);
cache->saved_regs[saved_register].set_addr (saved_address);
}
else if (cache
@@ -494,8 +488,7 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
new_reverse_frame[i].state = REVERSE_STATE_VALUE;
new_reverse_frame[i].value
= cache->saved_regs[hopefully_sp].addr ();
- trad_frame_set_value (cache->saved_regs,
- hopefully_sp, prev_sp_value);
+ cache->saved_regs[hopefully_sp].set_value (prev_sp_value);
}
else
{
@@ -718,15 +711,14 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
unsigned saved_register = (unsigned) reverse_frame[i].value;
cache->saved_regs[saved_register].set_realreg (i);
- cache->saved_regs[saved_register].set_addr ((LONGEST) -1);
}
}
}
if (lr_saved_on_stack_p)
{
- cache->saved_regs[TILEGX_LR_REGNUM].set_realreg (TILEGX_LR_REGNUM);
- cache->saved_regs[TILEGX_LR_REGNUM].set_addr (cache->saved_regs[TILEGX_SP_REGNUM].addr ());
+ CORE_ADDR addr = cache->saved_regs[TILEGX_SP_REGNUM].addr ();
+ cache->saved_regs[TILEGX_LR_REGNUM].set_addr (addr);
}
return prolog_end;
@@ -862,7 +854,7 @@ tilegx_frame_cache (struct frame_info *this_frame, void **this_cache)
current_pc = get_frame_pc (this_frame);
cache->base = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM);
- trad_frame_set_value (cache->saved_regs, TILEGX_SP_REGNUM, cache->base);
+ cache->saved_regs[TILEGX_SP_REGNUM].set_value (cache->base);
if (cache->start_pc)
tilegx_analyze_prologue (gdbarch, cache->start_pc, current_pc,
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index 53bd097..d5ad0b9 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -69,7 +69,11 @@ trad_frame_alloc_saved_regs (struct gdbarch *gdbarch)
trad_frame_saved_reg *this_saved_regs
= FRAME_OBSTACK_CALLOC (numregs, trad_frame_saved_reg);
+ /* For backwards compatibility, initialize all the register values to
+ REALREG, with register 0 stored in 0, register 1 stored in 1 and so
+ on. */
trad_frame_reset_saved_regs (gdbarch, this_saved_regs);
+
return this_saved_regs;
}
@@ -86,80 +90,27 @@ trad_frame_alloc_saved_regs (struct frame_info *this_frame)
return trad_frame_alloc_saved_regs (gdbarch);
}
-int
-trad_frame_value_p (trad_frame_saved_reg this_saved_regs[], int regnum)
-{
- return this_saved_regs[regnum].is_value ();
-}
-
-int
-trad_frame_addr_p (trad_frame_saved_reg this_saved_regs[], int regnum)
-{
- return this_saved_regs[regnum].is_addr ();
-}
-
-int
-trad_frame_realreg_p (trad_frame_saved_reg this_saved_regs[],
- int regnum)
-{
- return this_saved_regs[regnum].is_realreg ();
-}
-
-/* See trad-frame.h. */
-
-bool
-trad_frame_value_bytes_p (trad_frame_saved_reg this_saved_regs[],
- int regnum)
-{
- return this_saved_regs[regnum].is_value_bytes ();
-}
-
-void
-trad_frame_set_value (trad_frame_saved_reg this_saved_regs[],
- int regnum, LONGEST val)
-{
- this_saved_regs[regnum].set_value (val);
-}
-
-/* See trad-frame.h. */
-
-void
-trad_frame_set_realreg (trad_frame_saved_reg this_saved_regs[],
- int regnum, int realreg)
-{
- this_saved_regs[regnum].set_realreg (realreg);
-}
-
-/* See trad-frame.h. */
-
-void
-trad_frame_set_addr (trad_frame_saved_reg this_saved_regs[],
- int regnum, CORE_ADDR addr)
-{
- this_saved_regs[regnum].set_addr (addr);
-}
-
void
trad_frame_set_reg_value (struct trad_frame_cache *this_trad_cache,
int regnum, LONGEST val)
{
/* External interface for users of trad_frame_cache
(who cannot access the prev_regs object directly). */
- trad_frame_set_value (this_trad_cache->prev_regs, regnum, val);
+ this_trad_cache->prev_regs[regnum].set_value (val);
}
void
trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache,
int regnum, int realreg)
{
- trad_frame_set_realreg (this_trad_cache->prev_regs, regnum, realreg);
+ this_trad_cache->prev_regs[regnum].set_realreg (realreg);
}
void
trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
int regnum, CORE_ADDR addr)
{
- trad_frame_set_addr (this_trad_cache->prev_regs, regnum, addr);
+ this_trad_cache->prev_regs[regnum].set_addr (addr);
}
void
@@ -218,26 +169,6 @@ trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache,
}
}
-void
-trad_frame_set_unknown (trad_frame_saved_reg this_saved_regs[],
- int regnum)
-{
- this_saved_regs[regnum].set_unknown ();
-}
-
-/* See trad-frame.h. */
-
-void
-trad_frame_set_value_bytes (trad_frame_saved_reg this_saved_regs[],
- int regnum,
- gdb::array_view<const gdb_byte> bytes)
-{
- /* Allocate the space and copy the data bytes. */
- gdb_byte *data = FRAME_OBSTACK_CALLOC (bytes.size (), gdb_byte);
- memcpy (data, bytes.data (), bytes.size ());
- this_saved_regs[regnum].set_value_bytes (data);
-}
-
/* See trad-frame.h. */
void
@@ -247,7 +178,7 @@ trad_frame_set_reg_value_bytes (struct trad_frame_cache *this_trad_cache,
{
/* External interface for users of trad_frame_cache
(who cannot access the prev_regs object directly). */
- trad_frame_set_value_bytes (this_trad_cache->prev_regs, regnum, bytes);
+ this_trad_cache->prev_regs[regnum].set_value_bytes (bytes);
}
@@ -257,18 +188,18 @@ trad_frame_get_prev_register (struct frame_info *this_frame,
trad_frame_saved_reg this_saved_regs[],
int regnum)
{
- if (trad_frame_addr_p (this_saved_regs, regnum))
+ if (this_saved_regs[regnum].is_addr ())
/* The register was saved in memory. */
return frame_unwind_got_memory (this_frame, regnum,
this_saved_regs[regnum].addr ());
- else if (trad_frame_realreg_p (this_saved_regs, regnum))
+ else if (this_saved_regs[regnum].is_realreg ())
return frame_unwind_got_register (this_frame, regnum,
this_saved_regs[regnum].realreg ());
- else if (trad_frame_value_p (this_saved_regs, regnum))
+ else if (this_saved_regs[regnum].is_value ())
/* The register's value is available. */
return frame_unwind_got_constant (this_frame, regnum,
this_saved_regs[regnum].value ());
- else if (trad_frame_value_bytes_p (this_saved_regs, regnum))
+ else if (this_saved_regs[regnum].is_value_bytes ())
/* The register's value is available as a sequence of bytes. */
return frame_unwind_got_bytes (this_frame, regnum,
this_saved_regs[regnum].value_bytes ());
diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h
index dc29bab..0351441 100644
--- a/gdb/trad-frame.h
+++ b/gdb/trad-frame.h
@@ -114,10 +114,14 @@ struct trad_frame_saved_reg
/* Encode that the saved register's value is stored as a sequence of bytes.
This is useful when the value is larger than what primitive types
can hold. */
- void set_value_bytes (const gdb_byte *value_bytes)
+ void set_value_bytes (gdb::array_view<const gdb_byte> bytes)
{
+ /* Allocate the space and copy the data bytes. */
+ gdb_byte *data = FRAME_OBSTACK_CALLOC (bytes.size (), gdb_byte);
+ memcpy (data, bytes.data (), bytes.size ());
+
m_kind = trad_frame_saved_reg_kind::VALUE_BYTES;
- m_reg.value_bytes = value_bytes;
+ m_reg.value_bytes = data;
}
/* Getters */
@@ -185,43 +189,7 @@ private:
} m_reg;
};
-/* Encode REGNUM value in the trad-frame. */
-void trad_frame_set_value (trad_frame_saved_reg this_saved_regs[],
- int regnum, LONGEST val);
-
-/* Encode REGNUM is in REALREG in the trad-frame. */
-void trad_frame_set_realreg (trad_frame_saved_reg this_saved_regs[],
- int regnum, int realreg);
-
-/* Encode REGNUM is at address ADDR in the trad-frame. */
-void trad_frame_set_addr (trad_frame_saved_reg this_trad_cache[],
- int regnum, CORE_ADDR addr);
-
-/* Mark REGNUM as unknown. */
-void trad_frame_set_unknown (trad_frame_saved_reg this_saved_regs[],
- int regnum);
-
-/* Encode REGNUM value in the trad-frame as a sequence of bytes. This is
- useful when the value is larger than what primitive types can hold. */
-void trad_frame_set_value_bytes (trad_frame_saved_reg this_saved_regs[],
- int regnum,
- gdb::array_view<const gdb_byte> bytes);
-
-/* Convenience functions, return non-zero if the register has been
- encoded as specified. */
-int trad_frame_value_p (trad_frame_saved_reg this_saved_regs[],
- int regnum);
-int trad_frame_addr_p (trad_frame_saved_reg this_saved_regs[],
- int regnum);
-int trad_frame_realreg_p (trad_frame_saved_reg this_saved_regs[],
- int regnum);
-
-/* Return TRUE if REGNUM is stored as a sequence of bytes, and FALSE
- otherwise. */
-bool trad_frame_value_bytes_p (trad_frame_saved_reg this_saved_regs[],
- int regnum);
-
-/* Reset the saved regs cache, setting register values to -1. */
+/* Reset the saved regs cache, setting register values to REALREG. */
void trad_frame_reset_saved_regs (struct gdbarch *gdbarch,
trad_frame_saved_reg *regs);
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 8bd74ea..1c46e29 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1273,13 +1273,12 @@ v850_frame_cache (struct frame_info *this_frame, void **this_cache)
/* Now that we have the base address for the stack frame we can
calculate the value of sp in the calling frame. */
- trad_frame_set_value (cache->saved_regs, E_SP_REGNUM,
- cache->base - cache->sp_offset);
+ cache->saved_regs[E_SP_REGNUM].set_value (cache->base - cache->sp_offset);
/* Adjust all the saved registers such that they contain addresses
instead of offsets. */
for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
- if (trad_frame_addr_p (cache->saved_regs, i))
+ if (cache->saved_regs[i].is_addr ())
cache->saved_regs[i].set_addr (cache->saved_regs[i].addr ()
+ cache->base);
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 2e707a6..5e6c65a 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -361,7 +361,7 @@ vax_frame_cache (struct frame_info *this_frame, void **this_cache)
}
/* Bits 1:0 of the stack pointer were saved in the control bits. */
- trad_frame_set_value (cache->saved_regs, VAX_SP_REGNUM, addr + (mask >> 14));
+ cache->saved_regs[VAX_SP_REGNUM].set_value (addr + (mask >> 14));
return cache;
}