Fix Ada regression due to DWARF expression series
Commit
0579205aec4 ("Simplify dwarf_expr_context class interface")
caused a regression in the internal AdaCore test suite. I didn't try
to reproduce this with the GDB test suite, but the test is identical
to gdb.dwarf2/dynarr-ptr.exp.
The problem is that this change:
case DW_OP_push_object_address:
/* Return the address of the object we are currently observing. */
- if (this->data_view.data () == nullptr
- && this->obj_address == 0)
+ if (this->m_addr_info == nullptr)
... slightly changes the logic here. In particular, it's possible for
the caller to pass in a non-NULL m_addr_info, but one that looks like:
(top) p *this.m_addr_info
$15 = {
type = 0x29b7a70,
valaddr = {
m_array = 0x0,
m_size = 0
},
addr = 0,
next = 0x0
}
In this case, an additional check is needed. With the current code,
what happens instead is that the computation computes an incorrect
address -- but one that does not fail in read_memory, due to the
precise memory map of the embedded target in question.
This patch restores the old logic.