Commit bd6af5c0 authored by ussrhero's avatar ussrhero
Browse files

reworked crash info diff

parent 98bdb0f5
Pipeline #41 failed with stages
......@@ -44,12 +44,22 @@ class DumpModule(object):
class DumpStackInfo(object):
def __init__(self):
self.frames = [ pykd.findSymbol(frame.ip, showDisplacement=False) for frame in pykd.getStack() ]
stack = pykd.getStack()[0 : -1]
self.frames = [ pykd.findSymbol(frame.ip, showDisplacement=False) for frame in stack ]
self.moduleStack = []
for frame in stack:
try:
self.moduleStack.append( str(pykd.module(frame.ip).name()) )
except pykd.DbgException:
pass
self.moduleStack = sorted( set(self.moduleStack), key=str.lower)
self.uniqueId = hash("".join(self.frames))
def getUniqueId(self):
return self.uniqueId
def getModulesInStack(self):
return self.moduleStack
class DumpCrashInfo(object):
......@@ -143,7 +153,29 @@ def getUniqueCrashList(dumpDescList, crashFilter):
uniqueCrashInfo[crashId] = dump.crashInfo
return uniqueCrashInfo
def getUniqueStackModuleList(dumpDescList, crashFilter):
stackModuleList = []
for dump in dumpDescList:
if crashFilter == '' or eval(crashFilter, globals(), dump.crashInfo ):
stackModule = dump.crashInfo.crashStack.getModulesInStack()
if not stackModule in stackModuleList:
stackModuleList.append(stackModule)
return stackModuleList
def getUniqueBugCheck(dumpDescList, crashFilter):
bugCheckList = set()
for dump in dumpDescList:
if crashFilter == '' or eval(crashFilter, globals(), dump.crashInfo ):
bugCheckList.add(dump.crashInfo.bugCheckCode)
return list(bugCheckList)
def printModuleDiff(dumpDescList, moduleFilter, verbose, rate):
......@@ -202,37 +234,70 @@ def printOsDiff(dumpDescList, verbose):
print("")
def printCrashDiff(dumpDescList, crashFilter, verbose, rate):
def printCrashDiff(dumpDescList, crashFilter, moduleFilter, verbose, rate):
print( "============ Crash diff ============" )
crashInfoList = getUniqueCrashList(dumpDescList, crashFilter)
bugCheckList = getUniqueBugCheck(dumpDescList, crashFilter)
for bugCheckCode in bugCheckList:
for crash in crashInfoList.values():
dumps = [ d for d in dumpDescList if d.crashInfo.bugCheckCode == bugCheckCode ]
stackRate = len(dumps) * 100 / len( dumpDescList )
if stackRate < rate:
continue
print ("%d%% dumps with bug check code: %x" % ( stackRate, bugCheckCode))
if verbose:
if len(dumps) < len(dumpDescList):
for dump in dumps:
print ("\t%s" % dump.dumpName)
print("")
crashRate = len( [ d for d in dumpDescList if d.crashInfo.getUniqueId() == crash.getUniqueId() ] ) * 100 / len( dumpDescList )
stackModuleList = getUniqueStackModuleList(dumpDescList, crashFilter)
if crashRate < rate:
continue
for stackModule in stackModuleList:
dumps = [ dump for dump in dumpDescList if dump.crashInfo.getUniqueId() == crash.getUniqueId() ]
dumps = [ d for d in dumpDescList if d.crashInfo.crashStack.getModulesInStack() == stackModule ]
print ("Crash in %d%% dumps" % ( len(dumps)*100/len(dumpDescList) ) )
stackRate = len(dumps) * 100 / len( dumpDescList )
if stackRate < rate:
continue
print ("%d%% dumps have stack with modules: %s" % ( stackRate, ", ".join(stackModule) ) )
if verbose:
if len(dumps) < len(dumpDescList):
print("\tDump files:")
for dump in dumps:
print ("\t\t%s" % dump.dumpName)
print ("\t%s" % dump.dumpName)
print("")
fullModuleList = getUniqueModuleList(dumpDescList, moduleFilter)
moduleNameList = sorted( set( [ m.name for m in fullModuleList ] ), key = lambda m: m.lower() )
for moduleName in moduleNameList:
dumps = [d for d in dumpDescList if moduleName in d.crashInfo.crashStack.getModulesInStack() ]
print ("\tBugCheck Code: %x" % ( crash.bugCheckCode ) )
print ("\tStacktrace:")
stackRate = len(dumps) * 100 / len( dumpDescList )
if stackRate < rate:
continue
print ("%d%% dumps with %s in stack" % ( stackRate, moduleName ) )
for frame in crash.crashStack.frames:
print ("\t\t%s" % frame)
print("")
if verbose:
if len(dumps) < len(dumpDescList):
for dump in dumps:
print ("\t%s" % dump.dumpName)
def printDiff(args):
......@@ -280,7 +345,7 @@ def printDiff(args):
printModuleDiff(dumpDescList, args.moduleFilter, args.verbose, args.rate)
if args.crashFilter !="off":
printCrashDiff(dumpDescList, args.crashFilter, args.verbose, args.rate)
printCrashDiff(dumpDescList, args.crashFilter, args.moduleFilter, args.verbose, args.rate)
def printHeader():
......
......@@ -79,7 +79,13 @@ moduleDB = r'''
{"name" : "tbs", "manufactor" : "Microsoft", "type" : "system" },
{"name" : "vmbkmclr", "manufactor" : "Microsoft", "type" : "hyperv", "desc" : "Hyper-V Virtual Memory Bus Root KMCL" },
{"name" : "HECIx64", "manufactor" : "Intel", "type" : "hardware", "desc" : "Intel Management Engine Interface"},
{"name" : "MsSecFlt", "manufactor" : "Microsoft", "type" : "system", "desc" : "Microsoft Security Events Component Minifilter" }
{"name" : "MsSecFlt", "manufactor" : "Microsoft", "type" : "system", "desc" : "Microsoft Security Events Component Minifilter" },
{"name" : "tpm", "manufactor" : "Microsoft", "type" : "system" },
{"name" : "IntcDAud", "manufactor" : "Intel" },
{"name" : "TeeDriverW8x64", "manufactor" : "Intel", "desc" : "Intel Management Engine Interface (MEI) driver" },
{"name" : "nvhda64v", "manufactor" : "NVIDIA", "type" : "hardware", "desc" : "nVidia HDMI Audio Device (nForce chipset driver)"},
{"name" : "ATMFD", "manufactor" : "Microsoft", "type" : "system" },
{"name" : "amdxata", "manufactor" : "AMD", "type" : "hardware", "desc" : "AMD Storage Controller Driver"},
{"name" : "Rt64win7", "manufactor" : "Realtek", "desc" : "Realtek RTL8168D/8111D Family PCI-E Gigabit Ethernet NIC"}
]
'''
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment