Skip to content

Commit 5ead644

Browse files
fix: filter out arm debugging symbols
1 parent b11c219 commit 5ead644

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

src/executor/wall_time/perf/perf_map.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,27 @@ impl ModuleSymbols {
7979
}));
8080
}
8181

82+
// Filter out
83+
// - ARM ELF "mapping symbols" (https://github.com/torvalds/linux/blob/9448598b22c50c8a5bb77a9103e2d49f134c9578/tools/perf/util/symbol-elf.c#L1591C1-L1598C4)
84+
// - symbols that have en empty name
85+
symbols.retain(|symbol| {
86+
if symbol.name.is_empty() {
87+
trace!("Filtering out symbol with empty name: {symbol:?}");
88+
return false;
89+
}
90+
91+
// Reject ARM ELF "mapping symbols" as does perf
92+
let name = symbol.name.as_str();
93+
if let [b'$', b'a' | b'd' | b't' | b'x', rest @ ..] = name.as_bytes() {
94+
if rest.is_empty() || rest.starts_with(b".") {
95+
trace!("Filtering out ARM ELF mapping symbol: {symbol:?}");
96+
return false;
97+
}
98+
}
99+
100+
true
101+
});
102+
82103
// Update zero-sized symbols to cover the range until the next symbol
83104
// This is what perf does
84105
// https://github.com/torvalds/linux/blob/e538109ac71d801d26776af5f3c54f548296c29c/tools/perf/util/symbol.c#L256
@@ -100,16 +121,8 @@ impl ModuleSymbols {
100121
}
101122
}
102123

103-
// Filter out any symbols that still have zero size or an empty name
104-
symbols.retain(|symbol| {
105-
let should_keep = symbol.size > 0 && !symbol.name.is_empty();
106-
107-
if !should_keep {
108-
trace!("Filtering out symbol: {symbol:?}");
109-
}
110-
111-
should_keep
112-
});
124+
// Filter out any symbols are still zero-sized
125+
symbols.retain(|symbol| symbol.size > 0);
113126

114127
if symbols.is_empty() {
115128
return Err(anyhow::anyhow!("No symbols found"));
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:96076d39277b33ed3bbe060af13400acf3007a61c4b28fe5d93609122774a8dc
3-
size 498482
2+
oid sha256:2a7fe3c34026d24978a593c5d9610680c5cf1881ddaf0445f7a3b608400f17fb
3+
size 498487
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:4fba1f2413398a08fb12a54ecbefbf69c3a18cf5bf9d544386f2e1d794bf81f1
3-
size 557134
2+
oid sha256:56704ece3d27b5d3725bcf2a0eb8801f8c28dbf447f6e37996a5cd0596901606
3+
size 557139

0 commit comments

Comments
 (0)