diff options
Diffstat (limited to 'lldb/source/Target')
-rw-r--r-- | lldb/source/Target/CPPLanguageRuntime.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Target/Memory.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Target/Platform.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Target/StackFrame.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Target/StackFrameList.cpp | 20 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 45 | ||||
-rw-r--r-- | lldb/source/Target/Thread.cpp | 17 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanCallFunction.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanStepOut.cpp | 11 |
10 files changed, 85 insertions, 59 deletions
diff --git a/lldb/source/Target/CPPLanguageRuntime.cpp b/lldb/source/Target/CPPLanguageRuntime.cpp index f3d3ad5a504..ead8d789324 100644 --- a/lldb/source/Target/CPPLanguageRuntime.cpp +++ b/lldb/source/Target/CPPLanguageRuntime.cpp @@ -11,6 +11,8 @@ #include <string.h> +#include <memory> + #include "llvm/ADT/StringRef.h" #include "lldb/Symbol/Block.h" @@ -327,16 +329,16 @@ CPPLanguageRuntime::GetStepThroughTrampolinePlan(Thread &thread, value_sp->GetValueIsValid()) { // We found the std::function wrapped callable and we have its address. // We now create a ThreadPlan to run to the callable. - ret_plan_sp.reset(new ThreadPlanRunToAddress( - thread, callable_info.callable_address, stop_others)); + ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>( + thread, callable_info.callable_address, stop_others); return ret_plan_sp; } else { // We are in std::function but we could not obtain the callable. // We create a ThreadPlan to keep stepping through using the address range // of the current function. - ret_plan_sp.reset(new ThreadPlanStepInRange(thread, range_of_curr_func, - sc, eOnlyThisThread, - eLazyBoolYes, eLazyBoolYes)); + ret_plan_sp = std::make_shared<ThreadPlanStepInRange>( + thread, range_of_curr_func, sc, eOnlyThisThread, eLazyBoolYes, + eLazyBoolYes); return ret_plan_sp; } } diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp index b3540a4fc71..c0597b687b9 100644 --- a/lldb/source/Target/Memory.cpp +++ b/lldb/source/Target/Memory.cpp @@ -7,13 +7,16 @@ //===----------------------------------------------------------------------===// #include "lldb/Target/Memory.h" -#include <inttypes.h> + #include "lldb/Core/RangeMap.h" #include "lldb/Target/Process.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/State.h" +#include <cinttypes> +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -357,8 +360,8 @@ AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions, } if (addr != LLDB_INVALID_ADDRESS) { - block_sp.reset( - new AllocatedBlock(addr, page_byte_size, permissions, chunk_size)); + block_sp = std::make_shared<AllocatedBlock>(addr, page_byte_size, + permissions, chunk_size); m_memory_map.insert(std::make_pair(permissions, block_sp)); } return block_sp; diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 86f69d1d062..a93913b25c8 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -9,6 +9,7 @@ #include <algorithm> #include <csignal> #include <fstream> +#include <memory> #include <vector> #include "llvm/Support/FileSystem.h" @@ -78,7 +79,7 @@ ConstString PlatformProperties::GetSettingName() { } PlatformProperties::PlatformProperties() { - m_collection_sp.reset(new OptionValueProperties(GetSettingName())); + m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName()); m_collection_sp->Initialize(g_properties); auto module_cache_dir = GetModuleCacheDirectory(); diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index d9b2b833b46..58d85a2d79a 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include <atomic> +#include <memory> #include <mutex> #include "llvm/Support/ScopedPrinter.h" @@ -163,15 +164,15 @@ ProcessProperties::ProcessProperties(lldb_private::Process *process) { if (process == nullptr) { // Global process properties, set them up one time - m_collection_sp.reset( - new ProcessOptionValueProperties(ConstString("process"))); + m_collection_sp = + std::make_shared<ProcessOptionValueProperties>(ConstString("process")); m_collection_sp->Initialize(g_properties); m_collection_sp->AppendProperty( ConstString("thread"), ConstString("Settings specific to threads."), true, Thread::GetGlobalProperties()->GetValueProperties()); } else { - m_collection_sp.reset( - new ProcessOptionValueProperties(Process::GetGlobalProperties().get())); + m_collection_sp = std::make_shared<ProcessOptionValueProperties>( + Process::GetGlobalProperties().get()); m_collection_sp->SetValueChangedCallback( ePropertyPythonOSPluginPath, ProcessProperties::OptionValueChangedCallback, this); @@ -4670,7 +4671,8 @@ void Process::SetSTDIOFileDescriptor(int fd) { // Now read thread is set up, set up input reader. if (!m_process_input_reader) - m_process_input_reader.reset(new IOHandlerProcessSTDIO(this, fd)); + m_process_input_reader = + std::make_shared<IOHandlerProcessSTDIO>(this, fd); } } } @@ -5944,7 +5946,8 @@ ThreadCollectionSP Process::GetHistoryThreads(lldb::addr_t addr) { return threads; } - threads.reset(new ThreadCollection(memory_history->GetHistoryThreads(addr))); + threads = std::make_shared<ThreadCollection>( + memory_history->GetHistoryThreads(addr)); return threads; } diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index d0f7835efef..0b5b394e5c5 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -33,6 +33,8 @@ #include "lldb/lldb-enumerations.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -422,7 +424,7 @@ VariableList *StackFrame::GetVariableList(bool get_file_globals) { const bool get_child_variables = true; const bool can_create = true; const bool stop_if_child_block_is_inlined_function = true; - m_variable_list_sp.reset(new VariableList()); + m_variable_list_sp = std::make_shared<VariableList>(); frame_block->AppendBlockVariables(can_create, get_child_variables, stop_if_child_block_is_inlined_function, [](Variable *v) { return true; }, @@ -1173,7 +1175,7 @@ ValueObjectSP StackFrame::TrackGlobalVariable(const VariableSP &variable_sp, VariableList *var_list = GetVariableList(true); // If this frame has no variables, create a new list if (var_list == nullptr) - m_variable_list_sp.reset(new VariableList()); + m_variable_list_sp = std::make_shared<VariableList>(); // Add the global/static variable to this frame m_variable_list_sp->AddVariable(variable_sp); diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp index 3a97c1375a0..a36fba45c5d 100644 --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -24,6 +24,8 @@ #include "lldb/Utility/Log.h" #include "llvm/ADT/SmallPtrSet.h" +#include <memory> + //#define DEBUG_STACK_FRAMES 1 using namespace lldb; @@ -465,9 +467,9 @@ void StackFrameList::GetFramesUpTo(uint32_t end_idx) { pc = reg_ctx_sp->GetPC(); } - unwind_frame_sp.reset(new StackFrame(m_thread.shared_from_this(), - m_frames.size(), idx, reg_ctx_sp, - cfa, pc, nullptr)); + unwind_frame_sp = std::make_shared<StackFrame>( + m_thread.shared_from_this(), m_frames.size(), idx, reg_ctx_sp, + cfa, pc, nullptr); m_frames.push_back(unwind_frame_sp); } } else { @@ -483,9 +485,9 @@ void StackFrameList::GetFramesUpTo(uint32_t end_idx) { break; } const bool cfa_is_valid = true; - unwind_frame_sp.reset( - new StackFrame(m_thread.shared_from_this(), m_frames.size(), idx, cfa, - cfa_is_valid, pc, StackFrame::Kind::Regular, nullptr)); + unwind_frame_sp = std::make_shared<StackFrame>( + m_thread.shared_from_this(), m_frames.size(), idx, cfa, cfa_is_valid, + pc, StackFrame::Kind::Regular, nullptr); // Create synthetic tail call frames between the previous frame and the // newly-found frame. The new frame's index may change after this call, @@ -663,9 +665,9 @@ StackFrameSP StackFrameList::GetFrameAtIndex(uint32_t idx) { addr_t pc, cfa; if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc)) { const bool cfa_is_valid = true; - frame_sp.reset(new StackFrame(m_thread.shared_from_this(), idx, idx, - cfa, cfa_is_valid, pc, - StackFrame::Kind::Regular, nullptr)); + frame_sp = std::make_shared<StackFrame>( + m_thread.shared_from_this(), idx, idx, cfa, cfa_is_valid, pc, + StackFrame::Kind::Regular, nullptr); Function *function = frame_sp->GetSymbolContext(eSymbolContextFunction).function; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index bc0bdae0ff3..9fbd9fb3683 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -57,6 +57,8 @@ #include "lldb/Utility/State.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" + +#include <memory> #include <mutex> using namespace lldb; @@ -497,12 +499,13 @@ Target::GetSearchFilterForModule(const FileSpec *containingModule) { if (containingModule != nullptr) { // TODO: We should look into sharing module based search filters // across many breakpoints like we do for the simple target based one - filter_sp.reset( - new SearchFilterByModule(shared_from_this(), *containingModule)); + filter_sp = std::make_shared<SearchFilterByModule>(shared_from_this(), + *containingModule); } else { if (!m_search_filter_sp) - m_search_filter_sp.reset( - new SearchFilterForUnconstrainedSearches(shared_from_this())); + m_search_filter_sp = + std::make_shared<SearchFilterForUnconstrainedSearches>( + shared_from_this()); filter_sp = m_search_filter_sp; } return filter_sp; @@ -514,12 +517,13 @@ Target::GetSearchFilterForModuleList(const FileSpecList *containingModules) { if (containingModules && containingModules->GetSize() != 0) { // TODO: We should look into sharing module based search filters // across many breakpoints like we do for the simple target based one - filter_sp.reset( - new SearchFilterByModuleList(shared_from_this(), *containingModules)); + filter_sp = std::make_shared<SearchFilterByModuleList>(shared_from_this(), + *containingModules); } else { if (!m_search_filter_sp) - m_search_filter_sp.reset( - new SearchFilterForUnconstrainedSearches(shared_from_this())); + m_search_filter_sp = + std::make_shared<SearchFilterForUnconstrainedSearches>( + shared_from_this()); filter_sp = m_search_filter_sp; } return filter_sp; @@ -536,11 +540,11 @@ SearchFilterSP Target::GetSearchFilterForModuleAndCUList( // We could make a special "CU List only SearchFilter". Better yet was if // these could be composable, but that will take a little reworking. - filter_sp.reset(new SearchFilterByModuleListAndCU( - shared_from_this(), FileSpecList(), *containingSourceFiles)); + filter_sp = std::make_shared<SearchFilterByModuleListAndCU>( + shared_from_this(), FileSpecList(), *containingSourceFiles); } else { - filter_sp.reset(new SearchFilterByModuleListAndCU( - shared_from_this(), *containingModules, *containingSourceFiles)); + filter_sp = std::make_shared<SearchFilterByModuleListAndCU>( + shared_from_this(), *containingModules, *containingSourceFiles); } return filter_sp; } @@ -604,7 +608,8 @@ Target::CreateScriptedBreakpoint(const llvm::StringRef class_name, } else if (has_modules) { filter_sp = GetSearchFilterForModuleList(containingModules); } else { - filter_sp.reset(new SearchFilterForUnconstrainedSearches(shared_from_this())); + filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>( + shared_from_this()); } StructuredDataImpl *extra_args_impl = new StructuredDataImpl(); @@ -847,7 +852,7 @@ WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size, } if (!wp_sp) { - wp_sp.reset(new Watchpoint(*this, addr, size, type)); + wp_sp = std::make_shared<Watchpoint>(*this, addr, size, type); wp_sp->SetWatchpointType(kind, notify); m_watchpoint_list.Add(wp_sp, true); } @@ -1024,7 +1029,7 @@ Status Target::SerializeBreakpointsToFile(const FileSpec &file, } if (!break_store_ptr) { - break_store_sp.reset(new StructuredData::Array()); + break_store_sp = std::make_shared<StructuredData::Array>(); break_store_ptr = break_store_sp.get(); } @@ -2290,7 +2295,7 @@ ClangASTContext *Target::GetScratchClangASTContext(bool create_on_demand) { ClangASTImporterSP Target::GetClangASTImporter() { if (m_valid) { if (!m_ast_importer_sp) { - m_ast_importer_sp.reset(new ClangASTImporter()); + m_ast_importer_sp = std::make_shared<ClangASTImporter>(); } return m_ast_importer_sp; } @@ -3591,8 +3596,8 @@ TargetExperimentalProperties::TargetExperimentalProperties() TargetProperties::TargetProperties(Target *target) : Properties(), m_launch_info() { if (target) { - m_collection_sp.reset( - new TargetOptionValueProperties(target, Target::GetGlobalProperties())); + m_collection_sp = std::make_shared<TargetOptionValueProperties>( + target, Target::GetGlobalProperties()); // Set callbacks to update launch_info whenever "settins set" updated any // of these properties @@ -3640,8 +3645,8 @@ TargetProperties::TargetProperties(Target *target) DisableASLRValueChangedCallback(this, nullptr); DisableSTDIOValueChangedCallback(this, nullptr); } else { - m_collection_sp.reset( - new TargetOptionValueProperties(ConstString("target"))); + m_collection_sp = + std::make_shared<TargetOptionValueProperties>(ConstString("target")); m_collection_sp->Initialize(g_properties); m_experimental_properties_up.reset(new TargetExperimentalProperties()); m_collection_sp->AppendProperty( diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 2a9065e27a8..2bdaa98733a 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -50,6 +50,8 @@ #include "lldb/Utility/StreamString.h" #include "lldb/lldb-enumerations.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -121,12 +123,12 @@ public: ThreadProperties::ThreadProperties(bool is_global) : Properties() { if (is_global) { - m_collection_sp.reset( - new ThreadOptionValueProperties(ConstString("thread"))); + m_collection_sp = + std::make_shared<ThreadOptionValueProperties>(ConstString("thread")); m_collection_sp->Initialize(g_properties); } else - m_collection_sp.reset( - new ThreadOptionValueProperties(Thread::GetGlobalProperties().get())); + m_collection_sp = std::make_shared<ThreadOptionValueProperties>( + Thread::GetGlobalProperties().get()); } ThreadProperties::~ThreadProperties() = default; @@ -1383,9 +1385,9 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOverRange( const SymbolContext &addr_context, lldb::RunMode stop_other_threads, Status &status, LazyBool step_out_avoids_code_withoug_debug_info) { ThreadPlanSP thread_plan_sp; - thread_plan_sp.reset(new ThreadPlanStepOverRange( + thread_plan_sp = std::make_shared<ThreadPlanStepOverRange>( *this, range, addr_context, stop_other_threads, - step_out_avoids_code_withoug_debug_info)); + step_out_avoids_code_withoug_debug_info); status = QueueThreadPlan(thread_plan_sp, abort_other_plans); return thread_plan_sp; @@ -1603,7 +1605,8 @@ StackFrameListSP Thread::GetStackFrameList() { if (m_curr_frames_sp) { frame_list_sp = m_curr_frames_sp; } else { - frame_list_sp.reset(new StackFrameList(*this, m_prev_frames_sp, true)); + frame_list_sp = + std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true); m_curr_frames_sp = frame_list_sp; } return frame_list_sp; diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index bf2a2ac2ea9..0c488dee16a 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -24,6 +24,8 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/Stream.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -404,8 +406,8 @@ void ThreadPlanCallFunction::DidPush() { GetThread().SetStopInfoToNothing(); #ifndef SINGLE_STEP_EXPRESSIONS - m_subplan_sp.reset( - new ThreadPlanRunToAddress(m_thread, m_start_addr, m_stop_other_threads)); + m_subplan_sp = std::make_shared<ThreadPlanRunToAddress>( + m_thread, m_start_addr, m_stop_other_threads); m_thread.QueueThreadPlan(m_subplan_sp, false); m_subplan_sp->SetPrivate(true); diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 146d72fd45c..2683ec3aa47 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -23,6 +23,8 @@ #include "lldb/Target/ThreadPlanStepThrough.h" #include "lldb/Utility/Log.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -84,9 +86,9 @@ ThreadPlanStepOut::ThreadPlanStepOut( if (frame_idx > 0) { // First queue a plan that gets us to this inlined frame, and when we get // there we'll queue a second plan that walks us out of this frame. - m_step_out_to_inline_plan_sp.reset(new ThreadPlanStepOut( + m_step_out_to_inline_plan_sp = std::make_shared<ThreadPlanStepOut>( m_thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion, - frame_idx - 1, eLazyBoolNo, continue_to_next_branch)); + frame_idx - 1, eLazyBoolNo, continue_to_next_branch); static_cast<ThreadPlanStepOut *>(m_step_out_to_inline_plan_sp.get()) ->SetShouldStopHereCallbacks(nullptr, nullptr); m_step_out_to_inline_plan_sp->SetPrivate(true); @@ -449,8 +451,9 @@ bool ThreadPlanStepOut::QueueInlinedStepPlan(bool queue_now) { m_stop_others ? lldb::eOnlyThisThread : lldb::eAllThreads; const LazyBool avoid_no_debug = eLazyBoolNo; - m_step_through_inline_plan_sp.reset(new ThreadPlanStepOverRange( - m_thread, inline_range, inlined_sc, run_mode, avoid_no_debug)); + m_step_through_inline_plan_sp = + std::make_shared<ThreadPlanStepOverRange>( + m_thread, inline_range, inlined_sc, run_mode, avoid_no_debug); ThreadPlanStepOverRange *step_through_inline_plan_ptr = static_cast<ThreadPlanStepOverRange *>( m_step_through_inline_plan_sp.get()); |