@@ -1731,7 +1731,29 @@ TEST_F(Testx86AssemblyInspectionEngine, TestAddESP) {
1731
1731
EXPECT_EQ (4 - 16 , row_sp->GetCFAValue ().GetOffset ());
1732
1732
}
1733
1733
1734
- // FIXME add test for lea_rsp_pattern_p
1734
+ TEST_F (Testx86AssemblyInspectionEngine, TestLEA_RSP_Pattern) {
1735
+ UnwindPlan::Row::RegisterLocation regloc;
1736
+ UnwindPlan::RowSP row_sp;
1737
+ AddressRange sample_range;
1738
+ UnwindPlan unwind_plan (eRegisterKindLLDB);
1739
+ std::unique_ptr<x86AssemblyInspectionEngine> engine = Getx86_64Inspector ();
1740
+
1741
+ uint8_t data[] = {
1742
+ 0x8d , 0x64 , 0x24 , 0x10 , // lea rsp, [rsp + 0x10]
1743
+ 0x90 // nop
1744
+ };
1745
+
1746
+ sample_range = AddressRange (0x1000 , sizeof (data));
1747
+
1748
+ EXPECT_TRUE (engine->GetNonCallSiteUnwindPlanFromAssembly (
1749
+ data, sizeof (data), sample_range, unwind_plan));
1750
+
1751
+ row_sp = unwind_plan.GetRowForFunctionOffset (0 );
1752
+ EXPECT_EQ (0ull , row_sp->GetOffset ());
1753
+ EXPECT_TRUE (row_sp->GetCFAValue ().GetRegisterNumber () == k_rsp);
1754
+ EXPECT_TRUE (row_sp->GetCFAValue ().IsRegisterPlusOffset () == true );
1755
+ EXPECT_EQ (8 , row_sp->GetCFAValue ().GetOffset ());
1756
+ }
1735
1757
1736
1758
TEST_F (Testx86AssemblyInspectionEngine, TestPopRBX) {
1737
1759
UnwindPlan::Row::RegisterLocation regloc;
0 commit comments