diff options
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/stack.c.gen | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index 61d7bce..0568af0 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # build-aux/stack.c.gen - Analyze stack sizes for compiled objects # -# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> +# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-License-Identifier: AGPL-3.0-or-later import os.path @@ -375,25 +375,18 @@ def main( if m := re_tmessage_handler.fullmatch(line): tmessage_handlers.add(m.group("handler")) - lib9p_versions: dict[str, set[str]] | None = None + lib9p_msgs: set[str] = set() if any(fname.endswith("lib9p/9p.c") for fname in c_fnames): generated_c = next( fname for fname in c_fnames if fname.endswith("lib9p/9p.generated.c") ) - re_lib9p_msg_entry = re.compile(r"^\s*_MSG\((?P<typ>\S+)\),$") - lib9p_versions = { - "validate": set(), - "marshal": set(), - "unmarshal": set(), - } + re_lib9p_msg_entry = re.compile(r"^\s*_MSG_(?:[A-Z]+)\((?P<typ>\S+)\),$") with open(generated_c, "r") as fh: for line in fh: line = line.rstrip() if m := re_lib9p_msg_entry.fullmatch(line): typ = m.group("typ") - lib9p_versions["validate"].add(f"validate_{typ}") - lib9p_versions["unmarshal"].add(f"unmarshal_{typ}") - lib9p_versions["marshal"].add(f"marshal_{typ}") + lib9p_msgs.add(typ) re_call_vcall = re.compile(r"VCALL\((?P<obj>[^,]+), (?P<meth>[^,)]+)[,)].*") @@ -417,10 +410,10 @@ def main( ] if tmessage_handlers and "/srv.c:" in loc and "tmessage_handlers[typ](" in line: return sorted(tmessage_handlers) - if lib9p_versions and "/9p.c:" in loc: - for meth in lib9p_versions.keys(): - if line.startswith(f"table.{meth}("): - return sorted(lib9p_versions[meth]) + if lib9p_msgs and "/9p.c:" in loc: + for meth in ["validate", "unmarshal", "marshal"]: + if line.startswith(f"tentry.{meth}("): + return sorted(f"{meth}_{msg}" for msg in lib9p_msgs) return None hooks_indirect_callees += [sbc_indirect_callees] @@ -753,6 +746,9 @@ def main( return True return False + def misc_filter(name: str) -> bool: + return name.endswith(":__lm_printf") or name == "__assert_msg_fail" + def location_xform(loc: str) -> str: if not loc.startswith("/"): return loc @@ -787,6 +783,7 @@ def main( app_func_filters={ "Threads": thread_filter, "Interrupt handlers": intrhandler_filter, + "Misc": misc_filter, }, app_location_xform=location_xform, app_indirect_callees=indirect_callees, |