Allows for probes like `BEGIN {}`, in parity with bpftrace.
Also fixes an incorrect syntax error parsing argN builtins in
subsequent probes after an empty BEGIN block.
ok mpi@
-# $OpenBSD: Makefile,v 1.28 2023/08/28 21:23:46 dv Exp $
+# $OpenBSD: Makefile,v 1.29 2023/09/02 19:28:46 dv Exp $
BTRACE?= /usr/sbin/btrace
ALLOWDT!= sysctl -n kern.allowdt 2>/dev/null
BT_ARG_LANG_SCRIPTS= staticv str
# scripts that use kernel probes
-BT_KERN_SCRIPTS= filters mapoverwrite multiprobe
+BT_KERN_SCRIPTS= empty-stmts filters mapoverwrite multiprobe
REGRESS_EXPECTED_FAILURES= run-maxoperand
--- /dev/null
+// Test support for empty statement lists.
+BEGIN
+{
+ exit();
+}
+
+syscall:open:return
+{
+}
+
+syscall:close:return
+/comm != "ksh"/
+{
+}
+
+END
+{
+}
\ No newline at end of file
-/* $OpenBSD: bt_parse.y,v 1.51 2023/08/28 21:23:46 dv Exp $ */
+/* $OpenBSD: bt_parse.y,v 1.52 2023/09/02 19:28:46 dv Exp $ */
/*
* Copyright (c) 2019-2021 Martin Pieuchot <mpi@openbsd.org>
;
action : '{' stmtlist '}' { $$ = $2; }
+ | '{' '}' { $$ = NULL; }
;
%%