Index: src/log.cc |
diff --git a/src/log.cc b/src/log.cc |
index e77799802156726b0630ce26452afc8b47ff53a1..da935d8af72345ffd7393383b13fcc8b17a96903 100644 |
--- a/src/log.cc |
+++ b/src/log.cc |
@@ -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. |