git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@1023 626c5289-ae23-0410-ae9c-e8d60b6d4f22
49 lines
1 KiB
Python
49 lines
1 KiB
Python
# -----------------------------------------------------------------------------
|
|
# Wad port-mortem debugger
|
|
#
|
|
# David Beazley
|
|
# -----------------------------------------------------------------------------
|
|
|
|
import sys
|
|
|
|
_last_exc = None
|
|
_last_level = 0
|
|
|
|
print "WAD port-mortem"
|
|
|
|
class where_impl:
|
|
def __repr__(self):
|
|
global _last_exc, _last_level
|
|
if sys.last_value:
|
|
if sys.last_value[0] != _last_exc:
|
|
_last_exc = sys.last_value[0]
|
|
_last_level = 0
|
|
else:
|
|
raise RuntimeError,"No pending error."
|
|
print repr(_last_exc)
|
|
return ""
|
|
|
|
where = where_impl()
|
|
|
|
class up_impl:
|
|
def __repr__(self):
|
|
global _last_exc, _last_level
|
|
if not _last_exc:
|
|
return ""
|
|
_last_level += 1
|
|
print repr(_last_exc[_last_level])
|
|
return ""
|
|
|
|
up = up_impl()
|
|
|
|
class down_impl:
|
|
def __repr__(self):
|
|
global _last_exc, _last_level
|
|
if not _last_exc:
|
|
return ""
|
|
_last_level -= 1
|
|
print repr(_last_exc[_last_level])
|
|
return ""
|
|
|
|
down = down_impl()
|
|
|