summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2023-04-20 18:09:01 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-20 18:09:01 +0000
commitee78a79755d660a9055d68377682b9f17a69e09d (patch)
tree268580a137409cae093bdb29c8649ebd2869d8e1
parentba362371b1f541f2441986a72b9f596200562436 (diff)
parentc759ef2c8c6b3cb799025dd6bcd4297419cf4356 (diff)
downloadextras-ee78a79755d660a9055d68377682b9f17a69e09d.tar.gz
Merge "simpleperf: Clean up warnings during recording" am: c759ef2c8c
Original change: https://android-review.googlesource.com/c/platform/system/extras/+/2544607 Change-Id: Ic49cf28b6b67fe865ba0cfc812f7dc68622fb73e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--simpleperf/cmd_report_test.cpp15
-rw-r--r--simpleperf/dso.cpp11
-rw-r--r--simpleperf/get_test_data.h2
-rw-r--r--simpleperf/testdata/data/symfs_for_no_symbol_table_warning/elfbin6280 -> 0 bytes
4 files changed, 6 insertions, 22 deletions
diff --git a/simpleperf/cmd_report_test.cpp b/simpleperf/cmd_report_test.cpp
index edca413f..6dfbae5c 100644
--- a/simpleperf/cmd_report_test.cpp
+++ b/simpleperf/cmd_report_test.cpp
@@ -404,21 +404,6 @@ TEST_F(ReportCommandTest, no_show_ip_option) {
ASSERT_NE(content.find("unknown"), std::string::npos);
}
-TEST_F(ReportCommandTest, no_symbol_table_warning) {
- ASSERT_EXIT(
- {
- Report(PERF_DATA, {"--symfs", GetTestData(SYMFS_FOR_NO_SYMBOL_TABLE_WARNING)});
- if (!success) {
- exit(1);
- }
- if (content.find("GlobalFunc") != std::string::npos) {
- exit(2);
- }
- exit(0);
- },
- testing::ExitedWithCode(0), "elf doesn't contain symbol table");
-}
-
TEST_F(ReportCommandTest, read_elf_file_warning) {
ASSERT_EXIT(
{
diff --git a/simpleperf/dso.cpp b/simpleperf/dso.cpp
index 32b6731e..c8f4b3a1 100644
--- a/simpleperf/dso.cpp
+++ b/simpleperf/dso.cpp
@@ -573,8 +573,10 @@ class ElfDso : public Dso {
if (elf) {
min_vaddr_ = elf->ReadMinExecutableVaddr(&file_offset_of_min_vaddr_);
} else {
- LOG(WARNING) << "failed to read min virtual address of " << GetDebugFilePath() << ": "
- << status;
+ // This is likely to be a file wrongly thought of as an ELF file, due to stack unwinding.
+ // No need to report it by default.
+ LOG(DEBUG) << "failed to read min virtual address of " << GetDebugFilePath() << ": "
+ << status;
}
}
*min_vaddr = min_vaddr_;
@@ -637,14 +639,13 @@ class ElfDso : public Dso {
status = elf->ParseSymbols(symbol_callback);
}
android::base::LogSeverity log_level = android::base::WARNING;
- if (!symbols_.empty()) {
+ if (!symbols_.empty() || !symbols.empty()) {
// We already have some symbols when recording.
log_level = android::base::DEBUG;
}
if ((status == ElfStatus::FILE_NOT_FOUND || status == ElfStatus::FILE_MALFORMED) &&
build_id.IsEmpty()) {
- // This is likely to be a file wongly thought of as an ELF file, maybe due to stack
- // unwinding.
+ // This is likely to be a file wrongly thought of as an ELF file, due to stack unwinding.
log_level = android::base::DEBUG;
}
ReportReadElfSymbolResult(status, path_, GetDebugFilePath(), log_level);
diff --git a/simpleperf/get_test_data.h b/simpleperf/get_test_data.h
index a8acb059..e246366d 100644
--- a/simpleperf/get_test_data.h
+++ b/simpleperf/get_test_data.h
@@ -97,8 +97,6 @@ static const std::string PERF_DATA_FOR_BUILD_ID_CHECK = "perf_for_build_id_check
static const std::string CORRECT_SYMFS_FOR_BUILD_ID_CHECK = "data/correct_symfs_for_build_id_check";
static const std::string WRONG_SYMFS_FOR_BUILD_ID_CHECK = "data/wrong_symfs_for_build_id_check";
-static const std::string SYMFS_FOR_NO_SYMBOL_TABLE_WARNING =
- "data/symfs_for_no_symbol_table_warning";
static const std::string SYMFS_FOR_READ_ELF_FILE_WARNING = "data/symfs_for_read_elf_file_warning";
static BuildId CHECK_ELF_FILE_BUILD_ID("91b1c10fdd9fe2221dfec525497637f2229bfdbb");
diff --git a/simpleperf/testdata/data/symfs_for_no_symbol_table_warning/elf b/simpleperf/testdata/data/symfs_for_no_symbol_table_warning/elf
deleted file mode 100644
index a92e41fa..00000000
--- a/simpleperf/testdata/data/symfs_for_no_symbol_table_warning/elf
+++ /dev/null
Binary files differ