Skip to content

Commit

Permalink
tools/argdist: Add ebpf option to print BPF program code only
Browse files Browse the repository at this point in the history
  • Loading branch information
xingfeng2510 authored and yonghong-song committed Mar 20, 2023
1 parent a37d0ee commit ca2dcf8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/argdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ def __init__(self):
"as either full path, "
"or relative to relative to current working directory, "
"or relative to default kernel header search path")
parser.add_argument("--ebpf", action="store_true",
help=argparse.SUPPRESS)
self.args = parser.parse_args()
self.usdt_ctx = None

Expand Down Expand Up @@ -683,7 +685,10 @@ def _generate_program(self):
for probe in self.probes
if probe.usdt_ctx]:
print(text)
print(bpf_source)
if self.args.verbose or self.args.ebpf:
print(bpf_source)
if self.args.ebpf:
exit()
usdt_contexts = [probe.usdt_ctx
for probe in self.probes if probe.usdt_ctx]
self.bpf = BPF(text=bpf_source, usdt_contexts=usdt_contexts)
Expand Down

0 comments on commit ca2dcf8

Please sign in to comment.