<rdar://problem/13491977>

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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179405 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index d60930e..6a39442 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -1523,7 +1523,16 @@
                 {
                     OperatingSystem *os = GetOperatingSystem ();
                     if (os)
+                    {
+                        // Clear any old backing threads where memory threads might have been
+                        // backed by actual threads from the lldb_private::Process subclass
+                        size_t num_old_threads = m_thread_list.GetSize(false);
+                        for (size_t i=0; i<num_old_threads; ++i)
+                            m_thread_list.GetThreadAtIndex(i, false)->ClearBackingThread();
+
+                        // Now let the OperatingSystem plug-in update the thread list
                         os->UpdateThreadList (m_thread_list, new_thread_list);
+                    }
                     m_thread_list.Update (new_thread_list);
                     m_thread_list.SetStopID (stop_id);
                 }