Skip to content

Commit

Permalink
Prevent sign extension for pointer trace values
Browse files Browse the repository at this point in the history
This makes 32-bit pointers serialize like "0xdeadbeef", not
"0xffffffffdeadbeef".

BUG=618221

Review-Url: https://codereview.chromium.org/2043233003
Cr-Commit-Position: refs/heads/master@{#399347}
  • Loading branch information
irori authored and Commit bot committed Jun 11, 2016
1 parent a1e9d87 commit e853dea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/trace_event/trace_event_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void TraceEvent::AppendValueAsJSON(unsigned char type,
// So as not to lose bits from a 64-bit pointer, output as a hex string.
StringAppendF(
out, "\"0x%" PRIx64 "\"",
static_cast<uint64_t>(reinterpret_cast<intptr_t>(value.as_pointer)));
static_cast<uint64_t>(reinterpret_cast<uintptr_t>(value.as_pointer)));
break;
case TRACE_VALUE_TYPE_STRING:
case TRACE_VALUE_TYPE_COPY_STRING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace blink {

String toHexString(const void* p)
{
return String::format("0x%" PRIx64, static_cast<uint64_t>(reinterpret_cast<intptr_t>(p)));
return String::format("0x%" PRIx64, static_cast<uint64_t>(reinterpret_cast<uintptr_t>(p)));
}

void setCallStack(TracedValue* value)
Expand Down

0 comments on commit e853dea

Please sign in to comment.