[Lldb-commits] [lldb] 08f70ad - Revert "[lldb] Set result error state in 'frame variable'"

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Sun Jan 9 14:12:58 PST 2022


Author: Dave Lee
Date: 2022-01-09T14:12:47-08:00
New Revision: 08f70adedb775ce6d41a1f8ad75c4bac225efb5b

URL: https://github.com/llvm/llvm-project/commit/08f70adedb775ce6d41a1f8ad75c4bac225efb5b
DIFF: https://github.com/llvm/llvm-project/commit/08f70adedb775ce6d41a1f8ad75c4bac225efb5b.diff

LOG: Revert "[lldb] Set result error state in 'frame variable'"

This reverts commit 2bcff220bf1e372e91491911fe0bb76c4c4bbef8.

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectFrame.cpp
    lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 8dd1a79d38959..9cfe997f92274 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -558,16 +558,18 @@ may even involve JITing and running code in the target program.)");
                   }
                 }
               } else if (num_matches == 0) {
-                result.AppendErrorWithFormat(
-                    "no variables matched the regular expression '%s'.",
-                    entry.c_str());
+                result.GetErrorStream().Printf("error: no variables matched "
+                                               "the regular expression '%s'.\n",
+                                               entry.c_str());
               }
             } else {
               if (llvm::Error err = regex.GetError())
-                result.AppendError(llvm::toString(std::move(err)));
+                result.GetErrorStream().Printf(
+                    "error: %s\n", llvm::toString(std::move(err)).c_str());
               else
-                result.AppendErrorWithFormat(
-                    "unknown regex error when compiling '%s'", entry.c_str());
+                result.GetErrorStream().Printf(
+                    "error: unknown regex error when compiling '%s'\n",
+                    entry.c_str());
             }
           } else // No regex, either exact variable names or variable
                  // expressions.
@@ -603,13 +605,14 @@ may even involve JITing and running code in the target program.)");
                   valobj_sp->GetParent() ? entry.c_str() : nullptr);
               valobj_sp->Dump(output_stream, options);
             } else {
-              if (auto error_cstr = error.AsCString(nullptr))
-                result.AppendError(error_cstr);
+              const char *error_cstr = error.AsCString(nullptr);
+              if (error_cstr)
+                result.GetErrorStream().Printf("error: %s\n", error_cstr);
               else
-                result.AppendErrorWithFormat(
-                    "unable to find any variable expression path that matches "
-                    "'%s'.",
-                    entry.c_str());
+                result.GetErrorStream().Printf("error: unable to find any "
+                                               "variable expression path that "
+                                               "matches '%s'.\n",
+                                               entry.c_str());
             }
           }
         }
@@ -677,8 +680,7 @@ may even involve JITing and running code in the target program.)");
           }
         }
       }
-      if (result.GetStatus() != eReturnStatusFailed)
-        result.SetStatus(eReturnStatusSuccessFinishResult);
+      result.SetStatus(eReturnStatusSuccessFinishResult);
     }
 
     if (m_option_variable.show_recognized_args) {

diff  --git a/lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py b/lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
index 2682e42be9caf..6352b68e7d753 100644
--- a/lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
+++ b/lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
@@ -30,9 +30,6 @@ def test_with_run_command(self):
 
         self.expect('frame variable c', substrs=["'A"])
 
-        self.expect('frame variable x', error=True,
-                    substrs=["no variable named 'x' found"])
-        self.expect('frame variable y', error=True,
-                    substrs=["no variable named 'y' found"])
-        self.expect('frame variable z', error=True,
-                    substrs=["no variable named 'z' found"])
+        self.expect('frame variable x', matching=False, substrs=['3'])
+        self.expect('frame variable y', matching=False, substrs=["'B'"])
+        self.expect('frame variable z', matching=False, substrs=['14'])


        


More information about the lldb-commits mailing list