mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
upload client stack dump to event logs
This commit is contained in:
parent
93583d77bc
commit
9462d332dc
@ -64,20 +64,22 @@ def _varDump__print(exc):
|
||||
oldExcepthook = None
|
||||
# store these values here so that Task.py can always reliably access them
|
||||
# from its main exception handler
|
||||
wantVariableDump = False
|
||||
wantStackDumpLog = False
|
||||
wantStackDumpUpload = False
|
||||
variableDumpReasons = []
|
||||
dumpOnExceptionInit = False
|
||||
|
||||
class _AttrNotFound:
|
||||
pass
|
||||
|
||||
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'
|
||||
for excStr in excStrs:
|
||||
s += excStr
|
||||
notify.info(s)
|
||||
s = 'DUMPING STACK FRAME VARIABLES'
|
||||
origTb = tb
|
||||
#import pdb;pdb.set_trace()
|
||||
#foundRun = False
|
||||
foundRun = True
|
||||
@ -158,15 +160,34 @@ def _excepthookDumpVars(eType, eValue, tb):
|
||||
|
||||
if foundRun:
|
||||
s += '\n'
|
||||
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)
|
||||
|
||||
def install():
|
||||
def install(log, upload):
|
||||
global oldExcepthook
|
||||
global wantVariableDump
|
||||
global wantStackDumpLog
|
||||
global wantStackDumpUpload
|
||||
global dumpOnExceptionInit
|
||||
|
||||
wantVariableDump = True
|
||||
wantStackDumpLog = log
|
||||
wantStackDumpUpload = upload
|
||||
|
||||
dumpOnExceptionInit = config.GetBool('variable-dump-on-exception-init', 0)
|
||||
if dumpOnExceptionInit:
|
||||
# this mode doesn't completely work because exception objects
|
||||
|
@ -56,8 +56,11 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
def __init__(self, fStartDirect = True, windowType = None):
|
||||
__builtin__.__dev__ = config.GetBool('want-dev', 0)
|
||||
if config.GetBool('want-variable-dump', 0):
|
||||
ExceptionVarDump.install()
|
||||
logStackDump = (config.GetBool('log-stack-dump', 0) or
|
||||
config.GetBool('client-log-stack-dump', 0))
|
||||
uploadStackDump = config.GetBool('upload-stack-dump', (not __dev__))
|
||||
if logStackDump or uploadStackDump:
|
||||
ExceptionVarDump.install(logStackDump, uploadStackDump)
|
||||
|
||||
# Locate the directory containing the main program
|
||||
self.mainDir = ExecutionEnvironment.getEnvironmentVariable("MAIN_DIR")
|
||||
|
@ -519,7 +519,7 @@ class TaskManager:
|
||||
self.stop()
|
||||
print_exc_plus()
|
||||
else:
|
||||
if (ExceptionVarDump.wantVariableDump and
|
||||
if (ExceptionVarDump.wantStackDumpLog and
|
||||
ExceptionVarDump.dumpOnExceptionInit):
|
||||
ExceptionVarDump._varDump__print(e)
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user