diff options
Diffstat (limited to 'lldb/source/Plugins/OperatingSystem/Python')
-rw-r--r-- | lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 0528033f3b1..1af044e00e2 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -198,36 +198,39 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, { uint32_t i; const uint32_t num_threads = threads_list.GetSize(); - for (i=0; i<num_threads; ++i) + if (num_threads > 0) { - PythonDictionary thread_dict(threads_list.GetItemAtIndex(i)); - if (thread_dict) + for (i=0; i<num_threads; ++i) { - if (thread_dict.GetItemForKey("core")) + PythonDictionary thread_dict(threads_list.GetItemAtIndex(i)); + if (thread_dict) { - // We have some threads that are saying they are on a "core", which means - // they map the threads that are gotten from the lldb_private::Process subclass - // so clear the new threads list so the core threads don't show up - new_thread_list.Clear(); - break; + if (thread_dict.GetItemForKey("core")) + { + // We have some threads that are saying they are on a "core", which means + // they map the threads that are gotten from the lldb_private::Process subclass + // so clear the new threads list so the core threads don't show up + new_thread_list.Clear(); + break; + } } } - } - for (i=0; i<num_threads; ++i) - { - PythonDictionary thread_dict(threads_list.GetItemAtIndex(i)); - if (thread_dict) + for (i=0; i<num_threads; ++i) { - ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_dict, core_thread_list, old_thread_list, NULL)); - if (thread_sp) - new_thread_list.AddThread(thread_sp); + PythonDictionary thread_dict(threads_list.GetItemAtIndex(i)); + if (thread_dict) + { + ThreadSP thread_sp (CreateThreadFromThreadInfo (thread_dict, core_thread_list, old_thread_list, NULL)); + if (thread_sp) + new_thread_list.AddThread(thread_sp); + } } } } - else - { + + if (new_thread_list.GetSize(false) == 0) new_thread_list = old_thread_list; - } + return new_thread_list.GetSize(false) > 0; } |