[DTrace-devel] [PATCH 3/4] bpf: improve parsing bpf_helper_defs.h

Kris Van Hees kris.van.hees at oracle.com
Fri May 24 23:57:34 UTC 2024


The parsing of bpf_helper_defs.h to get names of BPF helpers and their
associated values needed tweaking.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 include/mkHelpers | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/mkHelpers b/include/mkHelpers
index dc5e62c8..96d5ea53 100755
--- a/include/mkHelpers
+++ b/include/mkHelpers
@@ -8,8 +8,9 @@ BEGIN {
 }
 
 $1 == "static" && /=/ && /[ \t]+[1-9][0-9]*[ \t]*;/ {
-	if (match($0, /[ \t\*]bpf_[_A-Za-z0-9]+/) > 0) {
-		fn = substr($0, RSTART + 5, RLENGTH - 5);
+	if (match($0, /[ \t\*]bpf_[_A-Za-z0-9]+[ \t]*\)/) > 0) {
+		fn = substr($0, RSTART + 5, RLENGTH - 6);
+		sub(/[ \t]+/, "", fn);
 
 		match($0, /[ \t]+[1-9][0-9]*[ \t]*;/);
 		id = substr($0, RSTART, RLENGTH - 1);
-- 
2.42.0




More information about the DTrace-devel mailing list