summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-12-01 06:12:08 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-12-01 06:12:08 +0000
commit9915c93bb1adfdc05235eeb26649b512ec0fd007 (patch)
treecd278de1ea999b6f2a79c1007d5ccaafb5bfd917
parent0cdc8c463f934bd25991386c802dd331b6bf097e (diff)
parentb8aba989f578d0fe87390fca8b2e8a11c405783e (diff)
downloadextras-9915c93bb1adfdc05235eeb26649b512ec0fd007.tar.gz
Merge "simpleperf: ignore arm mapping symbols in /proc/kallsyms."
-rw-r--r--simpleperf/kallsyms.cpp5
-rw-r--r--simpleperf/kallsyms_test.cpp19
2 files changed, 24 insertions, 0 deletions
diff --git a/simpleperf/kallsyms.cpp b/simpleperf/kallsyms.cpp
index f9a93589..9cec7848 100644
--- a/simpleperf/kallsyms.cpp
+++ b/simpleperf/kallsyms.cpp
@@ -24,6 +24,7 @@
#include <android-base/properties.h>
#include "environment.h"
+#include "read_elf.h"
#include "utils.h"
namespace simpleperf {
@@ -263,6 +264,10 @@ bool ProcessKernelSymbols(std::string& symbol_data,
p = data_end;
}
if (ret >= 3) {
+ if (IsArmMappingSymbol(name)) {
+ continue;
+ }
+
symbol.name = name;
size_t module_len = strlen(module);
if (module_len > 2 && module[0] == '[' && module[module_len - 1] == ']') {
diff --git a/simpleperf/kallsyms_test.cpp b/simpleperf/kallsyms_test.cpp
index d45aeaa6..cacd1634 100644
--- a/simpleperf/kallsyms_test.cpp
+++ b/simpleperf/kallsyms_test.cpp
@@ -64,6 +64,25 @@ TEST(kallsyms, ProcessKernelSymbols) {
data, std::bind(&KernelSymbolsMatch, std::placeholders::_1, expected_symbol)));
}
+TEST(kallsyms, ProcessKernelSymbols_ignore_arm_mapping_symbols) {
+ std::string data =
+ "aaaaaaaaaaaaaaaa t $x.9 [coresight_etm4x]\n"
+ "bbbbbbbbbbbbbbbb t etm4_pm_clear [coresight_etm4x]\n";
+ bool has_normal_symbol = false;
+ bool has_arm_mapping_symbol = false;
+ auto callback = [&](const KernelSymbol& sym) {
+ if (strcmp(sym.name, "etm4_pm_clear") == 0) {
+ has_normal_symbol = true;
+ } else {
+ has_arm_mapping_symbol = true;
+ }
+ return false;
+ };
+ ProcessKernelSymbols(data, callback);
+ ASSERT_TRUE(has_normal_symbol);
+ ASSERT_FALSE(has_arm_mapping_symbol);
+}
+
#if defined(__ANDROID__)
TEST(kallsyms, GetKernelStartAddress) {
TEST_REQUIRE_ROOT();