[Lldb-commits] [lldb] 581ac50 - [lldb] Only replace valobj with persisted one if not null in DWIMPrint

Augusto Noronha via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 8 14:19:02 PST 2023


Author: Augusto Noronha
Date: 2023-03-08T14:18:40-08:00
New Revision: 581ac50d58b99a37244e9d4e0d8d12c9c810f472

URL: https://github.com/llvm/llvm-project/commit/581ac50d58b99a37244e9d4e0d8d12c9c810f472
DIFF: https://github.com/llvm/llvm-project/commit/581ac50d58b99a37244e9d4e0d8d12c9c810f472.diff

LOG: [lldb] Only replace valobj with persisted one if not null in DWIMPrint

Differential Revision: https://reviews.llvm.org/D145612

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectDWIMPrint.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index e2e6f6706dee0..d8bc7a1e89696 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -88,8 +88,10 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command,
   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()) {
+        if (auto persisted_valobj = valobj_sp->Persist())
+          valobj_sp = persisted_valobj;
+      }
 
       if (verbosity == eDWIMPrintVerbosityFull) {
         StringRef flags;


        


More information about the lldb-commits mailing list