@@ -64,20 +64,22 @@ def _varDump__print(exc):
6464oldExcepthook = None
6565# store these values here so that Task.py can always reliably access them
6666# from its main exception handler
67- wantVariableDump = False
67+ wantStackDumpLog = False
68+ wantStackDumpUpload = False
69+ variableDumpReasons = []
6870dumpOnExceptionInit = False
6971
7072class _AttrNotFound :
7173 pass
7274
7375def _excepthookDumpVars (eType , eValue , tb ):
74- excStrs = traceback .format_exception (eType , eValue , tb )
76+ origTb = tb
77+ excStrs = traceback .format_exception (eType , eValue , origTb )
7578 s = 'printing traceback in case variable repr crashes the process...\n '
7679 for excStr in excStrs :
7780 s += excStr
7881 notify .info (s )
7982 s = 'DUMPING STACK FRAME VARIABLES'
80- origTb = tb
8183 #import pdb;pdb.set_trace()
8284 #foundRun = False
8385 foundRun = True
@@ -158,15 +160,34 @@ def _excepthookDumpVars(eType, eValue, tb):
158160
159161 if foundRun :
160162 s += '\n '
161- notify .info (s )
163+ if wantStackDumpLog :
164+ notify .info (s )
165+ if wantStackDumpUpload :
166+ excStrs = traceback .format_exception (eType , eValue , origTb )
167+ for excStr in excStrs :
168+ s += excStr
169+ timeMgr = None
170+ try :
171+ timeMgr = base .cr .timeManager
172+ except :
173+ try :
174+ timeMgr = simbase .air .timeManager
175+ except :
176+ pass
177+ if timeMgr :
178+ timeMgr .setStackDump (s )
179+
162180 oldExcepthook (eType , eValue , origTb )
163181
164- def install ():
182+ def install (log , upload ):
165183 global oldExcepthook
166- global wantVariableDump
184+ global wantStackDumpLog
185+ global wantStackDumpUpload
167186 global dumpOnExceptionInit
168187
169- wantVariableDump = True
188+ wantStackDumpLog = log
189+ wantStackDumpUpload = upload
190+
170191 dumpOnExceptionInit = config .GetBool ('variable-dump-on-exception-init' , 0 )
171192 if dumpOnExceptionInit :
172193 # this mode doesn't completely work because exception objects
0 commit comments