Skip to content

Commit 5077b07

Browse files
committed
Add --output-bpfmap
Signed-off-by: gray <[email protected]>
1 parent f1662f7 commit 5077b07

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

internal/pwru/output.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ func (o *output) Print(event *Event) {
458458
fmt.Fprintf(o.writer, "%s", getShinfoData(event, o))
459459
}
460460

461-
if event.PrintBpfmapId > 0 {
462-
fmt.Fprintf(o.writer, "\n%s", getBpfMapData(event, o))
461+
if o.flags.OutputBpfmap {
462+
fmt.Fprintf(o.writer, "%s", getBpfMapData(event, o))
463463
}
464464

465465
fmt.Fprintln(o.writer)

internal/pwru/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type Flags struct {
4747
OutputSkb bool
4848
OutputShinfo bool
4949
OutputStack bool
50+
OutputBpfmap bool
5051
OutputCaller bool
5152
OutputLimitLines uint64
5253
OutputSkbCB bool
@@ -84,6 +85,7 @@ func (f *Flags) SetFlags() {
8485
flag.BoolVar(&f.OutputSkb, "output-skb", false, "print skb")
8586
flag.BoolVar(&f.OutputShinfo, "output-skb-shared-info", false, "print skb shared info")
8687
flag.BoolVar(&f.OutputStack, "output-stack", false, "print stack")
88+
flag.BoolVar(&f.OutputBpfmap, "output-bpfmap", false, "print function arguments related to bpf maps")
8789
flag.BoolVar(&f.OutputCaller, "output-caller", false, "print caller function name")
8890
flag.Uint64Var(&f.OutputLimitLines, "output-limit-lines", 0, "exit the program after the number of events has been received/printed")
8991
flag.BoolVar(&f.OutputSkbCB, "output-skb-cb", false, "print skb->cb")

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func main() {
9898
useKprobeMulti = true
9999
}
100100

101-
funcs, bpfmapFuncs, err := pwru.GetFuncs(flags.FilterFunc, btfSpec, flags.KMods, useKprobeMulti, false)
101+
funcs, bpfmapFuncs, err := pwru.GetFuncs(flags.FilterFunc, btfSpec, flags.KMods, useKprobeMulti, flags.OutputBpfmap)
102102
if err != nil {
103103
log.Fatalf("Failed to get skb-accepting functions: %s", err)
104104
}

0 commit comments

Comments
 (0)