diff options
Diffstat (limited to 'lldb/source/Target')
-rw-r--r-- | lldb/source/Target/Language.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Target/TargetList.cpp | 12 |
3 files changed, 16 insertions, 1 deletions
diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index 395718e..2efd4bc 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -549,7 +549,7 @@ Language::~Language() = default; static std::optional<llvm::dwarf::SourceLanguage> ToDwarfSourceLanguage(lldb::LanguageType language_type) { - if (language_type < lldb::eLanguageTypeLastStandardLanguage) + if (language_type <= lldb::eLanguageTypeLastStandardLanguage) return static_cast<llvm::dwarf::SourceLanguage>(language_type); switch (language_type) { diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index fa98c24..e0286c4 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -139,6 +139,8 @@ private: }; } // namespace +static std::atomic<lldb::user_id_t> g_target_unique_id{1}; + template <typename Installer> static Status installExecutable(const Installer &installer) { if (!installer.m_local_file || !installer.m_remote_file) @@ -183,6 +185,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, m_source_manager_up(), m_stop_hooks(), m_stop_hook_next_id(0), m_latest_stop_hook_id(0), m_valid(true), m_suppress_stop_hooks(false), m_is_dummy_target(is_dummy_target), + m_target_unique_id(g_target_unique_id++), m_frame_recognizer_manager_up( std::make_unique<StackFrameRecognizerManager>()) { SetEventName(eBroadcastBitBreakpointChanged, "breakpoint-changed"); diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 7037dc2..188c250 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -428,6 +428,18 @@ TargetSP TargetList::FindTargetWithProcess(Process *process) const { return target_sp; } +TargetSP TargetList::FindTargetByGloballyUniqueID(lldb::user_id_t id) const { + std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); + auto it = llvm::find_if(m_target_list, [id](const TargetSP &item) { + return item->GetGloballyUniqueID() == id; + }); + + if (it != m_target_list.end()) + return *it; + + return TargetSP(); +} + TargetSP TargetList::GetTargetSP(Target *target) const { TargetSP target_sp; if (!target) |