summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-10-02 17:50:42 +0000
committerAdrian Prantl <aprantl@apple.com>2018-10-02 17:50:42 +0000
commitf796e763b212ffaf8a0763093f40a96e6d8cd582 (patch)
tree4ac766a2929b7dda6e4a92d6d1ab83f84df17cc3 /lldb/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py
parent9767089d003b52ec9d32b93c8533c815c9906902 (diff)
downloadbcm5719-llvm-f796e763b212ffaf8a0763093f40a96e6d8cd582.tar.gz
bcm5719-llvm-f796e763b212ffaf8a0763093f40a96e6d8cd582.zip
DWARFExpression: Resolve file addresses in the linked module
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. 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 setting the expression's Module to point to the linked debugmap object. 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 Differential Revision: https://reviews.llvm.org/D52678 llvm-svn: 343612
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py b/lldb/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py
new file mode 100644
index 00000000000..7a46877488f
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py
@@ -0,0 +1,22 @@
+"""
+Test that target var can resolve complex DWARF expressions.
+"""
+
+import lldb
+import sys
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class targetCommandTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ @skipIfDarwinEmbedded # needs x86_64
+ @skipIf(debug_info="gmodules") # not relevant
+ def testTargetVarExpr(self):
+ self.build()
+ lldbutil.run_to_name_breakpoint(self, 'main')
+ self.expect("target variable i", substrs=['i', '42'])
OpenPOWER on IntegriCloud