[PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 28 17:45:04 PDT 2018


aprantl created this revision.
aprantl added reviewers: clayborg, jingham.
Herald added a subscriber: JDevlieghere.
aprantl edited subscribers, added: lldb-commits; removed: llvm-commits.

This is a follow-up to https://reviews.llvm.org/D46362.
When evaluating a complex expression in DWARFExpression::Evaluate, file addresses must be resolved to load addresses before we can perform operations such as DW_OP_deref on them.

For this the address goes through three steps

1. Read the file address as stored in the DWARF
2. Link/relocate the file address (when reading from a .dSYM, this is a no-op)
3. Convert the file address to a load address.

https://reviews.llvm.org/D46362 implemented step (3) by resolving the file address using the Module that the original DWARF came from. In the case of a dSYM that is correct, but when reading from .o files, we need to look up relocated/linked addresses, so the right place to look them up is the current frame's module. This patch fixes that by getting the module from the ExecutionContext. PLease let me know if there is a better way to get from the `.o`-Module to the linked Module that contains that Module.

A word a bout the unorthodox testcase: The motivating testcase for this fix is in Swift, but I managed to hand-modify LLVM-IR for a trivial C program to exhibit the same problem, so we can fix this in llvm.org.

rdar://problem/44689915


https://reviews.llvm.org/D52678

Files:
  packages/Python/lldbsuite/test/functionalities/target_var/Makefile
  packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py
  packages/Python/lldbsuite/test/functionalities/target_var/globals.c
  packages/Python/lldbsuite/test/functionalities/target_var/globals.ll
  source/Expression/DWARFExpression.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52678.167571.patch
Type: text/x-patch
Size: 4476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180929/bf0dce82/attachment.bin>


More information about the llvm-commits mailing list