Commit 73b5401f authored by Brendan Gregg's avatar Brendan Gregg Committed by Sasha Goldshtein

add way to debug generated BPF code (#1494)

parent c8177e9b
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# tcpretrans Trace TCP retransmits and TLPs.
# tcpretrans Trace or count TCP retransmits and TLPs.
# For Linux, uses BCC, eBPF. Embedded C.
#
# USAGE: tcpretrans [-h] [-l]
# USAGE: tcpretrans [-c] [-h] [-l]
#
# This uses dynamic tracing of kernel functions, and will need to be updated
# to match kernel changes.
......@@ -38,6 +38,7 @@ parser.add_argument("-l", "--lossprobe", action="store_true",
parser.add_argument("-c", "--count", action="store_true",
help="count occurred retransmits per flow")
args = parser.parse_args()
debug = 0
# define BPF program
bpf_text = """
......@@ -188,6 +189,9 @@ else:
bpf_text = bpf_text.replace("IPV4_CORE", "ipv4_events.perf_submit(ctx, &data4, sizeof(data4));")
bpf_text = bpf_text.replace("IPV6_CORE", "ipv6_events.perf_submit(ctx, &data6, sizeof(data6));")
if debug:
print(bpf_text)
# event data
class Data_ipv4(ct.Structure):
_fields_ = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment