Files
llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.h
T

57 lines
1.1 KiB
C++
Raw Normal View History

2015-11-13 01:24:52 +00:00
//===-- PythonExceptionState.h ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2015-11-13 01:24:52 +00:00
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H
#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H
2018-06-21 17:36:32 +00:00
#ifndef LLDB_DISABLE_PYTHON
2015-11-13 01:24:52 +00:00
#include "PythonDataObjects.h"
namespace lldb_private {
2015-11-13 01:24:52 +00:00
class PythonExceptionState {
public:
explicit PythonExceptionState(bool restore_on_exit);
~PythonExceptionState();
2015-11-13 01:24:52 +00:00
void Acquire(bool restore_on_exit);
2015-11-13 01:24:52 +00:00
void Restore();
2015-11-13 01:24:52 +00:00
void Discard();
2015-11-13 01:24:52 +00:00
void Reset();
static bool HasErrorOccurred();
2015-11-13 01:24:52 +00:00
bool IsError() const;
2015-11-13 01:24:52 +00:00
PythonObject GetType() const;
2015-11-13 01:24:52 +00:00
PythonObject GetValue() const;
2015-11-13 01:24:52 +00:00
PythonObject GetTraceback() const;
2015-11-13 01:24:52 +00:00
std::string Format() const;
2015-11-13 01:24:52 +00:00
private:
std::string ReadBacktrace() const;
2015-11-13 01:24:52 +00:00
bool m_restore_on_exit;
2015-11-13 01:24:52 +00:00
PythonObject m_type;
PythonObject m_value;
PythonObject m_traceback;
2015-11-13 01:24:52 +00:00
};
}
#endif
2018-06-21 17:36:32 +00:00
#endif