summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-01 21:43:38 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-12-01 21:43:38 +0000
commit438c10d8a816fd2c4f138bc0ec23e1e0376416d8 (patch)
tree7a9856d2ed1ae5a2ec1fa9dd0379ce92ea48c7a9
parentd761406ad0265123a969cfb8ffb1228c7ef5e5a8 (diff)
parentfa1bcfa2f45ed0cf5f13da7195eba63da06da979 (diff)
downloadextras-android-cts-12.1_r6.tar.gz
Merge "Snap for 9355154 from b2dee26f989a5ab41fc7790634d8a6851635b897 to android12L-tests-release" into android12L-tests-releaseandroid-vts-12.1_r6android-vts-12.1_r5android-cts-12.1_r6android-cts-12.1_r5
-rw-r--r--simpleperf/cmd_record_test.cpp4
-rw-r--r--simpleperf/cmd_report_sample.cpp2
-rw-r--r--simpleperf/report_utils.cpp16
-rw-r--r--simpleperf/report_utils_test.cpp3
4 files changed, 11 insertions, 14 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 350a24f8..c4d347fa 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -880,7 +880,9 @@ TEST(record_cmd, check_trampoline_after_art_jni_methods) {
std::string sym_name = get_symbol_name(thread, ips[i]);
if (android::base::StartsWith(sym_name, "art::Method_invoke") && i + 1 < ips.size()) {
has_check = true;
- if (get_symbol_name(thread, ips[i + 1]) != "art_jni_trampoline") {
+ std::string name = get_symbol_name(thread, ips[i + 1]);
+ if (!android::base::EndsWith(name, "jni_trampoline")) {
+ GTEST_LOG_(ERROR) << "unexpected symbol after art::Method_invoke: " << name;
return false;
}
}
diff --git a/simpleperf/cmd_report_sample.cpp b/simpleperf/cmd_report_sample.cpp
index b547d3c9..bc70040f 100644
--- a/simpleperf/cmd_report_sample.cpp
+++ b/simpleperf/cmd_report_sample.cpp
@@ -776,7 +776,7 @@ bool ReportSampleCommand::PrintSampleRecord(const SampleRecord& r,
FprintIndented(report_fp_, 2, "file: %s\n", entries[i].dso->GetReportPath().data());
FprintIndented(report_fp_, 2, "symbol: %s\n", entries[i].symbol->DemangledName());
if (show_execution_type_) {
- FprintIndented(report_fp_, 1, "execution_type: %s\n",
+ FprintIndented(report_fp_, 2, "execution_type: %s\n",
ProtoExecutionTypeToString(ToProtoExecutionType(entries[i].execution_type)));
}
}
diff --git a/simpleperf/report_utils.cpp b/simpleperf/report_utils.cpp
index a9468006..d037cedb 100644
--- a/simpleperf/report_utils.cpp
+++ b/simpleperf/report_utils.cpp
@@ -25,17 +25,11 @@ namespace simpleperf {
static bool IsArtEntry(const CallChainReportEntry& entry, bool* is_jni_trampoline) {
if (entry.execution_type == CallChainExecutionType::NATIVE_METHOD) {
- if (android::base::EndsWith(entry.dso->Path(), "/libart.so") ||
- android::base::EndsWith(entry.dso->Path(), "/libartd.so")) {
- *is_jni_trampoline = false;
- return true;
- }
- if (strcmp(entry.symbol->Name(), "art_jni_trampoline") == 0) {
- // art_jni_trampoline is a trampoline used to call jni methods in art runtime.
- // We want to hide it when hiding art frames.
- *is_jni_trampoline = true;
- return true;
- }
+ // art_jni_trampoline/art_quick_generic_jni_trampoline are trampolines used to call jni
+ // methods in art runtime. We want to hide them when hiding art frames.
+ *is_jni_trampoline = android::base::EndsWith(entry.symbol->Name(), "jni_trampoline");
+ return *is_jni_trampoline || android::base::EndsWith(entry.dso->Path(), "/libart.so") ||
+ android::base::EndsWith(entry.dso->Path(), "/libartd.so");
}
return false;
};
diff --git a/simpleperf/report_utils_test.cpp b/simpleperf/report_utils_test.cpp
index cc246357..5a15d719 100644
--- a/simpleperf/report_utils_test.cpp
+++ b/simpleperf/report_utils_test.cpp
@@ -53,6 +53,7 @@ class CallChainReportBuilderTest : public testing::Test {
Symbol("art_func1", 0x0, 0x100),
Symbol("art_func2", 0x100, 0x100),
Symbol("_ZN3artL13Method_invokeEP7_JNIEnvP8_jobjectS3_P13_jobjectArray", 0x200, 0x100),
+ Symbol("art_quick_generic_jni_trampoline", 0x300, 0x100),
};
thread_tree.AddDsoInfo(file);
@@ -243,7 +244,7 @@ TEST_F(CallChainReportBuilderTest, keep_art_jni_method) {
0x100, // art_jni_trampoline
0x2000, // java_method1 in dex file
0x1200, // art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)
- 0x100, // art_jni_trampoline
+ 0x1300, // art_quick_generic_jni_trampoline
};
CallChainReportBuilder builder(thread_tree);
std::vector<CallChainReportEntry> entries = builder.Build(thread, fake_ips, 0);