diff options
Diffstat (limited to 'source/Plugins/OperatingSystem')
4 files changed, 23 insertions, 40 deletions
diff --git a/source/Plugins/OperatingSystem/Go/Makefile b/source/Plugins/OperatingSystem/Go/Makefile deleted file mode 100644 index 7d06d483d3ae..000000000000 --- a/source/Plugins/OperatingSystem/Go/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -##==- source/Plugins/OperatingSystem/Go/Makefile --------*- Makefile -*-==## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LLDB_LEVEL := ../../../.. -LIBRARYNAME := lldbPluginOSGo -BUILD_ARCHIVE = 1 - -include $(LLDB_LEVEL)/Makefile diff --git a/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp b/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp index 86c574f2776c..ec0b7014d4d4 100644 --- a/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp +++ b/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp @@ -197,7 +197,7 @@ OperatingSystemGo::CreateInstance(Process *process, bool force) if (!target_sp) return nullptr; ModuleList &module_list = target_sp->GetImages(); - Mutex::Locker modules_locker(module_list.GetMutex()); + std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex()); const size_t num_modules = module_list.GetSize(); bool found_go_runtime = false; for (size_t i = 0; i < num_modules; ++i) @@ -249,8 +249,19 @@ OperatingSystemGo::Init(ThreadList &threads) TargetSP target_sp = m_process->CalculateTarget(); if (!target_sp) return false; - m_allg_sp = FindGlobal(target_sp, "runtime.allg"); - m_allglen_sp = FindGlobal(target_sp, "runtime.allglen"); + // Go 1.6 stores goroutines in a slice called runtime.allgs + ValueObjectSP allgs_sp = FindGlobal(target_sp, "runtime.allgs"); + if (allgs_sp) + { + m_allg_sp = allgs_sp->GetChildMemberWithName(ConstString("array"), true); + m_allglen_sp = allgs_sp->GetChildMemberWithName(ConstString("len"), true); + } + else + { + // Go 1.4 stores goroutines in the variable runtime.allg. + m_allg_sp = FindGlobal(target_sp, "runtime.allg"); + m_allglen_sp = FindGlobal(target_sp, "runtime.allglen"); + } if (m_allg_sp && !m_allglen_sp) { @@ -506,7 +517,7 @@ OperatingSystemGo::Goroutine OperatingSystemGo::CreateGoroutineAtIndex(uint64_t idx, Error &err) { err.Clear(); - Goroutine result; + Goroutine result = {}; ValueObjectSP g = m_allg_sp->GetSyntheticArrayMember(idx, true)->Dereference(err); if (err.Fail()) { diff --git a/source/Plugins/OperatingSystem/Python/Makefile b/source/Plugins/OperatingSystem/Python/Makefile deleted file mode 100644 index 67cd0acd7038..000000000000 --- a/source/Plugins/OperatingSystem/Python/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -##==- source/Plugins/OperatingSystem/Python/Makefile --------*- Makefile -*-==## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LLDB_LEVEL := ../../../.. -LIBRARYNAME := lldbPluginOSPython -BUILD_ARCHIVE = 1 - -include $(LLDB_LEVEL)/Makefile diff --git a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index a556b0e84e83..dfb631e399f1 100644 --- a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -183,16 +183,16 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, // This is a recursive lock so we can grant it to any Python code called on // the stack below us. Target &target = m_process->GetTarget(); - Mutex::Locker api_locker; - api_locker.TryLock(target.GetAPIMutex()); - + std::unique_lock<std::recursive_mutex> lock(target.GetAPIMutex(), std::defer_lock); + lock.try_lock(); + if (log) log->Printf ("OperatingSystemPython::UpdateThreadList() fetching thread data from python for pid %" PRIu64, m_process->GetID()); // The threads that are in "new_thread_list" upon entry are the threads from the // lldb_private::Process subclass, no memory threads will be in this list. - - auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure threads_list stays alive + + auto interpreter_lock = m_interpreter->AcquireInterpreterLock(); // to make sure threads_list stays alive StructuredData::ArraySP threads_list = m_interpreter->OSPlugin_ThreadsInfo(m_python_object_sp); const uint32_t num_cores = core_thread_list.GetSize(false); @@ -324,7 +324,7 @@ OperatingSystemPython::CreateRegisterContextForThread (Thread *thread, addr_t re // content of the process, and we're going to use python, which requires the API lock to do it. // So get & hold that. This is a recursive lock so we can grant it to any Python code called on the stack below us. Target &target = m_process->GetTarget(); - Mutex::Locker api_locker (target.GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex()); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD)); @@ -399,8 +399,8 @@ OperatingSystemPython::CreateThread (lldb::tid_t tid, addr_t context) // content of the process, and we're going to use python, which requires the API lock to do it. // So get & hold that. This is a recursive lock so we can grant it to any Python code called on the stack below us. Target &target = m_process->GetTarget(); - Mutex::Locker api_locker (target.GetAPIMutex()); - + std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex()); + auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure thread_info_dict stays alive StructuredData::DictionarySP thread_info_dict = m_interpreter->OSPlugin_CreateThread(m_python_object_sp, tid, context); std::vector<bool> core_used_map; |