[Lldb-commits] [PATCH] D145612: [lldb] Only replace valobj with persisted one if not null in DWIMPrint

Augusto Noronha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 8 13:43:12 PST 2023


augusto2112 created this revision.
augusto2112 added a reviewer: kastiglione.
Herald added a project: All.
augusto2112 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145612

Files:
  lldb/source/Commands/CommandObjectDWIMPrint.cpp


Index: lldb/source/Commands/CommandObjectDWIMPrint.cpp
===================================================================
--- lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145612.503503.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230308/32a9c1d2/attachment.bin>


More information about the lldb-commits mailing list