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

Unified Diff: tools/grokdump.py

Issue 148493008: grokdump: Compute correct call destinations and display them in-place (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grokdump.py
diff --git a/tools/grokdump.py b/tools/grokdump.py
index d09c042204cd6d8c6a1626c49737c392d11d6dbc..a5a2ae08a879b11447352a262e02222da4e7933b 100755
--- a/tools/grokdump.py
+++ b/tools/grokdump.py
@@ -881,6 +881,19 @@ def FormatDisasmLine(start, heap, line):
if stack_slot:
marker = "=>"
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)
« 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