diff options
author | Tom Tromey <tromey@adacore.com> | 2021-08-11 08:17:36 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-08-16 09:38:14 -0600 |
commit | 1dd34eff4bb106e77b798e854f4b06cf1eb7d4b2 (patch) | |
tree | 04fe97e5a5c75d87e828a406ccee5ea1a0a44772 | |
parent | bd7ccaa983158e789e305f4baae245ee4975516f (diff) | |
download | binutils-1dd34eff4bb106e77b798e854f4b06cf1eb7d4b2.zip binutils-1dd34eff4bb106e77b798e854f4b06cf1eb7d4b2.tar.gz binutils-1dd34eff4bb106e77b798e854f4b06cf1eb7d4b2.tar.bz2 |
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.
-rw-r--r-- | gdb/dwarf2/expr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index cc1a72d..85088e9 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -2338,7 +2338,9 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr, case DW_OP_push_object_address: /* Return the address of the object we are currently observing. */ - if (this->m_addr_info == nullptr) + if (this->m_addr_info == nullptr + || (this->m_addr_info->valaddr.data () == nullptr + && this->m_addr_info->addr == 0)) error (_("Location address is not set.")); result_val |