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

Side by Side Diff: tools/grokdump.py

Issue 132503005: When dumping the stack, try to print contents as ASCII (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 4 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 | Annotate | Revision Log
« 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 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 if options.shell: 3096 if options.shell:
3097 try: 3097 try:
3098 InspectionShell(reader, heap).cmdloop("type help to get help") 3098 InspectionShell(reader, heap).cmdloop("type help to get help")
3099 except KeyboardInterrupt: 3099 except KeyboardInterrupt:
3100 print "Kthxbye." 3100 print "Kthxbye."
3101 elif not options.command: 3101 elif not options.command:
3102 if reader.exception is not None: 3102 if reader.exception is not None:
3103 frame_pointer = reader.ExceptionFP() 3103 frame_pointer = reader.ExceptionFP()
3104 print "Annotated stack (from exception.esp to bottom):" 3104 print "Annotated stack (from exception.esp to bottom):"
3105 for slot in xrange(stack_top, stack_bottom, reader.PointerSize()): 3105 for slot in xrange(stack_top, stack_bottom, reader.PointerSize()):
3106 ascii_content = [c if c >= '\x20' and c < '\x7f' else '.'
3107 for c in reader.ReadBytes(slot, reader.PointerSize())]
3106 maybe_address = reader.ReadUIntPtr(slot) 3108 maybe_address = reader.ReadUIntPtr(slot)
3107 heap_object = heap.FindObject(maybe_address) 3109 heap_object = heap.FindObject(maybe_address)
3108 maybe_symbol = reader.FindSymbol(maybe_address) 3110 maybe_symbol = reader.FindSymbol(maybe_address)
3109 if slot == frame_pointer: 3111 if slot == frame_pointer:
3110 maybe_symbol = "<---- frame pointer" 3112 maybe_symbol = "<---- frame pointer"
3111 frame_pointer = maybe_address 3113 frame_pointer = maybe_address
3112 print "%s: %s %s" % (reader.FormatIntPtr(slot), 3114 print "%s: %s %s %s" % (reader.FormatIntPtr(slot),
3113 reader.FormatIntPtr(maybe_address), 3115 reader.FormatIntPtr(maybe_address),
3114 maybe_symbol or "") 3116 "".join(ascii_content),
3117 maybe_symbol or "")
3115 if heap_object: 3118 if heap_object:
3116 heap_object.Print(Printer()) 3119 heap_object.Print(Printer())
3117 print 3120 print
3118 3121
3119 reader.Dispose() 3122 reader.Dispose()
3120 3123
3121 3124
3122 if __name__ == "__main__": 3125 if __name__ == "__main__":
3123 parser = optparse.OptionParser(USAGE) 3126 parser = optparse.OptionParser(USAGE)
3124 parser.add_option("-s", "--shell", dest="shell", action="store_true", 3127 parser.add_option("-s", "--shell", dest="shell", action="store_true",
(...skipping 22 matching lines...) Expand all
3147 try: 3150 try:
3148 server = InspectionWebServer(PORT_NUMBER, options, args[0]) 3151 server = InspectionWebServer(PORT_NUMBER, options, args[0])
3149 print 'Started httpserver on port ' , PORT_NUMBER 3152 print 'Started httpserver on port ' , PORT_NUMBER
3150 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER) 3153 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER)
3151 server.serve_forever() 3154 server.serve_forever()
3152 except KeyboardInterrupt: 3155 except KeyboardInterrupt:
3153 print '^C received, shutting down the web server' 3156 print '^C received, shutting down the web server'
3154 server.socket.close() 3157 server.socket.close()
3155 else: 3158 else:
3156 AnalyzeMinidump(options, args[0]) 3159 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