mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-18 12:43:44 -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
|
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
|
||||||
|
@ -56,8 +56,11 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
|
|
||||||
def __init__(self, fStartDirect = True, windowType = None):
|
def __init__(self, fStartDirect = True, windowType = None):
|
||||||
__builtin__.__dev__ = config.GetBool('want-dev', 0)
|
__builtin__.__dev__ = config.GetBool('want-dev', 0)
|
||||||
if config.GetBool('want-variable-dump', 0):
|
logStackDump = (config.GetBool('log-stack-dump', 0) or
|
||||||
ExceptionVarDump.install()
|
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
|
# Locate the directory containing the main program
|
||||||
self.mainDir = ExecutionEnvironment.getEnvironmentVariable("MAIN_DIR")
|
self.mainDir = ExecutionEnvironment.getEnvironmentVariable("MAIN_DIR")
|
||||||
|
@ -519,7 +519,7 @@ class TaskManager:
|
|||||||
self.stop()
|
self.stop()
|
||||||
print_exc_plus()
|
print_exc_plus()
|
||||||
else:
|
else:
|
||||||
if (ExceptionVarDump.wantVariableDump and
|
if (ExceptionVarDump.wantStackDumpLog and
|
||||||
ExceptionVarDump.dumpOnExceptionInit):
|
ExceptionVarDump.dumpOnExceptionInit):
|
||||||
ExceptionVarDump._varDump__print(e)
|
ExceptionVarDump._varDump__print(e)
|
||||||
raise
|
raise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user