grokdump: Compute correct call destinations and display them in-place

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/148493008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18984 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c7b91cd4
...@@ -881,6 +881,19 @@ def FormatDisasmLine(start, heap, line): ...@@ -881,6 +881,19 @@ def FormatDisasmLine(start, heap, line):
if stack_slot: if stack_slot:
marker = "=>" marker = "=>"
code = AnnotateAddresses(heap, line[1]) code = AnnotateAddresses(heap, line[1])
# Compute the actual call target which the disassembler is too stupid
# to figure out (it adds the call offset to the disassembly offset rather
# than the absolute instruction address).
if heap.reader.arch == MD_CPU_ARCHITECTURE_X86:
if code.startswith("e8"):
words = code.split()
if len(words) > 6 and words[5] == "call":
offset = int(words[4] + words[3] + words[2] + words[1], 16)
target = (line_address + offset + 5) & 0xFFFFFFFF
code = code.replace(words[6], "0x%08x" % target)
# TODO(jkummerow): port this hack to ARM and x64.
return "%s%08x %08x: %s" % (marker, line_address, line[0], code) return "%s%08x %08x: %s" % (marker, line_address, line[0], code)
......
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