Commit 15defcc4 authored by ssanfilippo's avatar ssanfilippo Committed by Commit bot

Portable Linux perf map formatting.

Linux perf expects hex literals without a leading 0x, while some
implementations of printf might prepend one when using the %p format
for pointers, leading to wrongly formatted JIT symbols maps.

Instead, use V8PRIxPTR format string and cast pointer to uintpr_t,
since we have control over the exact output format of integers.

LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35571}
parent 28f424bc
......@@ -284,9 +284,15 @@ void PerfBasicLogger::LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*,
return;
}
base::OS::FPrint(perf_output_handle_, "%p %x %.*s\n",
code->instruction_start(), code->instruction_size(), length,
name);
// Linux perf expects hex literals without a leading 0x, while some
// implementations of printf might prepend one when using the %p format
// for pointers, leading to wrongly formatted JIT symbols maps.
//
// Instead, we use V8PRIxPTR format string and cast pointer to uintpr_t,
// so that we have control over the exact output format.
base::OS::FPrint(perf_output_handle_, "%" V8PRIxPTR " %x %.*s\n",
reinterpret_cast<uintptr_t>(code->instruction_start()),
code->instruction_size(), length, name);
}
// Low-level logging support.
......
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