Skip to content

Commit 1706b2a

Browse files
authored
tools/sofdsnoop: Add argument "--ebpf" (#5262)
Add argument "--ebpf" for tools/sofdsnoop. Signed-off-by: yu410621 <[email protected]>
1 parent 7de969a commit 1706b2a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/sofdsnoop.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Licensed under the Apache License, Version 2.0 (the "License")
1111
#
1212
# 30-Jul-2018 Jiri Olsa Created this.
13+
# 31-Mar-2025 yu410621 Add argument "--ebpf".
1314

1415
from __future__ import print_function
1516
from bcc import ArgString, BPF
@@ -42,6 +43,8 @@
4243
help="only print process names containing this name")
4344
parser.add_argument("-d", "--duration",
4445
help="total duration of trace in seconds")
46+
parser.add_argument("--ebpf", action="store_true",
47+
help=argparse.SUPPRESS)
4548
args = parser.parse_args()
4649
debug = 0
4750

@@ -266,6 +269,12 @@
266269
else:
267270
bpf_text = bpf_text.replace('FILTER', '')
268271

272+
# output eBPF program C code after it is replaced, used by debugging
273+
if debug or args.ebpf:
274+
print(bpf_text)
275+
if args.ebpf:
276+
exit()
277+
269278
# initialize BPF
270279
b = BPF(text=bpf_text)
271280

0 commit comments

Comments
 (0)