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

Side by Side Diff: tools/grokdump.py

Issue 1142343009: grokdump.py - some support for on-stack HeapStats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after
3108 InspectionShell(reader, heap).onecmd(options.command) 3108 InspectionShell(reader, heap).onecmd(options.command)
3109 3109
3110 if options.shell: 3110 if options.shell:
3111 try: 3111 try:
3112 InspectionShell(reader, heap).cmdloop("type help to get help") 3112 InspectionShell(reader, heap).cmdloop("type help to get help")
3113 except KeyboardInterrupt: 3113 except KeyboardInterrupt:
3114 print "Kthxbye." 3114 print "Kthxbye."
3115 elif not options.command: 3115 elif not options.command:
3116 if reader.exception is not None: 3116 if reader.exception is not None:
3117 frame_pointer = reader.ExceptionFP() 3117 frame_pointer = reader.ExceptionFP()
3118 in_oom_dump_area = False
3118 print "Annotated stack (from exception.esp to bottom):" 3119 print "Annotated stack (from exception.esp to bottom):"
3119 for slot in xrange(stack_top, stack_bottom, reader.PointerSize()): 3120 for slot in xrange(stack_top, stack_bottom, reader.PointerSize()):
3120 ascii_content = [c if c >= '\x20' and c < '\x7f' else '.' 3121 ascii_content = [c if c >= '\x20' and c < '\x7f' else '.'
3121 for c in reader.ReadBytes(slot, reader.PointerSize())] 3122 for c in reader.ReadBytes(slot, reader.PointerSize())]
3122 maybe_address = reader.ReadUIntPtr(slot) 3123 maybe_address = reader.ReadUIntPtr(slot)
3124 maybe_address_contents = None
3125 if maybe_address >= stack_top and maybe_address <= stack_bottom:
3126 maybe_address_contents = reader.ReadUIntPtr(maybe_address)
3127 if maybe_address_contents == 0xdecade00:
3128 in_oom_dump_area = True
3123 heap_object = heap.FindObject(maybe_address) 3129 heap_object = heap.FindObject(maybe_address)
3124 maybe_symbol = reader.FindSymbol(maybe_address) 3130 maybe_symbol = reader.FindSymbol(maybe_address)
3131 oom_comment = ""
3132 if in_oom_dump_area:
3133 if maybe_address_contents == 0xdecade00:
3134 oom_comment = " <----- HeapStats start marker"
3135 elif maybe_address_contents == 0xdecade01:
3136 oom_comment = " <----- HeapStats end marker"
3137 else:
3138 oom_comment = " %d (%d Mbytes)" % (maybe_address_contents,
3139 maybe_address_contents >> 20)
3125 if slot == frame_pointer: 3140 if slot == frame_pointer:
3126 maybe_symbol = "<---- frame pointer" 3141 maybe_symbol = "<---- frame pointer"
3127 frame_pointer = maybe_address 3142 frame_pointer = maybe_address
3128 print "%s: %s %s %s" % (reader.FormatIntPtr(slot), 3143 print "%s: %s %s %s%s" % (reader.FormatIntPtr(slot),
3129 reader.FormatIntPtr(maybe_address), 3144 reader.FormatIntPtr(maybe_address),
3130 "".join(ascii_content), 3145 "".join(ascii_content),
3131 maybe_symbol or "") 3146 maybe_symbol or "",
3147 oom_comment)
3148 if maybe_address_contents == 0xdecade01:
3149 in_oom_dump_area = False
3132 if heap_object: 3150 if heap_object:
3133 heap_object.Print(Printer()) 3151 heap_object.Print(Printer())
3134 print 3152 print
3135 3153
3136 reader.Dispose() 3154 reader.Dispose()
3137 3155
3138 3156
3139 if __name__ == "__main__": 3157 if __name__ == "__main__":
3140 parser = optparse.OptionParser(USAGE) 3158 parser = optparse.OptionParser(USAGE)
3141 parser.add_option("-s", "--shell", dest="shell", action="store_true", 3159 parser.add_option("-s", "--shell", dest="shell", action="store_true",
(...skipping 22 matching lines...) Expand all
3164 try: 3182 try:
3165 server = InspectionWebServer(PORT_NUMBER, options, args[0]) 3183 server = InspectionWebServer(PORT_NUMBER, options, args[0])
3166 print 'Started httpserver on port ' , PORT_NUMBER 3184 print 'Started httpserver on port ' , PORT_NUMBER
3167 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER) 3185 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER)
3168 server.serve_forever() 3186 server.serve_forever()
3169 except KeyboardInterrupt: 3187 except KeyboardInterrupt:
3170 print '^C received, shutting down the web server' 3188 print '^C received, shutting down the web server'
3171 server.socket.close() 3189 server.socket.close()
3172 else: 3190 else:
3173 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