diff options
Diffstat (limited to 'lldb/source/Target')
-rw-r--r-- | lldb/source/Target/InstrumentationRuntime.cpp | 10 | ||||
-rw-r--r-- | lldb/source/Target/Language.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/Platform.cpp | 7 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Target/StackFrameList.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Target/StackFrameRecognizer.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/StopInfo.cpp | 37 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Target/Thread.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanStepRange.cpp | 4 |
10 files changed, 64 insertions, 33 deletions
diff --git a/lldb/source/Target/InstrumentationRuntime.cpp b/lldb/source/Target/InstrumentationRuntime.cpp index 9da06e8..7e58e8b 100644 --- a/lldb/source/Target/InstrumentationRuntime.cpp +++ b/lldb/source/Target/InstrumentationRuntime.cpp @@ -49,10 +49,10 @@ void InstrumentationRuntime::ModulesDidLoad( return; } - module_list.ForEach([this](const lldb::ModuleSP module_sp) -> bool { + module_list.ForEach([this](const lldb::ModuleSP module_sp) { const FileSpec &file_spec = module_sp->GetFileSpec(); if (!file_spec) - return true; // Keep iterating. + return IterationAction::Continue; const RegularExpression &runtime_regex = GetPatternForRuntimeLibrary(); if (runtime_regex.Execute(file_spec.GetFilename().GetCString()) || @@ -62,16 +62,16 @@ void InstrumentationRuntime::ModulesDidLoad( Activate(); if (!IsActive()) SetRuntimeModuleSP({}); // Don't cache module if activation failed. - return false; // Stop iterating, we're done. + return IterationAction::Stop; } } - return true; + return IterationAction::Continue; }); } lldb::ThreadCollectionSP InstrumentationRuntime::GetBacktracesFromExtendedStopInfo( StructuredData::ObjectSP info) { - return ThreadCollectionSP(new ThreadCollection()); + return std::make_shared<ThreadCollection>(); } diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index 86754c2..484d9ba 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -257,7 +257,7 @@ static uint32_t num_languages = LanguageType Language::GetLanguageTypeFromString(llvm::StringRef string) { for (const auto &L : language_names) { if (string.equals_insensitive(L.name)) - return static_cast<LanguageType>(L.type); + return L.type; } return eLanguageTypeUnknown; diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 8000cd0..e9d9c8f 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -2076,6 +2076,13 @@ size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target, trap_opcode_size = sizeof(g_loongarch_opcode); } break; + case llvm::Triple::wasm32: { + // Unreachable (0x00) triggers an unconditional trap. + static const uint8_t g_wasm_opcode[] = {0x00}; + trap_opcode = g_wasm_opcode; + trap_opcode_size = sizeof(g_wasm_opcode); + } break; + default: return 0; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 2aa02fd..ff9e5fc 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -166,6 +166,9 @@ ProcessProperties::ProcessProperties(lldb_private::Process *process) m_collection_sp->SetValueChangedCallback( ePropertyPythonOSPluginPath, [this] { m_process->LoadOperatingSystemPlugin(true); }); + m_collection_sp->SetValueChangedCallback( + ePropertyDisableLangRuntimeUnwindPlans, + [this] { DisableLanguageRuntimeUnwindPlansCallback(); }); } m_experimental_properties_up = @@ -280,6 +283,15 @@ void ProcessProperties::SetDisableLangRuntimeUnwindPlans(bool disable) { m_process->Flush(); } +void ProcessProperties::DisableLanguageRuntimeUnwindPlansCallback() { + if (!m_process) + return; + for (auto thread_sp : m_process->Threads()) { + thread_sp->ClearStackFrames(); + thread_sp->DiscardThreadPlans(/*force*/ true); + } +} + bool ProcessProperties::GetDetachKeepsStopped() const { const uint32_t idx = ePropertyDetachKeepsStopped; return GetPropertyAtIndexAs<bool>( diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp index 16cd254..aedfc52 100644 --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -783,6 +783,8 @@ void StackFrameList::SelectMostRelevantFrame() { uint32_t StackFrameList::GetSelectedFrameIndex(SelectMostRelevant select_most_relevant) { + std::lock_guard<std::recursive_mutex> guard(m_selected_frame_mutex); + if (!m_selected_frame_idx && select_most_relevant) SelectMostRelevantFrame(); if (!m_selected_frame_idx) { @@ -798,6 +800,8 @@ StackFrameList::GetSelectedFrameIndex(SelectMostRelevant select_most_relevant) { uint32_t StackFrameList::SetSelectedFrame(lldb_private::StackFrame *frame) { std::shared_lock<std::shared_mutex> guard(m_list_mutex); + std::lock_guard<std::recursive_mutex> selected_frame_guard( + m_selected_frame_mutex); const_iterator pos; const_iterator begin = m_frames.begin(); @@ -851,6 +855,8 @@ void StackFrameList::Clear() { std::unique_lock<std::shared_mutex> guard(m_list_mutex); m_frames.clear(); m_concrete_frames_fetched = 0; + std::lock_guard<std::recursive_mutex> selected_frame_guard( + m_selected_frame_mutex); m_selected_frame_idx.reset(); } diff --git a/lldb/source/Target/StackFrameRecognizer.cpp b/lldb/source/Target/StackFrameRecognizer.cpp index d23c1fa..9d5116c 100644 --- a/lldb/source/Target/StackFrameRecognizer.cpp +++ b/lldb/source/Target/StackFrameRecognizer.cpp @@ -41,7 +41,7 @@ ScriptedStackFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame) { ValueObjectListSP args = m_interpreter->GetRecognizedArguments(m_python_object_sp, frame); - auto args_synthesized = ValueObjectListSP(new ValueObjectList()); + auto args_synthesized = std::make_shared<ValueObjectList>(); if (args) { for (const auto &o : args->GetObjects()) args_synthesized->Append(ValueObjectRecognizerSynthesizedValue::Create( diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index 19f89b8..ddf8c62 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -851,8 +851,9 @@ protected: // We have to step over the watchpoint before we know what to do: StopInfoWatchpointSP me_as_siwp_sp = std::static_pointer_cast<StopInfoWatchpoint>(shared_from_this()); - ThreadPlanSP step_over_wp_sp(new ThreadPlanStepOverWatchpoint( - *(thread_sp.get()), me_as_siwp_sp, wp_sp)); + ThreadPlanSP step_over_wp_sp = + std::make_shared<ThreadPlanStepOverWatchpoint>(*(thread_sp.get()), + me_as_siwp_sp, wp_sp); // When this plan is done we want to stop, so set this as a Controlling // plan. step_over_wp_sp->SetIsControllingPlan(true); @@ -1475,13 +1476,13 @@ StopInfoSP StopInfo::CreateStopReasonWithBreakpointSiteID(Thread &thread, break_id_t break_id) { thread.SetThreadHitBreakpointSite(); - return StopInfoSP(new StopInfoBreakpoint(thread, break_id)); + return std::make_shared<StopInfoBreakpoint>(thread, break_id); } StopInfoSP StopInfo::CreateStopReasonWithBreakpointSiteID(Thread &thread, break_id_t break_id, bool should_stop) { - return StopInfoSP(new StopInfoBreakpoint(thread, break_id, should_stop)); + return std::make_shared<StopInfoBreakpoint>(thread, break_id, should_stop); } // LWP_TODO: We'll need a CreateStopReasonWithWatchpointResourceID akin @@ -1489,67 +1490,67 @@ StopInfoSP StopInfo::CreateStopReasonWithBreakpointSiteID(Thread &thread, StopInfoSP StopInfo::CreateStopReasonWithWatchpointID(Thread &thread, break_id_t watch_id, bool silently_continue) { - return StopInfoSP( - new StopInfoWatchpoint(thread, watch_id, silently_continue)); + return std::make_shared<StopInfoWatchpoint>(thread, watch_id, + silently_continue); } StopInfoSP StopInfo::CreateStopReasonWithSignal(Thread &thread, int signo, const char *description, std::optional<int> code) { thread.GetProcess()->GetUnixSignals()->IncrementSignalHitCount(signo); - return StopInfoSP(new StopInfoUnixSignal(thread, signo, description, code)); + return std::make_shared<StopInfoUnixSignal>(thread, signo, description, code); } StopInfoSP StopInfo::CreateStopReasonWithInterrupt(Thread &thread, int signo, const char *description) { - return StopInfoSP(new StopInfoInterrupt(thread, signo, description)); + return std::make_shared<StopInfoInterrupt>(thread, signo, description); } StopInfoSP StopInfo::CreateStopReasonToTrace(Thread &thread) { - return StopInfoSP(new StopInfoTrace(thread)); + return std::make_shared<StopInfoTrace>(thread); } StopInfoSP StopInfo::CreateStopReasonWithPlan( ThreadPlanSP &plan_sp, ValueObjectSP return_valobj_sp, ExpressionVariableSP expression_variable_sp) { - return StopInfoSP(new StopInfoThreadPlan(plan_sp, return_valobj_sp, - expression_variable_sp)); + return std::make_shared<StopInfoThreadPlan>(plan_sp, return_valobj_sp, + expression_variable_sp); } StopInfoSP StopInfo::CreateStopReasonWithException(Thread &thread, const char *description) { - return StopInfoSP(new StopInfoException(thread, description)); + return std::make_shared<StopInfoException>(thread, description); } StopInfoSP StopInfo::CreateStopReasonProcessorTrace(Thread &thread, const char *description) { - return StopInfoSP(new StopInfoProcessorTrace(thread, description)); + return std::make_shared<StopInfoProcessorTrace>(thread, description); } StopInfoSP StopInfo::CreateStopReasonHistoryBoundary(Thread &thread, const char *description) { - return StopInfoSP(new StopInfoHistoryBoundary(thread, description)); + return std::make_shared<StopInfoHistoryBoundary>(thread, description); } StopInfoSP StopInfo::CreateStopReasonWithExec(Thread &thread) { - return StopInfoSP(new StopInfoExec(thread)); + return std::make_shared<StopInfoExec>(thread); } StopInfoSP StopInfo::CreateStopReasonFork(Thread &thread, lldb::pid_t child_pid, lldb::tid_t child_tid) { - return StopInfoSP(new StopInfoFork(thread, child_pid, child_tid)); + return std::make_shared<StopInfoFork>(thread, child_pid, child_tid); } StopInfoSP StopInfo::CreateStopReasonVFork(Thread &thread, lldb::pid_t child_pid, lldb::tid_t child_tid) { - return StopInfoSP(new StopInfoVFork(thread, child_pid, child_tid)); + return std::make_shared<StopInfoVFork>(thread, child_pid, child_tid); } StopInfoSP StopInfo::CreateStopReasonVForkDone(Thread &thread) { - return StopInfoSP(new StopInfoVForkDone(thread)); + return std::make_shared<StopInfoVForkDone>(thread); } ValueObjectSP StopInfo::GetReturnValueObject(StopInfoSP &stop_info_sp) { diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 7f56917..4f39f60 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -36,6 +36,7 @@ #include "lldb/Host/StreamFile.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Interpreter/Interfaces/ScriptedBreakpointInterface.h" #include "lldb/Interpreter/Interfaces/ScriptedStopHookInterface.h" #include "lldb/Interpreter/OptionGroupWatchpoint.h" #include "lldb/Interpreter/OptionValues.h" @@ -1987,8 +1988,11 @@ size_t Target::ReadMemoryFromFileCache(const Address &addr, void *dst, size_t Target::ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory, - lldb::addr_t *load_addr_ptr) { + lldb::addr_t *load_addr_ptr, + bool *did_read_live_memory) { error.Clear(); + if (did_read_live_memory) + *did_read_live_memory = false; Address fixed_addr = addr; if (ProcessIsValid()) @@ -2086,6 +2090,8 @@ size_t Target::ReadMemory(const Address &addr, void *dst, size_t dst_len, if (bytes_read) { if (load_addr_ptr) *load_addr_ptr = load_addr; + if (did_read_live_memory) + *did_read_live_memory = true; return bytes_read; } } @@ -2482,9 +2488,9 @@ ModuleSP Target::GetOrCreateModule(const ModuleSpec &orig_module_spec, ModuleList found_modules; m_images.FindModules(module_spec_copy, found_modules); - found_modules.ForEach([&](const ModuleSP &found_module) -> bool { + found_modules.ForEach([&](const ModuleSP &found_module) { old_modules.push_back(found_module); - return true; + return IterationAction::Continue; }); } diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index c688948..8c3e197 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -710,9 +710,8 @@ bool Thread::ShouldResume(StateType resume_state) { const uint32_t process_stop_id = GetProcess()->GetStopID(); if (m_stop_info_stop_id == process_stop_id && (m_stop_info_sp && m_stop_info_sp->IsValid())) { - StopInfo *stop_info = GetPrivateStopInfo().get(); - if (stop_info) - stop_info->WillResume(resume_state); + if (StopInfoSP stop_info_sp = GetPrivateStopInfo()) + stop_info_sp->WillResume(resume_state); } // Tell all the plans that we are about to resume in case they need to clear diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp index 78e1270..dca96cc 100644 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -428,8 +428,8 @@ bool ThreadPlanStepRange::SetNextBranchBreakpoint() { top_most_line_entry.line = call_site.GetLine(); top_most_line_entry.column = call_site.GetColumn(); FileSpec call_site_file_spec = call_site.GetFile(); - top_most_line_entry.original_file_sp.reset( - new SupportFile(call_site_file_spec)); + top_most_line_entry.original_file_sp = + std::make_shared<SupportFile>(call_site_file_spec); top_most_line_entry.range = range; top_most_line_entry.file_sp.reset(); top_most_line_entry.ApplyFileMappings( |