1 //===-- PythonExceptionState.h ----------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H
10 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H
12 #ifndef LLDB_DISABLE_PYTHON
14 #include "PythonDataObjects.h"
16 namespace lldb_private {
18 class PythonExceptionState {
20 explicit PythonExceptionState(bool restore_on_exit);
21 ~PythonExceptionState();
23 void Acquire(bool restore_on_exit);
31 static bool HasErrorOccurred();
35 PythonObject GetType() const;
37 PythonObject GetValue() const;
39 PythonObject GetTraceback() const;
41 std::string Format() const;
44 std::string ReadBacktrace() const;
46 bool m_restore_on_exit;
50 PythonObject m_traceback;