From b3ae87617437c5850003cd7ab35e0b3581d2b7da Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Fri, 12 Apr 2013 20:07:46 +0000 Subject: Made some fixes to the OperatingSystemPython class: - If any thread dictionary contains any "core=N" key/value pairs then the threads obtained from the lldb_private::Process itself will be placed inside the ThreadMemory threads and will be used to get the information for a thread. - Cleaned up all the places where a thread inside a thread was causing problems llvm-svn: 179405 --- .../Python/OperatingSystemPython.cpp | 46 +++++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp') diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index c80b88c..650c713 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -186,17 +186,40 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, ThreadList 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 PythonList threads_list(m_interpreter->OSPlugin_ThreadsInfo(m_python_object_sp)); if (threads_list) { + ThreadList core_thread_list(new_thread_list); + + threads_list.Dump(); // REMOVE THIS + + uint32_t i; const uint32_t num_threads = threads_list.GetSize(); - for (uint32_t i=0; iFindThreadByID (tid, false); + thread_sp = old_thread_list.FindThreadByID (tid, false); if (!thread_sp) { if (did_create_ptr) @@ -242,6 +269,12 @@ OperatingSystemPython::CreateThreadFromThreadInfo (PythonDictionary &thread_dict name, queue, reg_data_addr)); + + } + + if (core_number < core_thread_list.GetSize(false)) + { + thread_sp->SetBackingThread(core_thread_list.GetThreadAtIndex(core_number, false)); } } } @@ -335,9 +368,10 @@ OperatingSystemPython::CreateThread (lldb::tid_t tid, addr_t context) PythonDictionary thread_info_dict (m_interpreter->OSPlugin_CreateThread(m_python_object_sp, tid, context)); if (thread_info_dict) { + ThreadList core_threads(m_process); ThreadList &thread_list = m_process->GetThreadList(); bool did_create = false; - ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_info_dict, &thread_list, &did_create)); + ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_info_dict, core_threads, thread_list, &did_create)); if (did_create) thread_list.AddThread(thread_sp); return thread_sp; -- cgit v1.1