bpftrace adds statement probes by source location
Introduced 2026-05-26 · score 0.95
HOW TO USE IT
When the target has DWARF source-location information, trace a valid statement from the specified file with a source-location uprobe; use the optional column to narrow the location.
bpftrace -e 'uprobe:<binary>@<file>:<line> { printf("hit\n"); }'WHY THIS HELPS
Trace a particular source statement while debugging a program.
REQUIREMENTS AND LIMITATIONS
- Version: v0.26.0
- <binary> (required): ELF binary to probe.
- <file> (required): Absolute or relative source-file path.
- <line> (required): Line number that must refer to a valid statement in the file.
- <column>: Optional column in the source location; if supplied, it must refer to a valid statement.
- { ... } (required): Probe action block; runs when the probe fires.
- Prerequisite: The target needs DWARF source-location information for statement probes.
- Prerequisite: The binary path must identify a valid ELF target; only statements originating in the specified file are considered, so statements from included files are ignored.
FIRST-PARTY EVIDENCE
- https://github.com/bpftrace/bpftrace/releases/tag/v0.26.0
- https://github.com/bpftrace/bpftrace/blob/v0.26.0/docs/language.md
Check the installed version and the source before using it. Entry JSON