uweigand opened PR #2853 from debug-deref
to main
:
When translating a WebAssembly DWARF expression into a native
DWARF expression, care needs to be taken to translate WebAssembly
memory addresses into native memory addresses by adding the base
address. However, some addresses are already native addresses,
so the two cases need to be distinguished. Existing code uses
the "need_deref" flag to do so.However, this flag seems to be calculated incorrectly in some
cases involving frame base register accesses. For example,
in the test case file tests/all/debug/testsuite/fib-wasm.wasm,
the location of the local parameter "n" is described as:
DW_OP_fbreg + 28
while the frame base register is described as:
DW_OP_WASM_location 0x0 0x3, DW_OP_stack_valueNow, the result of evaluating the DW_OP_WASM_location is a
native memory address (retrieved from a native register or
a native stack slot), so we must not add the memory base.
And indeed, when evaluating the DW_AT_frame_base attribute,
the resulting expression does not have need_deref set.However, when evaluating the DW_OP_fbreg operation, the
frame base expression is copied, the offset (28) is added,
but then also the need_deref flag is set, causing the
memory base to be added. This seems incorrect. If the
frame base is already a native address, then an offset
relative to the frame base is likewise a native address.This patch fixes the problem by respecting the need_deref
flag of DW_AT_frame_base when evaluating DW_OP_fbreg.
This fixes the test failure I was seeing on s390x.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
uweigand closed without merge PR #2853.
Last updated: Nov 22 2024 at 17:03 UTC