| OLD | NEW |
| 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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 return self.exception_context.eip | 753 return self.exception_context.eip |
| 754 | 754 |
| 755 def ExceptionSP(self): | 755 def ExceptionSP(self): |
| 756 if self.arch == MD_CPU_ARCHITECTURE_AMD64: | 756 if self.arch == MD_CPU_ARCHITECTURE_AMD64: |
| 757 return self.exception_context.rsp | 757 return self.exception_context.rsp |
| 758 elif self.arch == MD_CPU_ARCHITECTURE_ARM: | 758 elif self.arch == MD_CPU_ARCHITECTURE_ARM: |
| 759 return self.exception_context.sp | 759 return self.exception_context.sp |
| 760 elif self.arch == MD_CPU_ARCHITECTURE_X86: | 760 elif self.arch == MD_CPU_ARCHITECTURE_X86: |
| 761 return self.exception_context.esp | 761 return self.exception_context.esp |
| 762 | 762 |
| 763 def ExceptionFP(self): |
| 764 if self.arch == MD_CPU_ARCHITECTURE_AMD64: |
| 765 return self.exception_context.rbp |
| 766 elif self.arch == MD_CPU_ARCHITECTURE_ARM: |
| 767 return None |
| 768 elif self.arch == MD_CPU_ARCHITECTURE_X86: |
| 769 return self.exception_context.ebp |
| 770 |
| 763 def FormatIntPtr(self, value): | 771 def FormatIntPtr(self, value): |
| 764 if self.arch == MD_CPU_ARCHITECTURE_AMD64: | 772 if self.arch == MD_CPU_ARCHITECTURE_AMD64: |
| 765 return "%016x" % value | 773 return "%016x" % value |
| 766 elif self.arch == MD_CPU_ARCHITECTURE_ARM: | 774 elif self.arch == MD_CPU_ARCHITECTURE_ARM: |
| 767 return "%08x" % value | 775 return "%08x" % value |
| 768 elif self.arch == MD_CPU_ARCHITECTURE_X86: | 776 elif self.arch == MD_CPU_ARCHITECTURE_X86: |
| 769 return "%08x" % value | 777 return "%08x" % value |
| 770 | 778 |
| 771 def PointerSize(self): | 779 def PointerSize(self): |
| 772 if self.arch == MD_CPU_ARCHITECTURE_AMD64: | 780 if self.arch == MD_CPU_ARCHITECTURE_AMD64: |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 if options.command: | 1952 if options.command: |
| 1945 InspectionShell(reader, heap).onecmd(options.command) | 1953 InspectionShell(reader, heap).onecmd(options.command) |
| 1946 | 1954 |
| 1947 if options.shell: | 1955 if options.shell: |
| 1948 try: | 1956 try: |
| 1949 InspectionShell(reader, heap).cmdloop("type help to get help") | 1957 InspectionShell(reader, heap).cmdloop("type help to get help") |
| 1950 except KeyboardInterrupt: | 1958 except KeyboardInterrupt: |
| 1951 print "Kthxbye." | 1959 print "Kthxbye." |
| 1952 elif not options.command: | 1960 elif not options.command: |
| 1953 if reader.exception is not None: | 1961 if reader.exception is not None: |
| 1962 frame_pointer = reader.ExceptionFP() |
| 1954 print "Annotated stack (from exception.esp to bottom):" | 1963 print "Annotated stack (from exception.esp to bottom):" |
| 1955 for slot in xrange(stack_top, stack_bottom, reader.PointerSize()): | 1964 for slot in xrange(stack_top, stack_bottom, reader.PointerSize()): |
| 1956 maybe_address = reader.ReadUIntPtr(slot) | 1965 maybe_address = reader.ReadUIntPtr(slot) |
| 1957 heap_object = heap.FindObject(maybe_address) | 1966 heap_object = heap.FindObject(maybe_address) |
| 1958 maybe_symbol = reader.FindSymbol(maybe_address) | 1967 maybe_symbol = reader.FindSymbol(maybe_address) |
| 1968 if slot == frame_pointer: |
| 1969 maybe_symbol = "<---- frame pointer" |
| 1970 frame_pointer = maybe_address |
| 1959 print "%s: %s %s" % (reader.FormatIntPtr(slot), | 1971 print "%s: %s %s" % (reader.FormatIntPtr(slot), |
| 1960 reader.FormatIntPtr(maybe_address), | 1972 reader.FormatIntPtr(maybe_address), |
| 1961 maybe_symbol or "") | 1973 maybe_symbol or "") |
| 1962 if heap_object: | 1974 if heap_object: |
| 1963 heap_object.Print(Printer()) | 1975 heap_object.Print(Printer()) |
| 1964 print | 1976 print |
| 1965 | 1977 |
| 1966 reader.Dispose() | 1978 reader.Dispose() |
| 1967 | 1979 |
| 1968 | 1980 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1982 options, args = parser.parse_args() | 1994 options, args = parser.parse_args() |
| 1983 if os.path.exists(options.objdump): | 1995 if os.path.exists(options.objdump): |
| 1984 disasm.OBJDUMP_BIN = options.objdump | 1996 disasm.OBJDUMP_BIN = options.objdump |
| 1985 OBJDUMP_BIN = options.objdump | 1997 OBJDUMP_BIN = options.objdump |
| 1986 else: | 1998 else: |
| 1987 print "Cannot find %s, falling back to default objdump" % options.objdump | 1999 print "Cannot find %s, falling back to default objdump" % options.objdump |
| 1988 if len(args) != 1: | 2000 if len(args) != 1: |
| 1989 parser.print_help() | 2001 parser.print_help() |
| 1990 sys.exit(1) | 2002 sys.exit(1) |
| 1991 AnalyzeMinidump(options, args[0]) | 2003 AnalyzeMinidump(options, args[0]) |
| OLD | NEW |