Make the StackFrameList::GetFrameAtIndex only fetch as many stack frames as needed to 
get the frame requested.
<rdar://problem/10943135>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151705 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index 0db727e..7a5e7f0 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -1069,7 +1069,10 @@
 void
 Thread::ClearStackFrames ()
 {
-    if (m_curr_frames_sp && m_curr_frames_sp->GetNumFrames (false) > 1)
+    // Only store away the old "reference" StackFrameList if we got all its frames:
+    // FIXME: At some point we can try to splice in the frames we have fetched into
+    // the new frame as we make it, but let's not try that now.
+    if (m_curr_frames_sp && m_curr_frames_sp->GetAllFramesFetched())
         m_prev_frames_sp.swap (m_curr_frames_sp);
     m_curr_frames_sp.reset();
 }