Add protos and cols for deobfuscation.
Bug: 143611277
Change-Id: I8837f0754b9bde3ed8fb32d582246b359f46feed
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index 8fda7bc..abfe920 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -3031,6 +3031,23 @@
// Begin of protos/perfetto/trace/profiling/heap_graph.proto
+message ObfuscatedMember {
+ optional string obfuscated_name = 1;
+ optional string deobfuscated_name = 2;
+}
+
+message ObfuscatedClass {
+ optional string obfuscated_name = 1;
+ optional string deobfuscated_name = 2;
+ repeated ObfuscatedMember obfuscated_members = 3;
+}
+
+message DeobfuscationMapping {
+ optional string package_name = 1;
+ optional int64 version_code = 2;
+ repeated ObfuscatedClass obfusucated_classes = 3;
+}
+
message HeapGraphRoot {
enum Type {
ROOT_UNKNOWN = 0;
diff --git a/protos/perfetto/trace/profiling/heap_graph.proto b/protos/perfetto/trace/profiling/heap_graph.proto
index 7e2d5d4..5601b9b 100644
--- a/protos/perfetto/trace/profiling/heap_graph.proto
+++ b/protos/perfetto/trace/profiling/heap_graph.proto
@@ -24,6 +24,23 @@
package perfetto.protos;
+message ObfuscatedMember {
+ optional string obfuscated_name = 1;
+ optional string deobfuscated_name = 2;
+}
+
+message ObfuscatedClass {
+ optional string obfuscated_name = 1;
+ optional string deobfuscated_name = 2;
+ repeated ObfuscatedMember obfuscated_members = 3;
+}
+
+message DeobfuscationMapping {
+ optional string package_name = 1;
+ optional int64 version_code = 2;
+ repeated ObfuscatedClass obfusucated_classes = 3;
+}
+
message HeapGraphRoot {
enum Type {
ROOT_UNKNOWN = 0;
diff --git a/src/trace_processor/importers/proto/heap_graph_tracker.cc b/src/trace_processor/importers/proto/heap_graph_tracker.cc
index d4185a5..43ccee0 100644
--- a/src/trace_processor/importers/proto/heap_graph_tracker.cc
+++ b/src/trace_processor/importers/proto/heap_graph_tracker.cc
@@ -83,6 +83,7 @@
static_cast<int64_t>(obj.self_size), /*retained_size=*/-1,
/*unique_retained_size=*/-1, /*reference_set_id=*/-1,
/*reachable=*/0, /*type_name=*/it->second,
+ /*deobfuscated_type_name=*/base::nullopt,
/*root_type=*/base::nullopt});
int64_t row = context_->storage->heap_graph_object_table().size() - 1;
object_id_to_row_.emplace(obj.object_id, row);
@@ -124,7 +125,8 @@
}
StringPool::Id field_name = field_name_it->second;
context_->storage->mutable_heap_graph_reference_table()->Insert(
- {reference_set_id, owner_row, owned_row, field_name});
+ {reference_set_id, owner_row, owned_row, field_name,
+ /*deobfuscated_field_name=*/base::nullopt});
}
context_->storage->mutable_heap_graph_object_table()
->mutable_reference_set_id()
diff --git a/src/trace_processor/tables/profiler_tables.h b/src/trace_processor/tables/profiler_tables.h
index 2561596..13f3330 100644
--- a/src/trace_processor/tables/profiler_tables.h
+++ b/src/trace_processor/tables/profiler_tables.h
@@ -42,18 +42,19 @@
PERFETTO_TP_TABLE(PERFETTO_TP_SYMBOL_DEF);
-#define PERFETTO_TP_HEAP_GRAPH_OBJECT_DEF(NAME, PARENT, C) \
- NAME(HeapGraphObjectTable, "heap_graph_object") \
- PERFETTO_TP_ROOT_TABLE(PARENT, C) \
- C(int64_t, upid) \
- C(int64_t, graph_sample_ts) \
- C(int64_t, object_id) \
- C(int64_t, self_size) \
- C(int64_t, retained_size) \
- C(int64_t, unique_retained_size) \
- C(int64_t, reference_set_id) \
- C(int32_t, reachable) \
- C(StringPool::Id, type_name) \
+#define PERFETTO_TP_HEAP_GRAPH_OBJECT_DEF(NAME, PARENT, C) \
+ NAME(HeapGraphObjectTable, "heap_graph_object") \
+ PERFETTO_TP_ROOT_TABLE(PARENT, C) \
+ C(int64_t, upid) \
+ C(int64_t, graph_sample_ts) \
+ C(int64_t, object_id) \
+ C(int64_t, self_size) \
+ C(int64_t, retained_size) \
+ C(int64_t, unique_retained_size) \
+ C(int64_t, reference_set_id) \
+ C(int32_t, reachable) \
+ C(StringPool::Id, type_name) \
+ C(base::Optional<StringPool::Id>, deobfuscated_type_name) \
C(base::Optional<StringPool::Id>, root_type)
PERFETTO_TP_TABLE(PERFETTO_TP_HEAP_GRAPH_OBJECT_DEF);
@@ -64,7 +65,8 @@
C(int64_t, reference_set_id) \
C(int64_t, owner_id) \
C(int64_t, owned_id) \
- C(StringPool::Id, field_name)
+ C(StringPool::Id, field_name) \
+ C(base::Optional<StringPool::Id>, deobfuscated_field_name)
PERFETTO_TP_TABLE(PERFETTO_TP_HEAP_GRAPH_REFERENCE_DEF);
diff --git a/test/trace_processor/heap_graph_object.out b/test/trace_processor/heap_graph_object.out
index e281d71..b3cad4a 100644
--- a/test/trace_processor/heap_graph_object.out
+++ b/test/trace_processor/heap_graph_object.out
@@ -1,4 +1,4 @@
-"id","type","upid","graph_sample_ts","object_id","self_size","retained_size","unique_retained_size","reference_set_id","reachable","type_name","root_type"
-0,"heap_graph_object",2,10,1,64,96,96,0,1,"FactoryProducerDelegateImplActor","ROOT_JAVA_FRAME"
-1,"heap_graph_object",2,10,2,32,32,32,1,1,"Foo","[NULL]"
-2,"heap_graph_object",2,10,3,128,-1,-1,1,0,"Foo","[NULL]"
+"id","type","upid","graph_sample_ts","object_id","self_size","retained_size","unique_retained_size","reference_set_id","reachable","type_name","deobfuscated_type_name","root_type"
+0,"heap_graph_object",2,10,1,64,96,96,0,1,"FactoryProducerDelegateImplActor","[NULL]","ROOT_JAVA_FRAME"
+1,"heap_graph_object",2,10,2,32,32,32,1,1,"Foo","[NULL]","[NULL]"
+2,"heap_graph_object",2,10,3,128,-1,-1,1,0,"Foo","[NULL]","[NULL]"
diff --git a/test/trace_processor/heap_graph_reference.out b/test/trace_processor/heap_graph_reference.out
index 3be9676..7cdaad2 100644
--- a/test/trace_processor/heap_graph_reference.out
+++ b/test/trace_processor/heap_graph_reference.out
@@ -1,2 +1,2 @@
-"id","type","reference_set_id","owner_id","owned_id","field_name"
-0,"heap_graph_reference",0,0,1,"FactoryProducerDelegateImplActor.foo"
+"id","type","reference_set_id","owner_id","owned_id","field_name","deobfuscated_field_name"
+0,"heap_graph_reference",0,0,1,"FactoryProducerDelegateImplActor.foo","[NULL]"