diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-12-01 01:59:05 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-12-01 01:59:05 +0000 |
commit | 62e835f40626eeb43b25d51833f2400c27bf5752 (patch) | |
tree | 7a9856d2ed1ae5a2ec1fa9dd0379ce92ea48c7a9 | |
parent | 942b61f7cfcd162d4ffd56ef312417df11976cde (diff) | |
parent | 8aff5ada381ed5d2e9b9cc6d4b6b34e9e252e4ca (diff) | |
download | extras-62e835f40626eeb43b25d51833f2400c27bf5752.tar.gz |
Merge "simpleperf: fix check_trampoline_after_art_jni_methods test." into android12-tests-dev am: 8aff5ada38
Original change: https://android-review.googlesource.com/c/platform/system/extras/+/2322758
Change-Id: I27131a851f65bd95cb5fb548a160540877d42b30
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 4 | ||||
-rw-r--r-- | simpleperf/cmd_report_sample.cpp | 2 | ||||
-rw-r--r-- | simpleperf/report_utils.cpp | 16 | ||||
-rw-r--r-- | simpleperf/report_utils_test.cpp | 3 |
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); |