19f2f44ceSEd Maste //===-- PythonExceptionState.h ----------------------------------*- C++ -*-===// 29f2f44ceSEd Maste // 39f2f44ceSEd Maste // The LLVM Compiler Infrastructure 49f2f44ceSEd Maste // 59f2f44ceSEd Maste // This file is distributed under the University of Illinois Open Source 69f2f44ceSEd Maste // License. See LICENSE.TXT for details. 79f2f44ceSEd Maste // 89f2f44ceSEd Maste //===----------------------------------------------------------------------===// 99f2f44ceSEd Maste 109f2f44ceSEd Maste #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H 119f2f44ceSEd Maste #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H 129f2f44ceSEd Maste 139f2f44ceSEd Maste #ifndef LLDB_DISABLE_PYTHON 149f2f44ceSEd Maste 159f2f44ceSEd Maste #include "PythonDataObjects.h" 169f2f44ceSEd Maste 17*435933ddSDimitry Andric namespace lldb_private { 189f2f44ceSEd Maste 19*435933ddSDimitry Andric class PythonExceptionState { 209f2f44ceSEd Maste public: 219f2f44ceSEd Maste explicit PythonExceptionState(bool restore_on_exit); 229f2f44ceSEd Maste ~PythonExceptionState(); 239f2f44ceSEd Maste 24*435933ddSDimitry Andric void Acquire(bool restore_on_exit); 259f2f44ceSEd Maste 26*435933ddSDimitry Andric void Restore(); 279f2f44ceSEd Maste 28*435933ddSDimitry Andric void Discard(); 299f2f44ceSEd Maste 30*435933ddSDimitry Andric void Reset(); 319f2f44ceSEd Maste 32*435933ddSDimitry Andric static bool HasErrorOccurred(); 339f2f44ceSEd Maste 34*435933ddSDimitry Andric bool IsError() const; 359f2f44ceSEd Maste 36*435933ddSDimitry Andric PythonObject GetType() const; 379f2f44ceSEd Maste 38*435933ddSDimitry Andric PythonObject GetValue() const; 399f2f44ceSEd Maste 40*435933ddSDimitry Andric PythonObject GetTraceback() const; 419f2f44ceSEd Maste 42*435933ddSDimitry Andric std::string Format() const; 439f2f44ceSEd Maste 449f2f44ceSEd Maste private: 45*435933ddSDimitry Andric std::string ReadBacktrace() const; 469f2f44ceSEd Maste 479f2f44ceSEd Maste bool m_restore_on_exit; 489f2f44ceSEd Maste 499f2f44ceSEd Maste PythonObject m_type; 509f2f44ceSEd Maste PythonObject m_value; 519f2f44ceSEd Maste PythonObject m_traceback; 529f2f44ceSEd Maste }; 539f2f44ceSEd Maste } 549f2f44ceSEd Maste 559f2f44ceSEd Maste #endif 569f2f44ceSEd Maste 579f2f44ceSEd Maste #endif 58