scripts: Strip compiler suffixes in result scripts

This can be explicitly disabled with -x/--no-strip in the relevant
scripts, but stripping by default seems to be more useful for composing
results in higher-level scripts. It's better for the result names to be
consistent, even if they don't match the .o symbols exactly.

Note some scripts are unaffected:

- cov.py - gcov doesn't seem to have an option for getting the
  unstripped symbols, so we only output the stripped names.

- structs.py - structs.py deals with struct names, which are notably not
  symbols.
This commit is contained in:
Christopher Haster
2025-03-06 15:07:12 -06:00
parent 9e22167a31
commit 1cc38acc91
6 changed files with 64 additions and 3 deletions

View File

@@ -576,6 +576,7 @@ def collect_decompressed(path, *,
perf_path=PERF_PATH,
sources=None,
everything=False,
no_strip=False,
propagate=0,
depth=1,
**args):
@@ -742,6 +743,10 @@ def collect_decompressed(path, *,
else:
file, line = re.sub('(\.o)?$', '.c', dso, 1), 0
# strip compiler suffixes
if not no_strip:
sym = sym.split('.', 1)[0]
last_stack.append((file, sym, line))
# stop propogating?
@@ -1766,6 +1771,10 @@ if __name__ == "__main__":
'--everything',
action='store_true',
help="Include builtin and libc specific symbols.")
parser.add_argument(
'-x', '--no-strip',
action='store_true',
help="Don't strip compiler optimization suffixes from symbols.")
parser.add_argument(
'--branches',
action='store_true',