diff options
Diffstat (limited to 'lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp')
| -rw-r--r-- | lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index f8aca4d1283..a8872533981 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -58,8 +58,8 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( if (range.GetByteSize() > 0 && range.GetBaseAddress().IsValid() && m_inst_emulator_ap.get()) { - // The instruction emulation subclass setup the unwind plan for the - // first instruction. + // The instruction emulation subclass setup the unwind plan for the first + // instruction. m_inst_emulator_ap->CreateFunctionEntryUnwind(unwind_plan); // CreateFunctionEntryUnwind should have created the first row. If it @@ -90,9 +90,9 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( m_register_values.clear(); m_pushed_regs.clear(); - // Initialize the CFA with a known value. In the 32 bit case - // it will be 0x80000000, and in the 64 bit case 0x8000000000000000. - // We use the address byte size to be safe for any future address sizes + // Initialize the CFA with a known value. In the 32 bit case it will be + // 0x80000000, and in the 64 bit case 0x8000000000000000. We use the + // address byte size to be safe for any future address sizes m_initial_sp = (1ull << ((addr_byte_size * 8) - 1)); RegisterValue cfa_reg_value; cfa_reg_value.SetUInt(m_initial_sp, m_cfa_reg_info.byte_size); @@ -105,14 +105,12 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( Instruction *inst = inst_list.GetInstructionAtIndex(0).get(); const lldb::addr_t base_addr = inst->GetAddress().GetFileAddress(); - // Map for storing the unwind plan row and the value of the registers at - // a given offset. - // When we see a forward branch we add a new entry to this map with the - // actual unwind plan - // row and register context for the target address of the branch as the - // current data have - // to be valid for the target address of the branch too if we are in the - // same function. + // Map for storing the unwind plan row and the value of the registers + // at a given offset. When we see a forward branch we add a new entry + // to this map with the actual unwind plan row and register context for + // the target address of the branch as the current data have to be + // valid for the target address of the branch too if we are in the same + // function. std::map<lldb::addr_t, std::pair<UnwindPlan::RowSP, RegisterValueMap>> saved_unwind_states; @@ -128,15 +126,14 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( saved_unwind_states.insert({0, {last_row, m_register_values}}); // cache the pc register number (in whatever register numbering this - // UnwindPlan uses) for - // quick reference during instruction parsing. + // UnwindPlan uses) for quick reference during instruction parsing. RegisterInfo pc_reg_info; m_inst_emulator_ap->GetRegisterInfo( eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc_reg_info); // cache the return address register number (in whatever register - // numbering this UnwindPlan uses) for - // quick reference during instruction parsing. + // numbering this UnwindPlan uses) for quick reference during + // instruction parsing. RegisterInfo ra_reg_info; m_inst_emulator_ap->GetRegisterInfo( eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA, ra_reg_info); @@ -160,12 +157,11 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( "Unwind row for the function entry missing"); --it; // Move it to the row corresponding to the current offset - // If the offset of m_curr_row don't match with the offset we see in - // saved_unwind_states - // then we have to update m_curr_row and m_register_values based on - // the saved values. It - // is happenning after we processed an epilogue and a return to - // caller instruction. + // If the offset of m_curr_row don't match with the offset we see + // in saved_unwind_states then we have to update m_curr_row and + // m_register_values based on the saved values. It is happenning + // after we processed an epilogue and a return to caller + // instruction. if (it->second.first->GetOffset() != m_curr_row->GetOffset()) { UnwindPlan::Row *newrow = new UnwindPlan::Row; *newrow = *it->second.first; @@ -181,10 +177,9 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( if (m_inst_emulator_ap->GetInstructionCondition() != EmulateInstruction::UnconditionalCondition && saved_unwind_states.count(current_offset) == 0) { - // If we don't have a saved row for the current offset then save - // our - // current state because we will have to restore it after the - // conditional block. + // If we don't have a saved row for the current offset then + // save our current state because we will have to restore it + // after the conditional block. auto new_row = std::make_shared<UnwindPlan::Row>(*m_curr_row.get()); saved_unwind_states.insert( @@ -192,8 +187,8 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( } // If the last instruction was conditional with a different - // condition - // then the then current condition then restore the condition. + // condition then the then current condition then restore the + // condition. if (last_condition != EmulateInstruction::UnconditionalCondition) { const auto &saved_state = @@ -230,8 +225,7 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( eEmulateInstructionOptionIgnoreConditions); // If the current instruction is a branch forward then save the - // current CFI information - // for the offset where we are branching. + // current CFI information for the offset where we are branching. if (m_forward_branch_offset != 0 && range.ContainsFileAddress(inst->GetAddress().GetFileAddress() + m_forward_branch_offset)) { @@ -247,8 +241,8 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly( // Were there any changes to the CFI while evaluating this // instruction? if (m_curr_row_modified) { - // Save the modified row if we don't already have a CFI row in the - // currennt address + // Save the modified row if we don't already have a CFI row in + // the currennt address if (saved_unwind_states.count( current_offset + inst->GetOpcode().GetByteSize()) == 0) { m_curr_row->SetOffset(current_offset + |

