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:
@@ -485,6 +485,7 @@ def collect_dwarf_lines(obj_path, *,
|
||||
def collect_job(path, start, stop, syms, lines, *,
|
||||
sources=None,
|
||||
everything=False,
|
||||
no_strip=False,
|
||||
propagate=0,
|
||||
depth=1,
|
||||
**args):
|
||||
@@ -551,6 +552,10 @@ def collect_job(path, start, stop, syms, lines, *,
|
||||
else:
|
||||
file = os.path.abspath(file)
|
||||
|
||||
# strip compiler suffixes
|
||||
if not no_strip:
|
||||
sym = sym.split('.', 1)[0]
|
||||
|
||||
results[(file, sym, line)] = (
|
||||
last_readed,
|
||||
last_proged,
|
||||
@@ -705,6 +710,10 @@ def collect_job(path, start, stop, syms, lines, *,
|
||||
|
||||
at_cache[addr] = file, sym, line
|
||||
|
||||
# strip compiler suffixes
|
||||
if not no_strip:
|
||||
sym = sym.split('.', 1)[0]
|
||||
|
||||
last_stack.append((file, sym, line))
|
||||
|
||||
# stop propagating?
|
||||
@@ -1763,6 +1772,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(
|
||||
'-A', '--annotate',
|
||||
action='store_true',
|
||||
|
||||
Reference in New Issue
Block a user