Skip to content

Commit

Permalink
deps: cherry-pick 4229ca2 from V8 upstream
Browse files Browse the repository at this point in the history
Running the profiler processor (--prof-process) with a profiler
output file generated on Windows (with --prof) results in "UNKNOWN"
code dominating the statistics. This is caused by the processor not
correctly parsing the output of the "%p" format specifier on Windows.

This commit makes the output format be the same on Windows so it can
be correctly parsed by --prof-process.

Original commit message:
  [profiler] Fix logging addresses on Windows.

  Change-Id: Iff0dcec95d04b85d31a452fed31b1500ad17a9f0
  Reviewed-on: https://chromium-review.googlesource.com/591373
  Commit-Queue: Jaroslav Sevcik <[email protected]>
  Reviewed-by: Camillo Bruni <[email protected]>
  Cr-Commit-Position: refs/heads/master@{nodejs#46976}

Fixes: nodejs#8221
  • Loading branch information
jaro-sevcik authored and jaimecbernardo committed Jul 29, 2017
1 parent 46d3ff2 commit 448baa7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deps/v8/src/log-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void Log::MessageBuilder::Append(String* str) {
}

void Log::MessageBuilder::AppendAddress(Address addr) {
Append("%p", static_cast<void*>(addr));
Append("0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(addr));
}

void Log::MessageBuilder::AppendSymbolName(Symbol* symbol) {
Expand Down
17 changes: 9 additions & 8 deletions deps/v8/test/cctest/test-log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,9 @@ TEST(LogCallbacks) {
ObjMethod1_entry = *FUNCTION_ENTRYPOINT_ADDRESS(ObjMethod1_entry);
#endif
i::EmbeddedVector<char, 100> ref_data;
i::SNPrintF(ref_data, "code-creation,Callback,-2,-1,%p,1,\"method1\"",
static_cast<void*>(ObjMethod1_entry));
i::SNPrintF(ref_data,
"code-creation,Callback,-2,-1,0x%" V8PRIxPTR ",1,\"method1\"",
reinterpret_cast<intptr_t>(ObjMethod1_entry));

CHECK(StrNStr(log.start(), ref_data.start(), log.length()));
log.Dispose();
Expand Down Expand Up @@ -429,8 +430,8 @@ TEST(LogAccessorCallbacks) {
#endif
EmbeddedVector<char, 100> prop1_getter_record;
i::SNPrintF(prop1_getter_record,
"code-creation,Callback,-2,-1,%p,1,\"get prop1\"",
static_cast<void*>(Prop1Getter_entry));
"code-creation,Callback,-2,-1,0x%" V8PRIxPTR ",1,\"get prop1\"",
reinterpret_cast<intptr_t>(Prop1Getter_entry));
CHECK(StrNStr(log.start(), prop1_getter_record.start(), log.length()));

Address Prop1Setter_entry = reinterpret_cast<Address>(Prop1Setter);
Expand All @@ -439,8 +440,8 @@ TEST(LogAccessorCallbacks) {
#endif
EmbeddedVector<char, 100> prop1_setter_record;
i::SNPrintF(prop1_setter_record,
"code-creation,Callback,-2,-1,%p,1,\"set prop1\"",
static_cast<void*>(Prop1Setter_entry));
"code-creation,Callback,-2,-1,0x%" V8PRIxPTR ",1,\"set prop1\"",
reinterpret_cast<intptr_t>(Prop1Setter_entry));
CHECK(StrNStr(log.start(), prop1_setter_record.start(), log.length()));

Address Prop2Getter_entry = reinterpret_cast<Address>(Prop2Getter);
Expand All @@ -449,8 +450,8 @@ TEST(LogAccessorCallbacks) {
#endif
EmbeddedVector<char, 100> prop2_getter_record;
i::SNPrintF(prop2_getter_record,
"code-creation,Callback,-2,-1,%p,1,\"get prop2\"",
static_cast<void*>(Prop2Getter_entry));
"code-creation,Callback,-2,-1,0x%" V8PRIxPTR ",1,\"get prop2\"",
reinterpret_cast<intptr_t>(Prop2Getter_entry));
CHECK(StrNStr(log.start(), prop2_getter_record.start(), log.length()));
log.Dispose();
}
Expand Down

0 comments on commit 448baa7

Please sign in to comment.