Commit 41f5f31a authored by Siddhartha's avatar Siddhartha Committed by Commit Bot

Tracing: Add a metadata event to track chrome library start address

On Android for trace symbolization the start address of the library
cannot be obtained by offsets from memory maps since it is mapped from
apk. So, add explicit metadata for each process to mark the start
address of the executable. The only library mapped from apk is
chrome.so.

Change-Id: Ib6f3ec81fd1c34c92974fce7a73debd4f9e8dad5
Reviewed-on: https://chromium-review.googlesource.com/1068239
Commit-Queue: Siddhartha S <ssid@chromium.org>
Reviewed-by: default avataroysteine <oysteine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560777}
parent 6723db3c
......@@ -49,6 +49,12 @@
#include "base/trace_event/trace_event_etw_export_win.h"
#endif
#if defined(OS_ANDROID)
// The linker assigns the virtual address of the start of current library to
// this symbol.
extern char __executable_start;
#endif
namespace base {
namespace trace_event {
......@@ -1549,6 +1555,13 @@ void TraceLog::AddMetadataEventsWhileLocked() {
AddEventToThreadSharedChunkWhileLocked(nullptr, false), current_thread_id,
"process_uptime_seconds", "uptime", process_uptime.InSeconds());
#if defined(OS_ANDROID)
InitializeMetadataEvent(
AddEventToThreadSharedChunkWhileLocked(nullptr, false), current_thread_id,
"chrome_library_address", "start_address",
base::StringPrintf("%p", &__executable_start));
#endif
if (!process_labels_.empty()) {
std::vector<base::StringPiece> labels;
for (const auto& it : process_labels_)
......
......@@ -25,6 +25,7 @@ const WhitelistEntry kEventArgsWhitelist[] = {
{"__metadata", "thread_name", nullptr},
{"__metadata", "process_name", nullptr},
{"__metadata", "process_uptime_seconds", nullptr},
{"__metadata", "chrome_library_address", nullptr},
{"__metadata", "stackFrames", nullptr},
{"__metadata", "typeNames", nullptr},
{"ipc", "SyncChannel::Send", nullptr},
......
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