Commit dc789377 authored by leszeks's avatar leszeks Committed by Commit bot

[disasm] Make jump target printing perf friendly

Makes disassembly jump target printing look more like the output of
objdump, for compatibility with perf's jump arrows. This includes
swapping the order of address and offset, and making the offset and line
numbers hex.

As a drive-by, print comment lines in objdump-v8 so that they can be
shown/hidden as "source" lines by perf.

Review-Url: https://codereview.chromium.org/2757263002
Cr-Commit-Position: refs/heads/master@{#43940}
parent 64754cf2
......@@ -41,7 +41,7 @@ const char* V8NameConverter::NameOfAddress(byte* pc) const {
code_ == NULL ? NULL : code_->GetIsolate()->builtins()->Lookup(pc);
if (name != NULL) {
SNPrintF(v8_buffer_, "%s (%p)", name, static_cast<void*>(pc));
SNPrintF(v8_buffer_, "%p (%s)", static_cast<void*>(pc), name);
return v8_buffer_.start();
}
......@@ -49,7 +49,7 @@ const char* V8NameConverter::NameOfAddress(byte* pc) const {
int offs = static_cast<int>(pc - code_->instruction_start());
// print as code offset, if it seems reasonable
if (0 <= offs && offs < code_->instruction_size()) {
SNPrintF(v8_buffer_, "%d (%p)", offs, static_cast<void*>(pc));
SNPrintF(v8_buffer_, "%p <+0x%x>", static_cast<void*>(pc), offs);
return v8_buffer_.start();
}
}
......@@ -151,7 +151,7 @@ static int DecodeIt(Isolate* isolate, std::ostream* os,
}
// Instruction address and instruction offset.
out.AddFormatted("%p %4" V8PRIdPTRDIFF " ", static_cast<void*>(prev_pc),
out.AddFormatted("%p %4" V8PRIxPTRDIFF " ", static_cast<void*>(prev_pc),
prev_pc - begin);
// Instruction.
......
......@@ -73,8 +73,11 @@ def main():
sys.stdout.write(format_line(line))
elif printing:
break
elif printing and not is_comment(line):
break
elif printing:
if not is_comment(line):
break
else:
sys.stdout.write(line)
else:
sys.argv[0] = "objdump"
sys.exit(subprocess.call(sys.argv))
......
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