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)