diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp b/lldb/source/Commands/CommandObjectDWIMPrint.cpp --- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp +++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp @@ -88,8 +88,11 @@ if (StackFrame *frame = m_exe_ctx.GetFramePtr()) { auto valobj_sp = frame->FindVariable(ConstString(expr)); if (valobj_sp && valobj_sp->GetError().Success()) { - if (!eval_options.GetSuppressPersistentResult()) - valobj_sp = valobj_sp->Persist(); + if (!eval_options.GetSuppressPersistentResult()) { + auto persisted_valobj = valobj_sp->Persist(); + if (persisted_valobj) + valobj_sp = persisted_valobj; + } if (verbosity == eDWIMPrintVerbosityFull) { StringRef flags;