UnwindPlan::Row refactor -- add support for CFA set by a DWARF expression
Summary:
This change refactors UnwindPlan::Row to be able to store the fact that the CFA is value is set
by evaluating a dwarf expression (DW_CFA_def_cfa_expression). This is achieved by creating a new
class CFAValue and moving all CFA setting/getting code there. Note that code using the new
CFAValue::isDWARFExpression is not yet present and will be added in a follow-up patch. Therefore,
this patch should not change the functionality in any way.
Test Plan: Ran tests on Mac and Linux. No regressions detected.
Reviewers: jasonmolenda, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D7755
llvm-svn: 230210
diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp
index 85bd22f..8d2a27c 100644
--- a/lldb/source/Symbol/CompactUnwindInfo.cpp
+++ b/lldb/source/Symbol/CompactUnwindInfo.cpp
@@ -720,8 +720,9 @@
{
case UNWIND_X86_64_MODE_RBP_FRAME:
{
- row->SetCFARegister (translate_to_eh_frame_regnum_x86_64 (UNWIND_X86_64_REG_RBP));
- row->SetCFAOffset (2 * wordsize);
+ row->GetCFAValue().SetIsRegisterPlusOffset (
+ translate_to_eh_frame_regnum_x86_64 (UNWIND_X86_64_REG_RBP),
+ 2 * wordsize);
row->SetOffset (0);
row->SetRegisterLocationToAtCFAPlusOffset (x86_64_eh_regnum::rbp, wordsize * -2, true);
row->SetRegisterLocationToAtCFAPlusOffset (x86_64_eh_regnum::rip, wordsize * -1, true);
@@ -809,16 +810,9 @@
}
}
- if (mode == UNWIND_X86_64_MODE_STACK_IND)
- {
- row->SetCFAOffset (stack_size);
- }
- else
- {
- row->SetCFAOffset (stack_size * wordsize);
- }
+ int32_t offset = mode == UNWIND_X86_64_MODE_STACK_IND ? stack_size : stack_size * wordsize;
+ row->GetCFAValue().SetIsRegisterPlusOffset (x86_64_eh_regnum::rsp, offset);
- row->SetCFARegister (x86_64_eh_regnum::rsp);
row->SetOffset (0);
row->SetRegisterLocationToAtCFAPlusOffset (x86_64_eh_regnum::rip, wordsize * -1, true);
row->SetRegisterLocationToIsCFAPlusOffset (x86_64_eh_regnum::rsp, 0, true);
@@ -1009,8 +1003,8 @@
{
case UNWIND_X86_MODE_EBP_FRAME:
{
- row->SetCFARegister (translate_to_eh_frame_regnum_i386 (UNWIND_X86_REG_EBP));
- row->SetCFAOffset (2 * wordsize);
+ row->GetCFAValue().SetIsRegisterPlusOffset (
+ translate_to_eh_frame_regnum_i386 (UNWIND_X86_REG_EBP), 2 * wordsize);
row->SetOffset (0);
row->SetRegisterLocationToAtCFAPlusOffset (i386_eh_regnum::ebp, wordsize * -2, true);
row->SetRegisterLocationToAtCFAPlusOffset (i386_eh_regnum::eip, wordsize * -1, true);
@@ -1091,17 +1085,8 @@
}
}
- row->SetCFARegister (i386_eh_regnum::esp);
-
- if (mode == UNWIND_X86_MODE_STACK_IND)
- {
- row->SetCFAOffset (stack_size);
- }
- else
- {
- row->SetCFAOffset (stack_size * wordsize);
- }
-
+ int32_t offset = mode == UNWIND_X86_MODE_STACK_IND ? stack_size : stack_size * wordsize;
+ row->GetCFAValue().SetIsRegisterPlusOffset (i386_eh_regnum::esp, offset);
row->SetOffset (0);
row->SetRegisterLocationToAtCFAPlusOffset (i386_eh_regnum::eip, wordsize * -1, true);
row->SetRegisterLocationToIsCFAPlusOffset (i386_eh_regnum::esp, 0, true);