From 9cd5486484653dd8cc42b43bcde45379982c3177 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 26 Jan 2025 12:53:37 -0700 Subject: Add libobj, a replacement for libmisc/vcall.h that internally is more like Go --- build-aux/stack.c.gen | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'build-aux') diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index 2a23565..3ef5628 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -353,7 +353,7 @@ def main( # The sbc-harness codebase ####################################### - vcalls: dict[str, set[str]] = {} + objcalls: dict[str, set[str]] = {} re_vtable_start = re.compile(r"_vtable\s*=\s*\{") re_vtable_entry = re.compile(r"^\s+\.(?P\S+)\s*=\s*(?P\S+),.*") for fname in c_fnames: @@ -367,9 +367,9 @@ def main( impl = m.group("impl") if impl == "NULL": continue - if m.group("meth") not in vcalls: - vcalls[meth] = set() - vcalls[meth].add(impl) + if m.group("meth") not in objcalls: + objcalls[meth] = set() + objcalls[meth].add(impl) if "}" in line: in_vtable = False elif re_vtable_start.search(line): @@ -401,14 +401,16 @@ def main( typ = m.group("typ") lib9p_msgs.add(typ) - re_call_vcall = re.compile(r"VCALL\((?P[^,]+), (?P[^,)]+)[,)].*") + re_call_objcall = re.compile( + r"(?:VCALL|LO_CALL)\((?P[^,]+), (?P[^,)]+)[,)].*" + ) def sbc_indirect_callees(loc: str, line: str) -> list[str] | None: if "/3rd-party/" in loc: return None - if m := re_call_vcall.fullmatch(line): - if m.group("meth") in vcalls: - return sorted(vcalls[m.group("meth")]) + if m := re_call_objcall.fullmatch(line): + if m.group("meth") in objcalls: + return sorted(objcalls[m.group("meth")]) return [f"__indirect_call:{m.group('obj')}->vtable->{m.group('meth')}"] if "trigger->cb(trigger->cb_arg)" in line: return [ -- cgit v1.2.3-2-g168b From a51875001eb672d73c9d84d44bb32abce327b931 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 2 Feb 2025 02:01:30 -0700 Subject: libmisc: Drop vcall.h --- build-aux/stack.c.gen | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'build-aux') diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index 3ef5628..e327298 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -401,9 +401,7 @@ def main( typ = m.group("typ") lib9p_msgs.add(typ) - re_call_objcall = re.compile( - r"(?:VCALL|LO_CALL)\((?P[^,]+), (?P[^,)]+)[,)].*" - ) + re_call_objcall = re.compile(r"LO_CALL\((?P[^,]+), (?P[^,)]+)[,)].*") def sbc_indirect_callees(loc: str, line: str) -> list[str] | None: if "/3rd-party/" in loc: @@ -411,7 +409,7 @@ def main( if m := re_call_objcall.fullmatch(line): if m.group("meth") in objcalls: return sorted(objcalls[m.group("meth")]) - return [f"__indirect_call:{m.group('obj')}->vtable->{m.group('meth')}"] + return [f"__indirect_call:{m.group('obj')}.vtable->{m.group('meth')}"] if "trigger->cb(trigger->cb_arg)" in line: return [ "alarmclock_sleep_intrhandler", -- cgit v1.2.3-2-g168b