diff options
Diffstat (limited to 'lldb/source/Plugins/Process/Utility')
9 files changed, 44 insertions, 21 deletions
diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp index fc3b1f158d7..a2b71b587d4 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp +++ b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp @@ -9,6 +9,7 @@ #include "lldb/lldb-private.h" #include "Plugins/Process/Utility/HistoryThread.h" + #include "Plugins/Process/Utility/HistoryUnwind.h" #include "Plugins/Process/Utility/RegisterContextHistory.h" @@ -16,6 +17,8 @@ #include "lldb/Target/StackFrameList.h" #include "lldb/Utility/Log.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -48,8 +51,8 @@ HistoryThread::~HistoryThread() { lldb::RegisterContextSP HistoryThread::GetRegisterContext() { RegisterContextSP rctx; if (m_pcs.size() > 0) { - rctx.reset(new RegisterContextHistory( - *this, 0, GetProcess()->GetAddressByteSize(), m_pcs[0])); + rctx = std::make_shared<RegisterContextHistory>( + *this, 0, GetProcess()->GetAddressByteSize(), m_pcs[0]); } return rctx; } @@ -64,7 +67,8 @@ lldb::StackFrameListSP HistoryThread::GetStackFrameList() { std::unique_lock<std::mutex> lock(m_framelist_mutex); lock.unlock(); if (m_framelist.get() == NULL) { - m_framelist.reset(new StackFrameList(*this, StackFrameListSP(), true)); + m_framelist = + std::make_shared<StackFrameList>(*this, StackFrameListSP(), true); } return m_framelist; diff --git a/lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp b/lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp index 71119a5c498..023469d4c07 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp +++ b/lldb/source/Plugins/Process/Utility/HistoryUnwind.cpp @@ -16,6 +16,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -42,9 +44,9 @@ HistoryUnwind::DoCreateRegisterContextForFrame(StackFrame *frame) { addr_t pc = frame->GetFrameCodeAddress().GetLoadAddress( &frame->GetThread()->GetProcess()->GetTarget()); if (pc != LLDB_INVALID_ADDRESS) { - rctx.reset(new RegisterContextHistory( + rctx = std::make_shared<RegisterContextHistory>( *frame->GetThread().get(), frame->GetConcreteFrameIndex(), - frame->GetThread()->GetProcess()->GetAddressByteSize(), pc)); + frame->GetThread()->GetProcess()->GetAddressByteSize(), pc); } } return rctx; diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp index bcb58d2a538..10609ce88fa 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp @@ -19,6 +19,8 @@ #include "Plugins/Process/Utility/InstructionUtils.h" +#include <memory> + // Support building against older versions of LLVM, this macro was added // recently. #ifndef LLVM_EXTENSION @@ -1296,7 +1298,7 @@ bool RegisterContextDarwin_arm::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_arm::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); if (data_sp && ReadGPR(false) == KERN_SUCCESS && ReadFPU(false) == KERN_SUCCESS && ReadEXC(false) == KERN_SUCCESS) { uint8_t *dst = data_sp->GetBytes(); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp index 0fd71205a79..308cf151909 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -23,6 +23,8 @@ #include "Plugins/Process/Utility/InstructionUtils.h" +#include <memory> + // Support building against older versions of LLVM, this macro was added // recently. #ifndef LLVM_EXTENSION @@ -648,7 +650,7 @@ bool RegisterContextDarwin_arm64::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_arm64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); if (data_sp && ReadGPR(false) == KERN_SUCCESS && ReadFPU(false) == KERN_SUCCESS && ReadEXC(false) == KERN_SUCCESS) { uint8_t *dst = data_sp->GetBytes(); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp index 742644d4d8e..161af9f8c32 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -#include <stddef.h> - #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" @@ -17,6 +15,10 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" +#include <stddef.h> + +#include <memory> + // Support building against older versions of LLVM, this macro was added // recently. #ifndef LLVM_EXTENSION @@ -831,7 +833,7 @@ bool RegisterContextDarwin_i386::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_i386::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 && ReadEXC(false) == 0) { uint8_t *dst = data_sp->GetBytes(); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp index 35fc2a15732..c611f6239b8 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp @@ -10,6 +10,8 @@ #include <stdarg.h> #include <stddef.h> +#include <memory> + #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" @@ -909,7 +911,7 @@ bool RegisterContextDarwin_x86_64::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_x86_64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 && ReadEXC(false) == 0) { uint8_t *dst = data_sp->GetBytes(); diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 423b2e53c66..10199f742f5 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -34,6 +34,8 @@ #include "RegisterContextLLDB.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -369,7 +371,8 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { if (abi) { m_fast_unwind_plan_sp.reset(); - m_full_unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + m_full_unwind_plan_sp = + std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); abi->CreateDefaultUnwindPlan(*m_full_unwind_plan_sp); if (m_frame_type != eSkipFrame) // don't override eSkipFrame { @@ -716,8 +719,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { Process *process = exe_ctx.GetProcessPtr(); ABI *abi = process ? process->GetABI().get() : NULL; if (abi) { - arch_default_unwind_plan_sp.reset( - new UnwindPlan(lldb::eRegisterKindGeneric)); + arch_default_unwind_plan_sp = + std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); abi->CreateDefaultUnwindPlan(*arch_default_unwind_plan_sp); } else { UnwindLogMsg( @@ -752,7 +755,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { process->GetLoadAddressPermissions(current_pc_addr, permissions) && (permissions & ePermissionsExecutable) == 0)) { if (abi) { - unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + unwind_plan_sp = + std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); abi->CreateFunctionEntryUnwindPlan(*unwind_plan_sp); m_frame_type = eNormalFrame; return unwind_plan_sp; @@ -793,7 +797,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { DWARFCallFrameInfo *eh_frame = pc_module_sp->GetObjectFile()->GetUnwindTable().GetEHFrameInfo(); if (eh_frame) { - unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); if (eh_frame->GetUnwindPlan(m_current_pc, *unwind_plan_sp)) return unwind_plan_sp; else @@ -803,7 +807,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { ArmUnwindInfo *arm_exidx = pc_module_sp->GetObjectFile()->GetUnwindTable().GetArmUnwindInfo(); if (arm_exidx) { - unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); if (arm_exidx->GetUnwindPlan(exe_ctx.GetTargetRef(), m_current_pc, *unwind_plan_sp)) return unwind_plan_sp; diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp index 735bfea2fcb..80b04bb14f7 100644 --- a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp +++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "Plugins/Process/Utility/ThreadMemory.h" + #include "Plugins/Process/Utility/RegisterContextThreadMemory.h" #include "lldb/Target/OperatingSystem.h" #include "lldb/Target/Process.h" @@ -15,6 +16,8 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Unwind.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -44,8 +47,8 @@ void ThreadMemory::ClearStackFrames() { RegisterContextSP ThreadMemory::GetRegisterContext() { if (!m_reg_context_sp) - m_reg_context_sp.reset( - new RegisterContextThreadMemory(*this, m_register_data_addr)); + m_reg_context_sp = std::make_shared<RegisterContextThreadMemory>( + *this, m_register_data_addr); return m_reg_context_sp; } diff --git a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp index b66be377598..4a35637cffb 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp @@ -17,6 +17,8 @@ #include "RegisterContextMacOSXFrameBackchain.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -65,8 +67,8 @@ UnwindMacOSXFrameBackchain::DoCreateRegisterContextForFrame(StackFrame *frame) { uint32_t concrete_idx = frame->GetConcreteFrameIndex(); const uint32_t frame_count = GetFrameCount(); if (concrete_idx < frame_count) - reg_ctx_sp.reset(new RegisterContextMacOSXFrameBackchain( - m_thread, concrete_idx, m_cursors[concrete_idx])); + reg_ctx_sp = std::make_shared<RegisterContextMacOSXFrameBackchain>( + m_thread, concrete_idx, m_cursors[concrete_idx]); return reg_ctx_sp; } |