[Lldb-commits] [PATCH] D119734: [lldb] Add a positive test for `getelementptr` constant args

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 14 10:05:02 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2e0ef179d883: [lldb] Add a positive test for `getelementptr` constant args (authored by werat).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119734/new/

https://reviews.llvm.org/D119734

Files:
  lldb/test/API/lang/cpp/static_members/TestCPPStaticMembers.py
  lldb/test/API/lang/cpp/static_members/main.cpp


Index: lldb/test/API/lang/cpp/static_members/main.cpp
===================================================================
--- lldb/test/API/lang/cpp/static_members/main.cpp
+++ lldb/test/API/lang/cpp/static_members/main.cpp
@@ -15,6 +15,8 @@
   A my_a;
   my_a.m_a = 1;
 
+  int arr[2]{0};
+
   my_a.access(); // stop in main
   return 0;
 }
Index: lldb/test/API/lang/cpp/static_members/TestCPPStaticMembers.py
===================================================================
--- lldb/test/API/lang/cpp/static_members/TestCPPStaticMembers.py
+++ lldb/test/API/lang/cpp/static_members/TestCPPStaticMembers.py
@@ -71,3 +71,20 @@
         # Evaluating the expression via JIT should work fine.
         value = self.target().EvaluateExpression(expr)
         self.assertSuccess(value.GetError())
+
+    # We fail to lookup static members on Windows.
+    @expectedFailureAll(oslist=["windows"])
+    def test_IR_interpreter_can_handle_getelementptr_constants_args(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(self, "// stop in main", lldb.SBFileSpec("main.cpp"))
+
+        # This expression contains the following IR code:
+        # ... getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
+        expr = "arr[0]"
+
+        # The IR interpreter supports const operands to the `GetElementPtr` IR
+        # instruction, so it should be able to evaluate expression without JIT.
+        opts = lldb.SBExpressionOptions()
+        opts.SetAllowJIT(False)
+        value = self.target().EvaluateExpression(expr, opts)
+        self.assertSuccess(value.GetError())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119734.408479.patch
Type: text/x-patch
Size: 1599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220214/03711f0b/attachment.bin>


More information about the lldb-commits mailing list