Skip to content

Commit

Permalink
Move BTF verbose messages to debug messages
Browse files Browse the repository at this point in the history
Before, you'd get:
```
$ sudo ./build/src/bpftrace -lv "kfunc:hrtimers_dead_cpu"
BTF: using data from /sys/kernel/btf/vmlinux
kfunc:hrtimers_dead_cpu
    unsigned int scpu;
    int retval;
```

The first message is kind of ugly and not very actionable or informative
for users. Better to move it to debug where bpftrace developers might
actually make use of the information.
  • Loading branch information
danobi committed Oct 12, 2020
1 parent 1493b6c commit 693506f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ and this project adheres to
- [#1542](https://github.com/iovisor/bpftrace/pull/1542)
- Change a part of the message of '-v' output
- [#1553](https://github.com/iovisor/bpftrace/pull/1553)
- Remove "BTF: using data from ..." message when using -v flag
- [#1554](https://github.com/iovisor/bpftrace/pull/1554)

#### Deprecated

Expand Down
1 change: 0 additions & 1 deletion docs/reference_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ If BTF is available, it is also possible to list struct/union/emum definitions.

```
# bpftrace -lv "struct path"
BTF: using data from /sys/kernel/btf/vmlinux
struct path {
struct vfsmount *mnt;
struct dentry *dentry;
Expand Down
4 changes: 2 additions & 2 deletions src/btf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static struct btf *btf_open(const struct vmlinux_location *locs)

if (err)
{
if (bt_verbose)
if (bt_debug != DebugLevel::kNone)
{
char err_buf[256];

Expand All @@ -126,7 +126,7 @@ static struct btf *btf_open(const struct vmlinux_location *locs)
continue;
}

if (bt_verbose)
if (bt_debug != DebugLevel::kNone)
{
std::cerr << "BTF: using data from " << path << std::endl;
}
Expand Down

0 comments on commit 693506f

Please sign in to comment.