This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: fix PR c++/14999
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> I looked at the PR, and it seems to me that the problem comes
Joel> from the fact that the ax stack was missing the "reg 7" operation.
Joel> I don't really understand the code well enough to be sure about
Joel> my fix, in particular what the "loc" parameter is about, but
Joel> the attached patch seems to restore the origin behavior while
Joel> still keeping your new testcase happy.
Can you try the appended instead?
I am testing it here as well.
I think calling ax_reg and setting kind==axs_lvalue_register is wrong,
as it may result in a second ax_reg call if require_rvalue is called.
Instead I think we should mimic what dwarf2eval does for the fbreg case,
and only derferences lvalue_register values.
Tom
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 2282feb..3688425 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2878,7 +2878,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size, datastart,
datastart + datalen, per_cu);
- require_rvalue (expr, loc);
+ if (loc->kind == axs_lvalue_register)
+ require_rvalue (expr, loc);
if (offset != 0)
{