From 2233c3a8cf4098fcea2ead94e628638b4c08c9aa Mon Sep 17 00:00:00 2001 From: Leon Hwang Date: Thu, 21 Nov 2024 22:47:54 +0800 Subject: [PATCH] bpflbr: Only trace kfunc when no -p Signed-off-by: Leon Hwang --- main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 6085218..786685c 100644 --- a/main.go +++ b/main.go @@ -95,8 +95,13 @@ func main() { ".data.lbrs": lbrs, } - tracings, err := bpflbr.NewBPFTracing(bpfSpec, reusedMaps, tracingTargets, flags.Kfuncs()) - assert.NoVerifierErr(err, "Failed to trace bpf progs: %v") + kfuncs := flags.Kfuncs() + if len(kfuncs) != 0 && len(progs) == 0 { + tracingTargets = tracingTargets[:0] + } + + tracings, err := bpflbr.NewBPFTracing(bpfSpec, reusedMaps, tracingTargets, kfuncs) + assert.NoVerifierErr(err, "Failed to trace: %v") defer tracings.Close() err = bpfProgs.AddProgs(tracings.Progs(), engine, true)