summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-26 18:01:31 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-11 23:34:14 -0700
commitcd64085694c7c4aa96312e88905015eea4d8b63d (patch)
tree2cabaaafe3a0f5a24b8145b87031ff3d8dd3ed9c /build-aux
parent7eda822ef31a15d22de03fc1eec7d995f661b26d (diff)
lib9p: Split the generated tables up
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/stack.c.gen21
1 files changed, 7 insertions, 14 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen
index 61d7bce..a3288b0 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 lib9p_msgs and "/9p.c:" in loc:
+ for meth in ["validate", "unmarshal", "marshal"]:
if line.startswith(f"table.{meth}("):
- return sorted(lib9p_versions[meth])
+ return sorted(f"{meth}_{msg}" for msg in lib9p_msgs)
return None
hooks_indirect_callees += [sbc_indirect_callees]