Commit caef39a3 authored by vegorov@chromium.org's avatar vegorov@chromium.org

Extend grokdump.py with [u]nassemble command

R=mstarzinger@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/10910091

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12447 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5330f5b2
......@@ -1478,6 +1478,24 @@ class InspectionShell(cmd.Cmd):
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 @@ class InspectionShell(cmd.Cmd):
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 @@ class InspectionShell(cmd.Cmd):
"""
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 @@ class InspectionShell(cmd.Cmd):
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 @@ class InspectionShell(cmd.Cmd):
"""
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment