[Lldb-commits] [lldb] 206e8d8 - Fix SBError::SetErrorToGenericError

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 26 07:45:03 PDT 2020


Author: Andy Yankovsky
Date: 2020-10-26T15:44:38+01:00
New Revision: 206e8d8905035f6e9049b97c9cd8af0eaa5aa118

URL: https://github.com/llvm/llvm-project/commit/206e8d8905035f6e9049b97c9cd8af0eaa5aa118
DIFF: https://github.com/llvm/llvm-project/commit/206e8d8905035f6e9049b97c9cd8af0eaa5aa118.diff

LOG: Fix SBError::SetErrorToGenericError

`SBError::SetErrorToGenericError` should call `Status::SetErrorToGenericError`,
not `Status::SetErrorToErrno`.

Reviewed By: teemperor

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

Added: 
    lldb/test/API/python_api/sberror/TestSBError.py

Modified: 
    lldb/source/API/SBError.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp
index 67c7663d3583..f979572778e0 100644
--- a/lldb/source/API/SBError.cpp
+++ b/lldb/source/API/SBError.cpp
@@ -118,7 +118,7 @@ void SBError::SetErrorToGenericError() {
   LLDB_RECORD_METHOD_NO_ARGS(void, SBError, SetErrorToGenericError);
 
   CreateIfNeeded();
-  m_opaque_up->SetErrorToErrno();
+  m_opaque_up->SetErrorToGenericError();
 }
 
 void SBError::SetErrorString(const char *err_str) {

diff  --git a/lldb/test/API/python_api/sberror/TestSBError.py b/lldb/test/API/python_api/sberror/TestSBError.py
new file mode 100644
index 000000000000..aa798ba48730
--- /dev/null
+++ b/lldb/test/API/python_api/sberror/TestSBError.py
@@ -0,0 +1,13 @@
+"""Test the SBError APIs."""
+
+from lldbsuite.test.lldbtest import *
+
+class TestSBError(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test_generic_error(self):
+        error = lldb.SBError()
+        error.SetErrorToGenericError()
+        self.assertEqual(error.GetType(), lldb.eErrorTypeGeneric)


        


More information about the lldb-commits mailing list