[Lldb-commits] [PATCH] D151351: [lldb] Prevent dwim-print from showing kNoResult error

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 30 15:38:59 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG061a839033dc: [lldb] Prevent dwim-print from showing kNoResult error (authored by kastiglione).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151351/new/

https://reviews.llvm.org/D151351

Files:
  lldb/source/Commands/CommandObjectDWIMPrint.cpp
  lldb/test/API/commands/dwim-print/TestDWIMPrint.py


Index: lldb/test/API/commands/dwim-print/TestDWIMPrint.py
===================================================================
--- lldb/test/API/commands/dwim-print/TestDWIMPrint.py
+++ lldb/test/API/commands/dwim-print/TestDWIMPrint.py
@@ -138,3 +138,9 @@
         self.runCmd("type summary add -e -s 'stub summary' Structure")
         self._expect_cmd(f"dwim-print s", "frame variable")
         self._expect_cmd(f"dwim-print (struct Structure)s", "expression")
+
+    def test_void_result(self):
+        """Test dwim-print does not surface an error message for void expressions."""
+        self.build()
+        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
+        self.expect("dwim-print (void)15", matching=False, patterns=["(?i)error"])
Index: lldb/source/Commands/CommandObjectDWIMPrint.cpp
===================================================================
--- lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -11,6 +11,7 @@
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/DumpValueObjectOptions.h"
 #include "lldb/Expression/ExpressionVariable.h"
+#include "lldb/Expression/UserExpression.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
@@ -135,7 +136,8 @@
                                         expr);
       }
 
-      valobj_sp->Dump(result.GetOutputStream(), dump_options);
+      if (valobj_sp->GetError().GetError() != UserExpression::kNoResult)
+        valobj_sp->Dump(result.GetOutputStream(), dump_options);
 
       if (suppress_result)
         if (auto result_var_sp =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151351.526823.patch
Type: text/x-patch
Size: 1710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230530/65362119/attachment.bin>


More information about the lldb-commits mailing list