Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move error printing from debug to verbose mode #3202

Merged
merged 2 commits into from
May 28, 2024

Conversation

viktormalik
Copy link
Contributor

@viktormalik viktormalik commented May 28, 2024

There is a class of recoverable errors which may occur for every execution of bpftrace in some conditions (e.g. errors depending on the availability of system features, like BTF).

For such cases, we don't want to bother the user by printing the error every time, so we only print them when output verbosity is increased. The problem is that we sometimes show the errors in the verbose mode but sometimes in the debug mode.

This change unifies the approach to show all the errors in the verbose mode (i.e. with -v). The reasoning is that the debug mode is intended for bpftrace developers while these errors may be useful to the user to hint him why the program is not working as expected.

The errors moved to -v are:

  • BTF loading errors
  • Clang parser errors
  • error reading /sys/kernel/tracing/available_filter_functions

Also, this drops printing ClangParser input in the debug mode as the input never changes during bpftrace execution so there's no point in printing it.

Checklist
  • Language changes are updated in man/adoc/bpftrace.adoc
  • User-visible and non-trivial changes updated in CHANGELOG.md
  • The new behaviour is covered by tests

@viktormalik viktormalik requested review from ajor, danobi and fbs as code owners May 28, 2024 07:43
There is a class of recoverable errors which may occur for every
execution of bpftrace in some conditions (e.g. errors depending on the
availability of system features, like BTF).

For such cases, we don't want to bother the user by printing the error
every time, so we only print them when output verbosity is increased.
The problem is that we sometimes show the errors in the verbose mode but
sometimes in the debug mode.

This change unifies the approach to show all the errors in the verbose
mode (i.e. with -v).

The errors moved to -v are:
- BTF loading errors
- Clang parser errors
- error reading /sys/kernel/tracing/available_filter_functions
The input never changes, it always has the form:

    #include </bpftrace/include/__btf_generated_header.h>
    ... definitions from the script ...

so it doesn't make much sense to print it.
@viktormalik viktormalik merged commit c532239 into bpftrace:master May 28, 2024
18 checks passed
@jordalgo jordalgo mentioned this pull request Jun 10, 2024
@viktormalik viktormalik deleted the cli-verbose-errs branch June 12, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants