Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: tools/grokdump.py

Issue 902853002: Grokdump workaround for different layout of *_LIST structures written to minidumps on Mac. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 MINIDUMP_MEMORY_DESCRIPTOR64 = Descriptor([ 427 MINIDUMP_MEMORY_DESCRIPTOR64 = Descriptor([
428 ("start", ctypes.c_uint64), 428 ("start", ctypes.c_uint64),
429 ("size", ctypes.c_uint64) 429 ("size", ctypes.c_uint64)
430 ]) 430 ])
431 431
432 MINIDUMP_MEMORY_LIST = Descriptor([ 432 MINIDUMP_MEMORY_LIST = Descriptor([
433 ("range_count", ctypes.c_uint32), 433 ("range_count", ctypes.c_uint32),
434 ("ranges", lambda m: MINIDUMP_MEMORY_DESCRIPTOR.ctype * m.range_count) 434 ("ranges", lambda m: MINIDUMP_MEMORY_DESCRIPTOR.ctype * m.range_count)
435 ]) 435 ])
436 436
437 MINIDUMP_MEMORY_LIST_Mac = Descriptor([
438 ("range_count", ctypes.c_uint32),
439 ("junk", ctypes.c_uint32),
440 ("ranges", lambda m: MINIDUMP_MEMORY_DESCRIPTOR.ctype * m.range_count)
441 ])
442
437 MINIDUMP_MEMORY_LIST64 = Descriptor([ 443 MINIDUMP_MEMORY_LIST64 = Descriptor([
438 ("range_count", ctypes.c_uint64), 444 ("range_count", ctypes.c_uint64),
439 ("base_rva", ctypes.c_uint64), 445 ("base_rva", ctypes.c_uint64),
440 ("ranges", lambda m: MINIDUMP_MEMORY_DESCRIPTOR64.ctype * m.range_count) 446 ("ranges", lambda m: MINIDUMP_MEMORY_DESCRIPTOR64.ctype * m.range_count)
441 ]) 447 ])
442 448
443 MINIDUMP_THREAD = Descriptor([ 449 MINIDUMP_THREAD = Descriptor([
444 ("id", ctypes.c_uint32), 450 ("id", ctypes.c_uint32),
445 ("suspend_count", ctypes.c_uint32), 451 ("suspend_count", ctypes.c_uint32),
446 ("priority_class", ctypes.c_uint32), 452 ("priority_class", ctypes.c_uint32),
447 ("priority", ctypes.c_uint32), 453 ("priority", ctypes.c_uint32),
448 ("ted", ctypes.c_uint64), 454 ("ted", ctypes.c_uint64),
449 ("stack", MINIDUMP_MEMORY_DESCRIPTOR.ctype), 455 ("stack", MINIDUMP_MEMORY_DESCRIPTOR.ctype),
450 ("context", MINIDUMP_LOCATION_DESCRIPTOR.ctype) 456 ("context", MINIDUMP_LOCATION_DESCRIPTOR.ctype)
451 ]) 457 ])
452 458
453 MINIDUMP_THREAD_LIST = Descriptor([ 459 MINIDUMP_THREAD_LIST = Descriptor([
454 ("thread_count", ctypes.c_uint32), 460 ("thread_count", ctypes.c_uint32),
455 ("threads", lambda t: MINIDUMP_THREAD.ctype * t.thread_count) 461 ("threads", lambda t: MINIDUMP_THREAD.ctype * t.thread_count)
456 ]) 462 ])
457 463
464 MINIDUMP_THREAD_LIST_Mac = Descriptor([
465 ("thread_count", ctypes.c_uint32),
466 ("junk", ctypes.c_uint32),
467 ("threads", lambda t: MINIDUMP_THREAD.ctype * t.thread_count)
468 ])
469
458 MINIDUMP_VS_FIXEDFILEINFO = Descriptor([ 470 MINIDUMP_VS_FIXEDFILEINFO = Descriptor([
459 ("dwSignature", ctypes.c_uint32), 471 ("dwSignature", ctypes.c_uint32),
460 ("dwStrucVersion", ctypes.c_uint32), 472 ("dwStrucVersion", ctypes.c_uint32),
461 ("dwFileVersionMS", ctypes.c_uint32), 473 ("dwFileVersionMS", ctypes.c_uint32),
462 ("dwFileVersionLS", ctypes.c_uint32), 474 ("dwFileVersionLS", ctypes.c_uint32),
463 ("dwProductVersionMS", ctypes.c_uint32), 475 ("dwProductVersionMS", ctypes.c_uint32),
464 ("dwProductVersionLS", ctypes.c_uint32), 476 ("dwProductVersionLS", ctypes.c_uint32),
465 ("dwFileFlagsMask", ctypes.c_uint32), 477 ("dwFileFlagsMask", ctypes.c_uint32),
466 ("dwFileFlags", ctypes.c_uint32), 478 ("dwFileFlags", ctypes.c_uint32),
467 ("dwFileOS", ctypes.c_uint32), 479 ("dwFileOS", ctypes.c_uint32),
(...skipping 14 matching lines...) Expand all
482 ("misc_record", MINIDUMP_LOCATION_DESCRIPTOR.ctype), 494 ("misc_record", MINIDUMP_LOCATION_DESCRIPTOR.ctype),
483 ("reserved0", ctypes.c_uint32 * 2), 495 ("reserved0", ctypes.c_uint32 * 2),
484 ("reserved1", ctypes.c_uint32 * 2) 496 ("reserved1", ctypes.c_uint32 * 2)
485 ]) 497 ])
486 498
487 MINIDUMP_MODULE_LIST = Descriptor([ 499 MINIDUMP_MODULE_LIST = Descriptor([
488 ("number_of_modules", ctypes.c_uint32), 500 ("number_of_modules", ctypes.c_uint32),
489 ("modules", lambda t: MINIDUMP_RAW_MODULE.ctype * t.number_of_modules) 501 ("modules", lambda t: MINIDUMP_RAW_MODULE.ctype * t.number_of_modules)
490 ]) 502 ])
491 503
504 MINIDUMP_MODULE_LIST_Mac = Descriptor([
505 ("number_of_modules", ctypes.c_uint32),
506 ("junk", ctypes.c_uint32),
507 ("modules", lambda t: MINIDUMP_RAW_MODULE.ctype * t.number_of_modules)
508 ])
509
492 MINIDUMP_RAW_SYSTEM_INFO = Descriptor([ 510 MINIDUMP_RAW_SYSTEM_INFO = Descriptor([
493 ("processor_architecture", ctypes.c_uint16) 511 ("processor_architecture", ctypes.c_uint16)
494 ]) 512 ])
495 513
496 MD_CPU_ARCHITECTURE_X86 = 0 514 MD_CPU_ARCHITECTURE_X86 = 0
497 MD_CPU_ARCHITECTURE_ARM = 5 515 MD_CPU_ARCHITECTURE_ARM = 5
498 MD_CPU_ARCHITECTURE_AMD64 = 9 516 MD_CPU_ARCHITECTURE_AMD64 = 9
499 517
500 class FuncSymbol: 518 class FuncSymbol:
501 def __init__(self, start, size, name): 519 def __init__(self, start, size, name):
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 self.minidump, self.exception.thread_context.rva) 581 self.minidump, self.exception.thread_context.rva)
564 elif self.arch == MD_CPU_ARCHITECTURE_AMD64: 582 elif self.arch == MD_CPU_ARCHITECTURE_AMD64:
565 self.exception_context = MINIDUMP_CONTEXT_AMD64.Read( 583 self.exception_context = MINIDUMP_CONTEXT_AMD64.Read(
566 self.minidump, self.exception.thread_context.rva) 584 self.minidump, self.exception.thread_context.rva)
567 elif self.arch == MD_CPU_ARCHITECTURE_ARM: 585 elif self.arch == MD_CPU_ARCHITECTURE_ARM:
568 self.exception_context = MINIDUMP_CONTEXT_ARM.Read( 586 self.exception_context = MINIDUMP_CONTEXT_ARM.Read(
569 self.minidump, self.exception.thread_context.rva) 587 self.minidump, self.exception.thread_context.rva)
570 DebugPrint(self.exception_context) 588 DebugPrint(self.exception_context)
571 elif d.stream_type == MD_THREAD_LIST_STREAM: 589 elif d.stream_type == MD_THREAD_LIST_STREAM:
572 thread_list = MINIDUMP_THREAD_LIST.Read(self.minidump, d.location.rva) 590 thread_list = MINIDUMP_THREAD_LIST.Read(self.minidump, d.location.rva)
591 if ctypes.sizeof(thread_list) + 4 == d.location.data_size:
592 thread_list = MINIDUMP_THREAD_LIST_Mac.Read(
593 self.minidump, d.location.rva)
573 assert ctypes.sizeof(thread_list) == d.location.data_size 594 assert ctypes.sizeof(thread_list) == d.location.data_size
574 DebugPrint(thread_list) 595 DebugPrint(thread_list)
575 for thread in thread_list.threads: 596 for thread in thread_list.threads:
576 DebugPrint(thread) 597 DebugPrint(thread)
577 self.thread_map[thread.id] = thread 598 self.thread_map[thread.id] = thread
578 elif d.stream_type == MD_MODULE_LIST_STREAM: 599 elif d.stream_type == MD_MODULE_LIST_STREAM:
579 assert self.module_list is None 600 assert self.module_list is None
580 self.module_list = MINIDUMP_MODULE_LIST.Read( 601 self.module_list = MINIDUMP_MODULE_LIST.Read(
581 self.minidump, d.location.rva) 602 self.minidump, d.location.rva)
603 if ctypes.sizeof(self.module_list) + 4 == d.location.data_size:
604 self.module_list = MINIDUMP_MODULE_LIST_Mac.Read(
605 self.minidump, d.location.rva)
582 assert ctypes.sizeof(self.module_list) == d.location.data_size 606 assert ctypes.sizeof(self.module_list) == d.location.data_size
607 DebugPrint(self.module_list)
583 elif d.stream_type == MD_MEMORY_LIST_STREAM: 608 elif d.stream_type == MD_MEMORY_LIST_STREAM:
584 print >>sys.stderr, "Warning: This is not a full minidump!" 609 print >>sys.stderr, "Warning: This is not a full minidump!"
585 assert self.memory_list is None 610 assert self.memory_list is None
586 self.memory_list = MINIDUMP_MEMORY_LIST.Read( 611 self.memory_list = MINIDUMP_MEMORY_LIST.Read(
587 self.minidump, d.location.rva) 612 self.minidump, d.location.rva)
613 if ctypes.sizeof(self.memory_list) + 4 == d.location.data_size:
614 self.memory_list = MINIDUMP_MEMORY_LIST_Mac.Read(
615 self.minidump, d.location.rva)
588 assert ctypes.sizeof(self.memory_list) == d.location.data_size 616 assert ctypes.sizeof(self.memory_list) == d.location.data_size
589 DebugPrint(self.memory_list) 617 DebugPrint(self.memory_list)
590 elif d.stream_type == MD_MEMORY_64_LIST_STREAM: 618 elif d.stream_type == MD_MEMORY_64_LIST_STREAM:
591 assert self.memory_list64 is None 619 assert self.memory_list64 is None
592 self.memory_list64 = MINIDUMP_MEMORY_LIST64.Read( 620 self.memory_list64 = MINIDUMP_MEMORY_LIST64.Read(
593 self.minidump, d.location.rva) 621 self.minidump, d.location.rva)
594 assert ctypes.sizeof(self.memory_list64) == d.location.data_size 622 assert ctypes.sizeof(self.memory_list64) == d.location.data_size
595 DebugPrint(self.memory_list64) 623 DebugPrint(self.memory_list64)
596 624
597 def IsValidAddress(self, address): 625 def IsValidAddress(self, address):
(...skipping 2556 matching lines...) Expand 10 before | Expand all | Expand 10 after
3154 try: 3182 try:
3155 server = InspectionWebServer(PORT_NUMBER, options, args[0]) 3183 server = InspectionWebServer(PORT_NUMBER, options, args[0])
3156 print 'Started httpserver on port ' , PORT_NUMBER 3184 print 'Started httpserver on port ' , PORT_NUMBER
3157 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER) 3185 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER)
3158 server.serve_forever() 3186 server.serve_forever()
3159 except KeyboardInterrupt: 3187 except KeyboardInterrupt:
3160 print '^C received, shutting down the web server' 3188 print '^C received, shutting down the web server'
3161 server.socket.close() 3189 server.socket.close()
3162 else: 3190 else:
3163 AnalyzeMinidump(options, args[0]) 3191 AnalyzeMinidump(options, args[0])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698