mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
added printReverseStack
This commit is contained in:
parent
1e93d6403c
commit
75568bb885
@ -27,7 +27,8 @@ __all__ = ['enumerate', 'unique', 'indent', 'nonRepeatingRandomList',
|
|||||||
'FrameDelayedCall', 'SubframeCall', 'ArgumentEater', 'ClassTree', 'getBase',
|
'FrameDelayedCall', 'SubframeCall', 'ArgumentEater', 'ClassTree', 'getBase',
|
||||||
'superFlattenShip','HotkeyBreaker','logMethodCalls','GoldenRatio',
|
'superFlattenShip','HotkeyBreaker','logMethodCalls','GoldenRatio',
|
||||||
'GoldenRectangle', 'pivotScalar', 'rad90', 'rad180', 'rad270', 'rad360',
|
'GoldenRectangle', 'pivotScalar', 'rad90', 'rad180', 'rad270', 'rad360',
|
||||||
'nullGen', 'loopGen', 'makeFlywheelGen', 'flywheel', 'choice', ]
|
'nullGen', 'loopGen', 'makeFlywheelGen', 'flywheel', 'choice',
|
||||||
|
'printStack', 'printReverseStack', ]
|
||||||
|
|
||||||
import types
|
import types
|
||||||
import string
|
import string
|
||||||
@ -140,6 +141,15 @@ class StackTrace:
|
|||||||
r = r[:-len(comma)]
|
r = r[:-len(comma)]
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
def reverseCompact(self):
|
||||||
|
r = ''
|
||||||
|
comma = ','
|
||||||
|
for filename, lineNum, funcName, text in self.trace:
|
||||||
|
r = '%s.%s:%s%s%s' % (filename[:filename.rfind('.py')][filename.rfind('\\')+1:], funcName, lineNum, comma, r)
|
||||||
|
if len(r):
|
||||||
|
r = r[:-len(comma)]
|
||||||
|
return r
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
r = "Debug stack trace of %s (back %s frames):\n"%(
|
r = "Debug stack trace of %s (back %s frames):\n"%(
|
||||||
self.label, len(self.trace),)
|
self.label, len(self.trace),)
|
||||||
@ -151,6 +161,9 @@ class StackTrace:
|
|||||||
def printStack():
|
def printStack():
|
||||||
print StackTrace(start=1).compact()
|
print StackTrace(start=1).compact()
|
||||||
return True
|
return True
|
||||||
|
def printReverseStack():
|
||||||
|
print StackTrace(start=1).reverseCompact()
|
||||||
|
return True
|
||||||
def printVerboseStack():
|
def printVerboseStack():
|
||||||
print StackTrace(start=1)
|
print StackTrace(start=1)
|
||||||
return True
|
return True
|
||||||
@ -3285,6 +3298,7 @@ __builtin__.clampScalar = clampScalar
|
|||||||
__builtin__.makeList = makeList
|
__builtin__.makeList = makeList
|
||||||
__builtin__.makeTuple = makeTuple
|
__builtin__.makeTuple = makeTuple
|
||||||
__builtin__.printStack = printStack
|
__builtin__.printStack = printStack
|
||||||
|
__builtin__.printReverseStack = printReverseStack
|
||||||
__builtin__.printVerboseStack = printVerboseStack
|
__builtin__.printVerboseStack = printVerboseStack
|
||||||
__builtin__.DelayedCall = DelayedCall
|
__builtin__.DelayedCall = DelayedCall
|
||||||
__builtin__.DelayedFunctor = DelayedFunctor
|
__builtin__.DelayedFunctor = DelayedFunctor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user