8
from pykd import isWindbgExt
9
from pykd import dprintln
11
from pykd import typedVar
12
from pykd import typeInfo
13
from pykd import addr64
14
from pykd import sizeof
17
def addTableChilds( table, links ):
19
table.append( links.getAddress() + sizeof( "nt!_RTL_BALANCED_LINKS" ) )
21
if links.LeftChild != 0:
22
addTableChilds( table, typedVar("nt!_RTL_BALANCED_LINKS", links.LeftChild) )
23
if links.RightChild != 0:
24
addTableChilds( table, typedVar("nt!_RTL_BALANCED_LINKS", links.RightChild) )
27
def getAVLTable( addr ):
30
avl = typedVar( "nt!_RTL_AVL_TABLE", addr )
31
addTableChilds( table, avl.BalancedRoot )
36
dprintln( "!py avl [addr] (type)")
39
if __name__ == "__main__":
41
if len( sys.argv ) < 2:
51
items = getAVLTable( addr64( expr( sys.argv[1] ) ) )
54
if len( sys.argv ) == 2:
55
dprintln( "\n".join( [ "<link cmd=\"db 0x%x\">db 0x%x</link>" % ( entry, entry ) for entry in items ] ), True )
57
ti = typeInfo(sys.argv[2])
58
dprintln( "\n".join( [ "<link cmd=\"dt %s 0x%x\">dt %s</link>\n%s" % ( sys.argv[2], entry, sys.argv[2], typedVar(ti, entry) ) for entry in items ] ), True )
61
if len( sys.argv ) == 2:
62
dprintln( "\n".join( [ "<link cmd=\"db 0x%x\">db 0x%x</link>" % ( entry, entry ) for entry in items ] ), True )
64
dprintln( "\n".join( [ "<link cmd=\"dt %s 0x%x\">dt %s</link>" % ( sys.argv[2], entry, sys.argv[2] ) for entry in items ] ), True )