Add deobfuscation to trace_to_text profile and tp shell.
Test: manual
Bug: 175381133
Change-Id: Ica07fadb3d52b67859ed87ca5e392434d6033a1e
diff --git a/src/trace_processor/trace_processor_shell.cc b/src/trace_processor/trace_processor_shell.cc
index d96c8ee..fcf53bb 100644
--- a/src/trace_processor/trace_processor_shell.cc
+++ b/src/trace_processor/trace_processor_shell.cc
@@ -36,6 +36,7 @@
#include "perfetto/ext/base/string_splitter.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/ext/base/version.h"
+#include "perfetto/profiling/deobfuscator.h"
#include "perfetto/trace_processor/read_trace.h"
#include "perfetto/trace_processor/trace_processor.h"
#include "src/trace_processor/metrics/chrome/all_chrome_metrics.descriptor.h"
@@ -953,6 +954,21 @@
});
g_tp->NotifyEndOfFile();
}
+
+ auto maybe_map = profiling::GetPerfettoProguardMapPath();
+ if (!maybe_map.empty()) {
+ profiling::ReadProguardMapsToDeobfuscationPackets(
+ maybe_map, [](const std::string& trace_proto) {
+ std::unique_ptr<uint8_t[]> buf(new uint8_t[trace_proto.size()]);
+ memcpy(buf.get(), trace_proto.data(), trace_proto.size());
+ auto status = g_tp->Parse(std::move(buf), trace_proto.size());
+ if (!status.ok()) {
+ PERFETTO_DFATAL_OR_ELOG("Failed to parse: %s",
+ status.message().c_str());
+ return;
+ }
+ });
+ }
return util::OkStatus();
}