Revision: 12447 Author: [email protected] Date: Wed Sep 5 09:23:01 2012 Log: Extend grokdump.py with [u]nassemble command
[email protected] BUG= Review URL: https://chromiumcodereview.appspot.com/10910091 http://code.google.com/p/v8/source/detail?r=12447 Modified: /branches/bleeding_edge/tools/grokdump.py ======================================= --- /branches/bleeding_edge/tools/grokdump.py Thu Aug 23 09:11:37 2012 +++ /branches/bleeding_edge/tools/grokdump.py Wed Sep 5 09:23:01 2012 @@ -1478,6 +1478,24 @@ self.padawan = InspectionPadawan(reader, heap) self.prompt = "(grok) " + def do_da(self, address): + """ + Print ASCII string starting at specified address. + """ + address = int(address, 16) + string = "" + while self.reader.IsValidAddress(address): + code = self.reader.ReadU8(address) + if code < 128: + string += chr(code) + else: + break + address += 1 + if string == "": + print "Not an ASCII string at %s" % self.reader.FormatIntPtr(address) + else: + print "%s\n" % string + def do_dd(self, address): """ Interpret memory at the given address (if available) as a sequence @@ -1528,24 +1546,6 @@ else: print "Page header is not available!" - def do_da(self, address): - """ - Print ASCII string starting at specified address. - """ - address = int(address, 16) - string = "" - while self.reader.IsValidAddress(address): - code = self.reader.ReadU8(address) - if code < 128: - string += chr(code) - else: - break - address += 1 - if string == "": - print "Not an ASCII string at %s" % self.reader.FormatIntPtr(address) - else: - print "%s\n" % string - def do_k(self, arguments): """ Teach V8 heap layout information to the inspector. This increases @@ -1555,23 +1555,23 @@ """ self.padawan.PrintKnowledge() - def do_km(self, address): + def do_kd(self, address): """ Teach V8 heap layout information to the inspector. Set the first - map-space page by passing any pointer into that page. + data-space page by passing any pointer into that page. """ address = int(address, 16) page_address = address & ~self.heap.PageAlignmentMask() - self.padawan.known_first_map_page = page_address + self.padawan.known_first_data_page = page_address - def do_kd(self, address): + def do_km(self, address): """ Teach V8 heap layout information to the inspector. Set the first - data-space page by passing any pointer into that page. + map-space page by passing any pointer into that page. """ address = int(address, 16) page_address = address & ~self.heap.PageAlignmentMask() - self.padawan.known_first_data_page = page_address + self.padawan.known_first_map_page = page_address def do_kp(self, address): """ @@ -1582,6 +1582,17 @@ page_address = address & ~self.heap.PageAlignmentMask() self.padawan.known_first_pointer_page = page_address + def do_list(self, smth): + """ + List all available memory regions. + """ + def print_region(reader, start, size, location): + print " %s - %s (%d bytes)" % (reader.FormatIntPtr(start), + reader.FormatIntPtr(start + size), + size) + print "Available memory regions:" + self.reader.ForEachMemoryRegion(print_region) + def do_s(self, word): """ Search for a given word in available memory regions. The given word @@ -1605,17 +1616,18 @@ """ raise NotImplementedError - def do_list(self, smth): + def do_u(self, args): """ - List all available memory regions. + u 0x<address> 0x<size> + Unassemble memory in the region [address, address + size) """ - def print_region(reader, start, size, location): - print " %s - %s (%d bytes)" % (reader.FormatIntPtr(start), - reader.FormatIntPtr(start + size), - size) - print "Available memory regions:" - self.reader.ForEachMemoryRegion(print_region) - + args = args.split(' ') + start = int(args[0], 16) + size = int(args[1], 16) + lines = self.reader.GetDisasmLines(start, size) + for line in lines: + print FormatDisasmLine(start, self.heap, line) + print EIP_PROXIMITY = 64 -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
