diff options
Diffstat (limited to 'lldb/source/Plugins/Process')
5 files changed, 26 insertions, 17 deletions
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 5b7ea7203ce..28ef513f49b 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -34,7 +34,8 @@ RegisterContextLLDB::RegisterContextLLDB (Thread& thread, RegisterContext (thread), m_thread(thread), m_next_frame(next_frame), m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(), m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_current_pc (), m_frame_number (frame_number), - m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL) + m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL), m_base_reg_ctx (), m_frame_type (-1), + m_current_offset (0), m_sym_ctx_valid (false) { m_sym_ctx.Clear(); m_sym_ctx_valid = false; @@ -498,7 +499,7 @@ RegisterContextLLDB::GetFullUnwindPlanForFrame () if (m_frame_type == eSigtrampFrame) { m_fast_unwind_plan = NULL; - UnwindPlan *up = fu->GetUnwindPlanAtCallSite (); + up = fu->GetUnwindPlanAtCallSite (); if (up->PlanValidAtAddress (m_current_pc)) { return up; diff --git a/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp b/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp index e0f99d9255c..8521231e6e6 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp @@ -162,10 +162,15 @@ private: int m_wordsize; int m_cpu; + + DISALLOW_COPY_AND_ASSIGN (AssemblyParse_x86); }; AssemblyParse_x86::AssemblyParse_x86 (Target& target, Thread* thread, int cpu, AddressRange func) : - m_target (target), m_thread (thread), m_cpu(cpu), m_func_bounds(func) + m_target (target), m_thread (thread), m_cpu(cpu), m_func_bounds(func), + m_machine_ip_regnum (-1), m_machine_sp_regnum (-1), m_machine_fp_regnum (-1), + m_lldb_ip_regnum (-1), m_lldb_sp_regnum (-1), m_lldb_fp_regnum (-1), + m_wordsize (-1), m_cur_insn () { int *initialized_flag = NULL; m_lldb_ip_regnum = m_lldb_sp_regnum = m_lldb_fp_regnum = -1; @@ -519,7 +524,7 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan) m_cur_insn = m_func_bounds.GetBaseAddress (); int current_func_text_offset = 0; int current_sp_bytes_offset_from_cfa = 0; - UnwindPlan::Row::RegisterLocation regloc; + UnwindPlan::Row::RegisterLocation initial_regloc; if (!m_cur_insn.IsValid()) { @@ -535,13 +540,13 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan) row.SetCFAOffset (m_wordsize); // caller's stack pointer value before the call insn is the CFA address - regloc.SetIsCFAPlusOffset (0); - row.SetRegisterInfo (m_lldb_sp_regnum, regloc); + initial_regloc.SetIsCFAPlusOffset (0); + row.SetRegisterInfo (m_lldb_sp_regnum, initial_regloc); // saved instruction pointer can be found at CFA - wordsize. current_sp_bytes_offset_from_cfa = m_wordsize; - regloc.SetAtCFAPlusOffset (-current_sp_bytes_offset_from_cfa); - row.SetRegisterInfo (m_lldb_ip_regnum, regloc); + initial_regloc.SetAtCFAPlusOffset (-current_sp_bytes_offset_from_cfa); + row.SetRegisterInfo (m_lldb_ip_regnum, initial_regloc); unwind_plan.AppendRow (row); diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index 9fdd05d9563..8fb7763b287 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -35,7 +35,7 @@ UnwindLLDB::GetFrameCount() if (m_frames.empty()) { // First, set up the 0th (initial) frame - CursorSP first_cursor_sp(new Cursor); + CursorSP first_cursor_sp(new Cursor ()); RegisterContextSP no_frame; // an empty shared pointer RegisterContextLLDB *first_register_ctx = new RegisterContextLLDB(m_thread, no_frame, first_cursor_sp->sctx, 0); if (!first_register_ctx->IsValid()) @@ -55,16 +55,16 @@ UnwindLLDB::GetFrameCount() } // Reuse the StackFrame provided by the processor native machine context for the first frame first_register_ctx->SetStackFrame (m_thread.GetStackFrameAtIndex(0).get()); - RegisterContextSP temp_rcs(first_register_ctx); - first_cursor_sp->reg_ctx = temp_rcs; + RegisterContextSP first_register_ctx_sp(first_register_ctx); + first_cursor_sp->reg_ctx = first_register_ctx_sp; m_frames.push_back (first_cursor_sp); // Now walk up the rest of the stack while (1) { - CursorSP cursor_sp(new Cursor); + CursorSP cursor_sp(new Cursor ()); RegisterContextLLDB *register_ctx; - int cur_idx = m_frames.size (); + uint32_t cur_idx = m_frames.size (); register_ctx = new RegisterContextLLDB (m_thread, m_frames[cur_idx - 1]->reg_ctx, cursor_sp->sctx, cur_idx); if (!register_ctx->IsValid()) { @@ -106,10 +106,10 @@ UnwindLLDB::GetFrameCount() } break; } - RegisterContextSP temp_rcs(register_ctx); - StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, temp_rcs, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx)); + RegisterContextSP register_ctx_sp(register_ctx); + StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, register_ctx_sp, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx)); register_ctx->SetStackFrame (frame); - cursor_sp->reg_ctx = temp_rcs; + cursor_sp->reg_ctx = register_ctx_sp; m_frames.push_back (cursor_sp); } } diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.h b/lldb/source/Plugins/Process/Utility/UnwindLLDB.h index f281269690d..128a4a7d20f 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.h +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.h @@ -56,6 +56,7 @@ private: lldb::RegisterContextSP reg_ctx; // These are all RegisterContextLLDB's Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { } + DISALLOW_COPY_AND_ASSIGN (Cursor); }; typedef lldb::SharedPtr<Cursor>::Type CursorSP; diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index d6667340e3e..7e06e78cfed 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -26,6 +26,8 @@ #include "Utility/StringExtractorGDBRemote.h" #include "UnwindLibUnwind.h" #include "UnwindMacOSXFrameBackchain.h" +#include "UnwindLLDB.h" +#include "RegisterContextLLDB.h" using namespace lldb; using namespace lldb_private; @@ -128,7 +130,7 @@ ThreadGDBRemote::GetUnwinder () const ArchSpec target_arch (GetProcess().GetTarget().GetArchitecture ()); if (target_arch == ArchSpec("x86_64") || target_arch == ArchSpec("i386")) { - m_unwinder_ap.reset (new UnwindLibUnwind (*this, GetGDBProcess().GetLibUnwindAddressSpace())); + m_unwinder_ap.reset (new UnwindLLDB (*this)); } else { |