[Lldb-commits] [lldb] r112301 - in /lldb/trunk: include/lldb/Core/ValueObjectList.h include/lldb/Target/StackFrame.h source/Core/ValueObjectList.cpp source/Target/StackFrame.cpp source/Target/StackFrameList.cpp
Greg Clayton
gclayton at apple.com
Fri Aug 27 14:47:55 PDT 2010
Author: gclayton
Date: Fri Aug 27 16:47:54 2010
New Revision: 112301
URL: http://llvm.org/viewvc/llvm-project?rev=112301&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/Core/ValueObjectList.h
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/source/Core/ValueObjectList.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/StackFrameList.cpp
Modified: lldb/trunk/include/lldb/Core/ValueObjectList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectList.h?rev=112301&r1=112300&r2=112301&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectList.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectList.h Fri Aug 27 16:47:54 2010
@@ -59,6 +59,9 @@
lldb::ValueObjectSP
FindValueObjectByUID (lldb::user_id_t uid);
+ void
+ Swap (ValueObjectList &value_object_list);
+
protected:
typedef std::vector<lldb::ValueObjectSP> collection;
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=112301&r1=112300&r2=112301&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Fri Aug 27 16:47:54 2010
@@ -131,13 +131,8 @@
}
void
- SetFrameCodeAddress(const Address& frame_code_addr)
- {
- m_frame_code_addr = frame_code_addr;
- }
-
- void
- SetSymbolContext (const SymbolContext& sc);
+ UpdateCurrentFrameFromPreviousFrame (StackFrame &frame);
+
private:
//------------------------------------------------------------------
// For StackFrame only
Modified: lldb/trunk/source/Core/ValueObjectList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectList.cpp?rev=112301&r1=112300&r2=112301&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectList.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectList.cpp Fri Aug 27 16:47:54 2010
@@ -117,3 +117,9 @@
}
return valobj_sp;
}
+
+void
+ValueObjectList::Swap (ValueObjectList &value_object_list)
+{
+ m_value_objects.swap (value_object_list.m_value_objects);
+}
Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=112301&r1=112300&r2=112301&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Fri Aug 27 16:47:54 2010
@@ -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());
}
+
+
Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=112301&r1=112300&r2=112301&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Fri Aug 27 16:47:54 2010
@@ -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
{
More information about the lldb-commits
mailing list