[Lldb-commits] [lldb] r138692 - /lldb/trunk/source/Commands/CommandObjectFrame.cpp
Jim Ingham
jingham at apple.com
Fri Aug 26 18:22:52 PDT 2011
Author: jingham
Date: Fri Aug 26 20:22:52 2011
New Revision: 138692
URL: http://llvm.org/viewvc/llvm-project?rev=138692&view=rev
Log:
Hold onto a shared pointer to the frame CommandObjectFrameVariable::Execute is
analyzing so it won't get deleted on us if a formatter runs code.
Modified:
lldb/trunk/source/Commands/CommandObjectFrame.cpp
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=138692&r1=138691&r2=138692&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Fri Aug 26 20:22:52 2011
@@ -432,7 +432,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;
@@ -489,7 +495,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)
@@ -530,7 +536,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,
@@ -610,7 +616,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