[Lldb-commits] [lldb] [lldb] Add a test for lea_rsp_pattern_p to x86 unwinder (NFC) (PR #94852)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Jun 8 05:17:17 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Shivam Gupta (xgupta)
<details>
<summary>Changes</summary>
This commit adds a test for lea_rsp_pattern_p which was previously due as FIXME.
---
Full diff: https://github.com/llvm/llvm-project/pull/94852.diff
1 Files Affected:
- (modified) lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp (+23-1)
``````````diff
diff --git a/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp b/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
index 277cc14ce50c9..597e5b2e40d5e 100644
--- a/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
+++ b/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
@@ -1731,7 +1731,29 @@ TEST_F(Testx86AssemblyInspectionEngine, TestAddESP) {
EXPECT_EQ(4 - 16, row_sp->GetCFAValue().GetOffset());
}
-// FIXME add test for lea_rsp_pattern_p
+TEST_F(Testx86AssemblyInspectionEngine, TestLEA_RSP_Pattern) {
+ UnwindPlan::Row::RegisterLocation regloc;
+ UnwindPlan::RowSP row_sp;
+ AddressRange sample_range;
+ UnwindPlan unwind_plan(eRegisterKindLLDB);
+ std::unique_ptr<x86AssemblyInspectionEngine> engine = Getx86_64Inspector();
+
+ uint8_t data[] = {
+ 0x8d, 0x64, 0x24, 0x10, // lea rsp, [rsp + 0x10]
+ 0x90 // nop
+ };
+
+ sample_range = AddressRange(0x1000, sizeof(data));
+
+ EXPECT_TRUE(engine->GetNonCallSiteUnwindPlanFromAssembly(
+ data, sizeof(data), sample_range, unwind_plan));
+
+ row_sp = unwind_plan.GetRowForFunctionOffset(0);
+ EXPECT_EQ(0ull, row_sp->GetOffset());
+ EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == k_rsp);
+ EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true);
+ EXPECT_EQ(8, row_sp->GetCFAValue().GetOffset());
+}
TEST_F(Testx86AssemblyInspectionEngine, TestPopRBX) {
UnwindPlan::Row::RegisterLocation regloc;
``````````
</details>
https://github.com/llvm/llvm-project/pull/94852
More information about the lldb-commits
mailing list