Skip to content

Commit

Permalink
btf: tracepoint: Prefer BTF data if available
Browse files Browse the repository at this point in the history
Before, if a tracepoint argument was accessed, bpftrace would prefer
using headers instead of BTF. This causes some friction for users/hosts
that don't have headers installed. They would have to pass in --btf to
override the default headers behavior.

This commit makes BTF the default if it's available. Now, users don't
need to pass in --btf.
  • Loading branch information
danobi committed Jul 27, 2020
1 parent b602b61 commit 7adfaab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ and this project adheres to
#### Changed
- Warn if using `print` on `stats` maps with top and div arguments
- [#1433](https://github.com/iovisor/bpftrace/pull/1433)
- Prefer BTF data if available to resolve tracepoint arguments
- [#1439](https://github.com/iovisor/bpftrace/pull/1439)

#### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion src/tracepoint_format_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bool TracepointFormatParser::parse(ast::Program *program, BPFtrace &bpftrace)
return true;

ast::TracepointArgsVisitor n{};
if (!bpftrace.force_btf_)
if (!bpftrace.btf_.has_data())
program->c_definitions += "#include <linux/types.h>\n";
for (ast::Probe *probe : probes_with_tracepoint)
{
Expand Down

0 comments on commit 7adfaab

Please sign in to comment.