[Lldb-commits] [lldb] r138690 - /lldb/tags/lldb-76/source/Commands/CommandObjectFrame.cpp
Jim Ingham
jingham at apple.com
Fri Aug 26 17:46:25 PDT 2011
Author: jingham
Date: Fri Aug 26 19:46:25 2011
New Revision: 138690
URL: http://llvm.org/viewvc/llvm-project?rev=138690&view=rev
Log:
Fix CommandObjectFrameVariable::Execute so that it holds onto a shared pointer to the frame it is
inspecting, in case running code causes someone else to clear the stack list.
Modified:
lldb/tags/lldb-76/source/Commands/CommandObjectFrame.cpp
Modified: lldb/tags/lldb-76/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-76/source/Commands/CommandObjectFrame.cpp?rev=138690&r1=138689&r2=138690&view=diff
==============================================================================
--- lldb/tags/lldb-76/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/tags/lldb-76/source/Commands/CommandObjectFrame.cpp Fri Aug 26 19:46:25 2011
@@ -431,7 +431,13 @@
Stream &s = result.GetOutputStream();
bool get_file_globals = true;
- VariableList *variable_list = exe_ctx.frame->GetVariableList (get_file_globals);
+
+ // Be careful about the stack frame, if any summary formatter runs code, it might clear the StackFrameList
+ // for the thread. So hold onto a shared pointer to the frame so it stays alive.
+
+ StackFrameSP frame_sp = exe_ctx.frame->GetSP();
+
+ VariableList *variable_list = frame_sp->GetVariableList (get_file_globals);
VariableSP var_sp;
ValueObjectSP valobj_sp;
@@ -488,7 +494,7 @@
var_sp = regex_var_list.GetVariableAtIndex (regex_idx);
if (var_sp)
{
- valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
+ valobj_sp = frame_sp->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
if (valobj_sp)
{
if (m_option_variable.format != eFormatDefault)
@@ -529,7 +535,7 @@
Error error;
uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember;
lldb::VariableSP var_sp;
- valobj_sp = exe_ctx.frame->GetValueForVariableExpressionPath (name_cstr,
+ valobj_sp = frame_sp->GetValueForVariableExpressionPath (name_cstr,
m_varobj_options.use_dynamic,
expr_path_options,
var_sp,
@@ -609,7 +615,7 @@
// Use the variable object code to make sure we are
// using the same APIs as the the public API will be
// using...
- valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp,
+ valobj_sp = frame_sp->GetValueObjectForFrameVariable (var_sp,
m_varobj_options.use_dynamic);
if (valobj_sp)
{
More information about the lldb-commits
mailing list