def test_parse_dump(self): dump = ( 'OS|Windows NT|6.1.7601 Service Pack 1\n' 'CPU|x86|GenuineIntel family 15 model 4 stepping 9|2\n' 'Crash|EXCEPTION_ACCESS_VIOLATION_READ|0x290|0\n' 'Module|bad.exe|1.0.0.1234|debug.pdb|debugver|saddr|eaddr|1\n' '\n' '0|0|bad.dll|signature|cvs:cvs.m.org/repo:fname:rev|576|0x0\n' '0|1|bad.dll|signature|hg:hg.m.org/repo:fname:rev|576|0x0\n' '1|0|ntdll.dll|KiFastSystemCallRet|||0x0\n' '1|1|ntdll.dll|ZwClose|||0xb\n' ) vcs_mappings = { 'cvs': { 'cvs.m.org': ('http://bonsai.m.org/cvsblame.cgi?' 'file=%(file)s&rev=%(revision)s&' 'mark=%(line)s#%(line)s') }, 'hg': { 'hg.m.org': ('http://hg.m.org/' '%(repo)s/annotate/%(revision)s' '/%(file)s#l%(line)s') } } actual = utils.parse_dump(dump, vcs_mappings) expected = {'os_name': 'Windows NT', 'modules': [ {'debug_filename': 'debug.pdb', 'version': '1.0.0.1234', 'debug_identifier': 'debugver', 'filename': 'bad.exe'} ], 'cpu_name': 'x86', 'cpu_version': ('GenuineIntel family ' '15 model 4 stepping 9'), 'os_version': '6.1.7601 Service Pack 1', 'reason': 'EXCEPTION_ACCESS_VIOLATION_READ', 'crashed_thread': 1, 'threads': { 0: [ {'function': 'signature', 'short_signature': 'signature', 'source_line': '576', 'source_link': ('http://bonsai.m.org' '/cvsblame.cgi' '?file=fname&rev=rev&' 'mark=576#576'), 'source_filename': 'fname', 'source_info': 'fname:576', 'instruction': '0x0', 'source': 'cvs:cvs.m.org/repo:fname:rev', 'frame_num': '0', 'signature': 'signature', 'module_name': 'bad.dll'}, {'function': 'signature', 'short_signature': 'signature', 'source_line': '576', 'source_link': ('http://hg.m.org' '/repo/annotate/rev/fname#l576'), 'source_filename': 'fname', 'source_info': 'fname:576', 'instruction': '0x0', 'source': 'hg:hg.m.org/repo:fname:rev', 'frame_num': '1', 'signature': 'signature', 'module_name': 'bad.dll'} ] }, 'address': '0x290'} # the default line length for assert would be too short to be useful self.maxDiff = None eq_(actual, expected)
def test_parse_dump_invalid_frames(self): """What's special about this one is that the dump is bad in that it starts wiht a 2 but there's no 0 or 1. So what the parse_dump() function does is that it pads everything to the left with blocks of empty frames. See https://bugzilla.mozilla.org/show_bug.cgi?id=1071043 """ dump = ('OS|Windows NT|6.1.7601 Service Pack 1\n' 'CPU|x86|GenuineIntel family 15 model 4 stepping 9|2\n' 'Crash|EXCEPTION_ACCESS_VIOLATION_READ|0x290|0\n' 'Module|bad.exe|1.0.0.1234|debug.pdb|debugver|saddr|eaddr|1\n' '\n' '2|0|bad.dll|signature|cvs:cvs.m.org/repo:fname:rev|576|0x0\n') vcs_mappings = { 'cvs': { 'cvs.m.org': ('http://bonsai.m.org/cvsblame.cgi?' 'file=%(file)s&rev=%(revision)s&' 'mark=%(line)s#%(line)s') }, 'hg': { 'hg.m.org': ('http://hg.m.org/' '%(repo)s/annotate/%(revision)s' '/%(file)s#l%(line)s') } } actual = utils.parse_dump(dump, vcs_mappings) expected = { 'crash_info': { 'crash_address': '0x290', 'crashing_thread': 0, 'type': 'EXCEPTION_ACCESS_VIOLATION_READ' }, 'main_module': 0, 'modules': [{ 'base_addr': 'saddr', 'debug_file': 'debug.pdb', 'debug_id': 'debugver', 'end_addr': 'eaddr', 'filename': 'bad.exe', 'version': '1.0.0.1234' }], 'status': 'OK', 'system_info': { 'cpu_arch': 'x86', 'cpu_count': 2, 'cpu_info': 'GenuineIntel family 15 model 4 stepping 9', 'os': 'Windows NT', 'os_ver': '6.1.7601 Service Pack 1' }, 'thread_count': 3, 'threads': [ { 'frame_count': 0, 'frames': [], 'thread': 0 }, { 'frame_count': 0, 'frames': [], 'thread': 1 }, { 'frame_count': 1, 'frames': [{ 'file': 'fname', 'frame': 0, 'function': 'signature', 'line': 576, 'module': 'bad.dll', 'short_signature': 'signature', 'signature': 'signature', 'source_link': ('http://bonsai.m.org/cvsblame.cgi?file=fname&' 'rev=rev&mark=576#576') }], 'thread': 2 }, ] } # the default line length for assert would be too short to be useful self.maxDiff = None eq_(actual, expected)
def test_parse_dump(self): dump = ( 'OS|Windows NT|6.1.7601 Service Pack 1\n' 'CPU|x86|GenuineIntel family 15 model 4 stepping 9|2\n' 'Crash|EXCEPTION_ACCESS_VIOLATION_READ|0x290|0\n' 'Module|bad.exe|1.0.0.1234|debug.pdb|debugver|saddr|eaddr|1\n' '\n' '0|0|bad.dll|signature|cvs:cvs.m.org/repo:fname:rev|576|0x0\n' '0|1|bad.dll|signature|hg:hg.m.org/repo/name:fname:rev|576|0x0\n' '1|0|ntdll.dll|KiFastSystemCallRet|||0x0\n' '1|1|ntdll.dll|ZwClose|||0xb\n' '1|2|ntdll.dll||||0xabc\n' '1|3|||||0x1234\n' ) vcs_mappings = { 'cvs': { 'cvs.m.org': ('http://bonsai.m.org/cvsblame.cgi?' 'file=%(file)s&rev=%(revision)s&' 'mark=%(line)s#%(line)s') }, 'hg': { 'hg.m.org': ('http://hg.m.org/' '%(repo)s/annotate/%(revision)s' '/%(file)s#l%(line)s') } } actual = utils.parse_dump(dump, vcs_mappings) expected = { 'status': 'OK', 'system_info': { 'os': 'Windows NT', 'os_ver': '6.1.7601 Service Pack 1', 'cpu_arch': 'x86', 'cpu_info': 'GenuineIntel family 15 model 4 stepping 9', 'cpu_count': 2}, 'crash_info': { 'crashing_thread': 0, 'crash_address': '0x290', 'type': 'EXCEPTION_ACCESS_VIOLATION_READ'}, 'main_module': 0, 'modules': [ {'debug_file': 'debug.pdb', 'version': '1.0.0.1234', 'debug_id': 'debugver', 'filename': 'bad.exe', 'base_addr': 'saddr', 'end_addr': 'eaddr'}], 'thread_count': 2, 'threads': [ {'thread': 0, 'frame_count': 2, 'frames': [ {'function': 'signature', 'short_signature': 'signature', 'line': 576, 'source_link': ('http://bonsai.m.org/' 'cvsblame.cgi?file=fname&' 'rev=rev&mark=576#576'), 'file': 'fname', 'frame': 0, 'signature': 'signature', 'module': 'bad.dll'}, {'function': 'signature', 'short_signature': 'signature', 'line': 576, 'source_link': ('http://hg.m.org/repo/name/' 'annotate/rev/fname#l576'), 'file': 'fname', 'frame': 1, 'signature': 'signature', 'module': 'bad.dll'} ]}, {'thread': 1, 'frame_count': 4, 'frames': [ {'function': 'KiFastSystemCallRet', 'short_signature': 'KiFastSystemCallRet', 'function_offset': '0x0', 'frame': 0, 'signature': 'KiFastSystemCallRet', 'module': 'ntdll.dll'}, {'function': 'ZwClose', 'short_signature': 'ZwClose', 'function_offset': '0xb', 'frame': 1, 'signature': 'ZwClose', 'module': 'ntdll.dll'}, {'signature': 'ntdll.dll@0xabc', 'short_signature': 'ntdll.dll@0xabc', 'module_offset': '0xabc', 'frame': 2, 'module': 'ntdll.dll'}, {'offset': '0x1234', 'frame': 3, 'signature': '@0x1234', 'short_signature': '@0x1234'}]}] } # the default line length for assert would be too short to be useful self.maxDiff = None eq_(actual, expected)
def test_parse_dump(self): dump = ( 'OS|Windows NT|6.1.7601 Service Pack 1\n' 'CPU|x86|GenuineIntel family 15 model 4 stepping 9|2\n' 'Crash|EXCEPTION_ACCESS_VIOLATION_READ|0x290|0\n' 'Module|bad.exe|1.0.0.1234|debug.pdb|debugver|saddr|eaddr|1\n' '\n' '0|0|bad.dll|signature|cvs:cvs.m.org/repo:fname:rev|576|0x0\n' '0|1|bad.dll|signature|hg:hg.m.org/repo/name:fname:rev|576|0x0\n' '1|0|ntdll.dll|KiFastSystemCallRet|||0x0\n' '1|1|ntdll.dll|ZwClose|||0xb\n' '1|2|ntdll.dll||||0xabc\n' '1|3|||||0x1234\n') vcs_mappings = { 'cvs': { 'cvs.m.org': ('http://bonsai.m.org/cvsblame.cgi?' 'file=%(file)s&rev=%(revision)s&' 'mark=%(line)s#%(line)s') }, 'hg': { 'hg.m.org': ('http://hg.m.org/' '%(repo)s/annotate/%(revision)s' '/%(file)s#l%(line)s') } } actual = utils.parse_dump(dump, vcs_mappings) expected = { 'status': 'OK', 'system_info': { 'os': 'Windows NT', 'os_ver': '6.1.7601 Service Pack 1', 'cpu_arch': 'x86', 'cpu_info': 'GenuineIntel family 15 model 4 stepping 9', 'cpu_count': 2 }, 'crash_info': { 'crashing_thread': 0, 'crash_address': '0x290', 'type': 'EXCEPTION_ACCESS_VIOLATION_READ' }, 'main_module': 0, 'modules': [{ 'debug_file': 'debug.pdb', 'version': '1.0.0.1234', 'debug_id': 'debugver', 'filename': 'bad.exe', 'base_addr': 'saddr', 'end_addr': 'eaddr' }], 'thread_count': 2, 'threads': [{ 'thread': 0, 'frame_count': 2, 'frames': [{ 'function': 'signature', 'short_signature': 'signature', 'line': 576, 'source_link': ('http://bonsai.m.org/' 'cvsblame.cgi?file=fname&' 'rev=rev&mark=576#576'), 'file': 'fname', 'frame': 0, 'signature': 'signature', 'module': 'bad.dll' }, { 'function': 'signature', 'short_signature': 'signature', 'line': 576, 'source_link': ('http://hg.m.org/repo/name/' 'annotate/rev/fname#l576'), 'file': 'fname', 'frame': 1, 'signature': 'signature', 'module': 'bad.dll' }] }, { 'thread': 1, 'frame_count': 4, 'frames': [{ 'function': 'KiFastSystemCallRet', 'short_signature': 'KiFastSystemCallRet', 'function_offset': '0x0', 'frame': 0, 'signature': 'KiFastSystemCallRet', 'module': 'ntdll.dll' }, { 'function': 'ZwClose', 'short_signature': 'ZwClose', 'function_offset': '0xb', 'frame': 1, 'signature': 'ZwClose', 'module': 'ntdll.dll' }, { 'signature': 'ntdll.dll@0xabc', 'short_signature': 'ntdll.dll@0xabc', 'module_offset': '0xabc', 'frame': 2, 'module': 'ntdll.dll' }, { 'offset': '0x1234', 'frame': 3, 'signature': '@0x1234', 'short_signature': '@0x1234' }] }] } # the default line length for assert would be too short to be useful self.maxDiff = None eq_(actual, expected)
def test_parse_dump_invalid_frames(self): """What's special about this one is that the dump is bad in that it starts wiht a 2 but there's no 0 or 1. So what the parse_dump() function does is that it pads everything to the left with blocks of empty frames. See https://bugzilla.mozilla.org/show_bug.cgi?id=1071043 """ dump = ( 'OS|Windows NT|6.1.7601 Service Pack 1\n' 'CPU|x86|GenuineIntel family 15 model 4 stepping 9|2\n' 'Crash|EXCEPTION_ACCESS_VIOLATION_READ|0x290|0\n' 'Module|bad.exe|1.0.0.1234|debug.pdb|debugver|saddr|eaddr|1\n' '\n' '2|0|bad.dll|signature|cvs:cvs.m.org/repo:fname:rev|576|0x0\n' ) vcs_mappings = { 'cvs': { 'cvs.m.org': ('http://bonsai.m.org/cvsblame.cgi?' 'file=%(file)s&rev=%(revision)s&' 'mark=%(line)s#%(line)s') }, 'hg': { 'hg.m.org': ('http://hg.m.org/' '%(repo)s/annotate/%(revision)s' '/%(file)s#l%(line)s') } } actual = utils.parse_dump(dump, vcs_mappings) expected = { 'crash_info': { 'crash_address': '0x290', 'crashing_thread': 0, 'type': 'EXCEPTION_ACCESS_VIOLATION_READ' }, 'main_module': 0, 'modules': [{ 'base_addr': 'saddr', 'debug_file': 'debug.pdb', 'debug_id': 'debugver', 'end_addr': 'eaddr', 'filename': 'bad.exe', 'version': '1.0.0.1234' }], 'status': 'OK', 'system_info': { 'cpu_arch': 'x86', 'cpu_count': 2, 'cpu_info': 'GenuineIntel family 15 model 4 stepping 9', 'os': 'Windows NT', 'os_ver': '6.1.7601 Service Pack 1' }, 'thread_count': 3, 'threads': [ { 'frame_count': 0, 'frames': [], 'thread': 0 }, { 'frame_count': 0, 'frames': [], 'thread': 1 }, { 'frame_count': 1, 'frames': [{ 'file': 'fname', 'frame': 0, 'function': 'signature', 'line': 576, 'module': 'bad.dll', 'short_signature': 'signature', 'signature': 'signature', 'source_link': ( 'http://bonsai.m.org/cvsblame.cgi?file=fname&' 'rev=rev&mark=576#576' ) }], 'thread': 2 }, ] } # the default line length for assert would be too short to be useful self.maxDiff = None eq_(actual, expected)