Made it so we update the current frames from the previous frames by doing STL
swaps on the variable list, value object list, and disassembly. This avoids
us having to try and update frame indexes and other things that were getting
out of sync.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112301 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Core/ValueObjectList.cpp b/source/Core/ValueObjectList.cpp
index 50ae1de..5feeae7 100644
--- a/source/Core/ValueObjectList.cpp
+++ b/source/Core/ValueObjectList.cpp
@@ -117,3 +117,9 @@
}
return valobj_sp;
}
+
+void
+ValueObjectList::Swap (ValueObjectList &value_object_list)
+{
+ m_value_objects.swap (value_object_list.m_value_objects);
+}
diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp
index 972c19a..967df88 100644
--- a/source/Target/StackFrame.cpp
+++ b/source/Target/StackFrame.cpp
@@ -531,11 +531,14 @@
m_sc.DumpStopContext(strm, &m_thread.GetProcess(), GetFrameCodeAddress(), show_module, show_inline);
}
-
void
-StackFrame::SetSymbolContext (const SymbolContext& sc)
+StackFrame::UpdateCurrentFrameFromPreviousFrame (StackFrame &frame)
{
- m_sc = sc;
- m_flags.Clear(eSymbolContextEverything);
- m_flags.Set(m_sc.GetResolvedMask ());
+ assert (GetStackID() == frame.GetStackID()); // TODO: remove this after some testing
+ m_variable_list_sp = frame.m_variable_list_sp;
+ m_value_object_list.Swap (frame.m_value_object_list);
+ if (!m_disassembly.GetString().empty())
+ m_disassembly.GetString().swap (m_disassembly.GetString());
}
+
+
diff --git a/source/Target/StackFrameList.cpp b/source/Target/StackFrameList.cpp
index 249100a..be4e6e4 100644
--- a/source/Target/StackFrameList.cpp
+++ b/source/Target/StackFrameList.cpp
@@ -151,9 +151,9 @@
StackFrameList *curr_frames = this;
#if defined (DEBUG_STACK_FRAMES)
- s.PutCString("prev_frames:\n");
+ s.PutCString("\nprev_frames:\n");
prev_frames->Dump (&s);
- s.PutCString("curr_frames:\n");
+ s.PutCString("\ncurr_frames:\n");
curr_frames->Dump (&s);
s.EOL();
#endif
@@ -203,8 +203,6 @@
// Same function different block
if (m_show_inlined_frames)
break;
- else
- prev_frame->SetSymbolContext (curr_frame->m_sc);
}
}
else if (curr_sc.symbol && curr_sc.symbol == prev_sc.symbol)
@@ -217,27 +215,22 @@
break;
}
- if (curr_frame->GetFrameCodeAddress() != prev_frame->GetFrameCodeAddress())
- {
-#if defined (DEBUG_STACK_FRAMES)
- s.Printf("\nUpdating frame code address and symbol context in previous frame #%u to current frame #%u", prev_frame_idx, curr_frame_idx);
-#endif
- // We have a different code frame address, we might need to copy
- // some stuff in prev_frame, yet update the code address...
- prev_frame->SetFrameCodeAddress (curr_frame->GetFrameCodeAddress());
- prev_frame->SetSymbolContext (curr_frame->m_sc);
- }
-
- curr_frames->m_frames[curr_frame_idx] = prev_frames->m_frames[prev_frame_idx];
+ curr_frame->UpdateCurrentFrameFromPreviousFrame (*prev_frame);
#if defined (DEBUG_STACK_FRAMES)
- s.Printf("\nCopying previous frame #%u to current frame #%u", prev_frame_idx, curr_frame_idx);
+ s.Printf("\n Copying previous frame to current frame");
#endif
}
// We are done with the old stack frame list, we can release it now
m_prev_frames_ap.release();
prev_frames = NULL;
}
+
+#if defined (DEBUG_STACK_FRAMES)
+ s.PutCString("\n\nNew frames:\n");
+ Dump (&s);
+ s.EOL();
+#endif
}
else
{