|
@@ -64,20 +64,22 @@ def _varDump__print(exc):
|
|
|
oldExcepthook = None
|
|
oldExcepthook = None
|
|
|
# store these values here so that Task.py can always reliably access them
|
|
# store these values here so that Task.py can always reliably access them
|
|
|
# from its main exception handler
|
|
# from its main exception handler
|
|
|
-wantVariableDump = False
|
|
|
|
|
|
|
+wantStackDumpLog = False
|
|
|
|
|
+wantStackDumpUpload = False
|
|
|
|
|
+variableDumpReasons = []
|
|
|
dumpOnExceptionInit = False
|
|
dumpOnExceptionInit = False
|
|
|
|
|
|
|
|
class _AttrNotFound:
|
|
class _AttrNotFound:
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
def _excepthookDumpVars(eType, eValue, tb):
|
|
def _excepthookDumpVars(eType, eValue, tb):
|
|
|
- excStrs = traceback.format_exception(eType, eValue, tb)
|
|
|
|
|
|
|
+ origTb = tb
|
|
|
|
|
+ excStrs = traceback.format_exception(eType, eValue, origTb)
|
|
|
s = 'printing traceback in case variable repr crashes the process...\n'
|
|
s = 'printing traceback in case variable repr crashes the process...\n'
|
|
|
for excStr in excStrs:
|
|
for excStr in excStrs:
|
|
|
s += excStr
|
|
s += excStr
|
|
|
notify.info(s)
|
|
notify.info(s)
|
|
|
s = 'DUMPING STACK FRAME VARIABLES'
|
|
s = 'DUMPING STACK FRAME VARIABLES'
|
|
|
- origTb = tb
|
|
|
|
|
#import pdb;pdb.set_trace()
|
|
#import pdb;pdb.set_trace()
|
|
|
#foundRun = False
|
|
#foundRun = False
|
|
|
foundRun = True
|
|
foundRun = True
|
|
@@ -158,15 +160,34 @@ def _excepthookDumpVars(eType, eValue, tb):
|
|
|
|
|
|
|
|
if foundRun:
|
|
if foundRun:
|
|
|
s += '\n'
|
|
s += '\n'
|
|
|
- notify.info(s)
|
|
|
|
|
|
|
+ if wantStackDumpLog:
|
|
|
|
|
+ notify.info(s)
|
|
|
|
|
+ if wantStackDumpUpload:
|
|
|
|
|
+ excStrs = traceback.format_exception(eType, eValue, origTb)
|
|
|
|
|
+ for excStr in excStrs:
|
|
|
|
|
+ s += excStr
|
|
|
|
|
+ timeMgr = None
|
|
|
|
|
+ try:
|
|
|
|
|
+ timeMgr = base.cr.timeManager
|
|
|
|
|
+ except:
|
|
|
|
|
+ try:
|
|
|
|
|
+ timeMgr = simbase.air.timeManager
|
|
|
|
|
+ except:
|
|
|
|
|
+ pass
|
|
|
|
|
+ if timeMgr:
|
|
|
|
|
+ timeMgr.setStackDump(s)
|
|
|
|
|
+
|
|
|
oldExcepthook(eType, eValue, origTb)
|
|
oldExcepthook(eType, eValue, origTb)
|
|
|
|
|
|
|
|
-def install():
|
|
|
|
|
|
|
+def install(log, upload):
|
|
|
global oldExcepthook
|
|
global oldExcepthook
|
|
|
- global wantVariableDump
|
|
|
|
|
|
|
+ global wantStackDumpLog
|
|
|
|
|
+ global wantStackDumpUpload
|
|
|
global dumpOnExceptionInit
|
|
global dumpOnExceptionInit
|
|
|
|
|
|
|
|
- wantVariableDump = True
|
|
|
|
|
|
|
+ wantStackDumpLog = log
|
|
|
|
|
+ wantStackDumpUpload = upload
|
|
|
|
|
+
|
|
|
dumpOnExceptionInit = config.GetBool('variable-dump-on-exception-init', 0)
|
|
dumpOnExceptionInit = config.GetBool('variable-dump-on-exception-init', 0)
|
|
|
if dumpOnExceptionInit:
|
|
if dumpOnExceptionInit:
|
|
|
# this mode doesn't completely work because exception objects
|
|
# this mode doesn't completely work because exception objects
|