Revision: 18984
Author:   [email protected]
Date:     Fri Jan 31 11:49:07 2014 UTC
Log: grokdump: Compute correct call destinations and display them in-place

[email protected]

Review URL: https://codereview.chromium.org/148493008
http://code.google.com/p/v8/source/detail?r=18984

Modified:
 /branches/bleeding_edge/tools/grokdump.py

=======================================
--- /branches/bleeding_edge/tools/grokdump.py   Thu Sep 19 09:37:31 2013 UTC
+++ /branches/bleeding_edge/tools/grokdump.py   Fri Jan 31 11:49:07 2014 UTC
@@ -881,6 +881,19 @@
   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)


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to