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())
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())
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits