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

Side by Side Diff: tools/grokdump.py

Issue 845713002: Extend grokdump's dd command with a second optional parameter defining number of words to dump. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 if code < 128: 2800 if code < 128:
2801 string += chr(code) 2801 string += chr(code)
2802 else: 2802 else:
2803 break 2803 break
2804 address += 1 2804 address += 1
2805 if string == "": 2805 if string == "":
2806 print "Not an ASCII string at %s" % self.reader.FormatIntPtr(address) 2806 print "Not an ASCII string at %s" % self.reader.FormatIntPtr(address)
2807 else: 2807 else:
2808 print "%s\n" % string 2808 print "%s\n" % string
2809 2809
2810 def do_dd(self, address): 2810 def do_dd(self, args):
2811 """ 2811 """
2812 Interpret memory at the given address (if available) as a sequence 2812 Interpret memory in the given region [address, address + num * word_size)
2813 of words. Automatic alignment is not performed. 2813 (if available) as a sequence of words. Automatic alignment is not performed .
2814 If the num is not specified, a default value of 16 words is used.
2815 Synopsis: dd 0x<address> 0x<num>
2814 """ 2816 """
2815 start = int(address, 16) 2817 args = args.split(' ')
2818 start = int(args[0], 16)
2819 num = int(args[1], 16) if len(args) > 1 else 0x10
2816 if (start & self.heap.ObjectAlignmentMask()) != 0: 2820 if (start & self.heap.ObjectAlignmentMask()) != 0:
2817 print "Warning: Dumping un-aligned memory, is this what you had in mind?" 2821 print "Warning: Dumping un-aligned memory, is this what you had in mind?"
2818 for slot in xrange(start, 2822 for slot in xrange(start,
2819 start + self.reader.PointerSize() * 10, 2823 start + self.reader.PointerSize() * num,
2820 self.reader.PointerSize()): 2824 self.reader.PointerSize()):
2821 if not self.reader.IsValidAddress(slot): 2825 if not self.reader.IsValidAddress(slot):
2822 print "Address is not contained within the minidump!" 2826 print "Address is not contained within the minidump!"
2823 return 2827 return
2824 maybe_address = self.reader.ReadUIntPtr(slot) 2828 maybe_address = self.reader.ReadUIntPtr(slot)
2825 heap_object = self.padawan.SenseObject(maybe_address) 2829 heap_object = self.padawan.SenseObject(maybe_address)
2826 print "%s: %s %s" % (self.reader.FormatIntPtr(slot), 2830 print "%s: %s %s" % (self.reader.FormatIntPtr(slot),
2827 self.reader.FormatIntPtr(maybe_address), 2831 self.reader.FormatIntPtr(maybe_address),
2828 heap_object or '') 2832 heap_object or '')
2829 2833
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3150 try: 3154 try:
3151 server = InspectionWebServer(PORT_NUMBER, options, args[0]) 3155 server = InspectionWebServer(PORT_NUMBER, options, args[0])
3152 print 'Started httpserver on port ' , PORT_NUMBER 3156 print 'Started httpserver on port ' , PORT_NUMBER
3153 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER) 3157 webbrowser.open('http://localhost:%i/summary.html' % PORT_NUMBER)
3154 server.serve_forever() 3158 server.serve_forever()
3155 except KeyboardInterrupt: 3159 except KeyboardInterrupt:
3156 print '^C received, shutting down the web server' 3160 print '^C received, shutting down the web server'
3157 server.socket.close() 3161 server.socket.close()
3158 else: 3162 else:
3159 AnalyzeMinidump(options, args[0]) 3163 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