aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-08-12 06:44:40 -0600
committerTom Tromey <tromey@adacore.com>2021-08-16 09:38:15 -0600
commit892a1e530379eeea924e938c8a588fbf3845f4fa (patch)
treefa438cc2b7d40aad90829e8fe1be138044b5bb50
parent1dd34eff4bb106e77b798e854f4b06cf1eb7d4b2 (diff)
downloadfsf-binutils-gdb-892a1e530379eeea924e938c8a588fbf3845f4fa.zip
fsf-binutils-gdb-892a1e530379eeea924e938c8a588fbf3845f4fa.tar.gz
fsf-binutils-gdb-892a1e530379eeea924e938c8a588fbf3845f4fa.tar.bz2
Fix register regression in DWARF evaluator
On an internal test case, using an arm-elf target, commit ba5bc3e5a92 ("Make DWARF evaluator return a single struct value") causes a regression. (It doesn't happen for any of the other cross targets that I test when importing upstream gdb.) I don't know if there's an upstream gdb test case showing the same problem... I can only really run native tests with dejagnu AFAIK. The failure manifests like this: Breakpoint 1, file_1.export_1 (param_1=<error reading variable: Unable to access DWARF register number 64>, str=...) at [...]/file_1.adb:5 Whereas when it works it looks like: Breakpoint 1, file_1.export_1 (param_1=99.0, str=...) at [...]/file_1.adb:5 The difference is that the new code uses the passed-in gdbarch, whereas the old code used the frame's gdbarch, when handling DWARF_VALUE_REGISTER. This patch restores the use of the frame's arch.
-rw-r--r--gdb/dwarf2/expr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 85088e9..0e62de2 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -927,9 +927,11 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
{
case DWARF_VALUE_REGISTER:
{
+ gdbarch *f_arch = get_frame_arch (this->m_frame);
int dwarf_regnum
= longest_to_int (value_as_long (this->fetch (0)));
- int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, dwarf_regnum);
+ int gdb_regnum = dwarf_reg_to_regnum_or_error (f_arch,
+ dwarf_regnum);
if (subobj_offset != 0)
error (_("cannot use offset on synthetic pointer to register"));