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

Unified Diff: src/log.cc

Issue 1885033005: Portable Linux perf map formatting. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment added. Created 4 years, 8 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: 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.
« 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