-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Refactor verbose and debug outputs #3203
Refactor verbose and debug outputs #3203
Conversation
38213cd
to
5f1936f
Compare
Since this does several user-facing changes, I added multiple changelog entries. |
5f1936f
to
601e811
Compare
601e811
to
f85d469
Compare
f85d469
to
6228754
Compare
Update: the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
The one additional thing we could consider doing is moving all the the stage level checking into log.cpp
and changing LOG(DEBUG)
to something like LOG(DEBUG, stage)
. At the moment LOG(DEBUG)
is only used in 1 place so I think it's fine to modify it if we want.
6228754
to
c99a2d3
Compare
I like this. Let's do it in a follow-up PR, though. |
c99a2d3
to
d3a1ff6
Compare
So the |
a1d0d26
to
1318dbe
Compare
Yes, it does. I added it into the changelog. |
Ok, this caused more trouble than I originally anticipated. The main reason is The reason why I'm not using
|
1318dbe
to
9318996
Compare
9318996
to
3be5f68
Compare
3be5f68
to
2d699d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot.
My only feedback is that I think it'd be nice to not make --dry-run
and -d
duplicate the action of early exit. I suggest to make -d
only control debug output and not affect execution. We are already departing from having -d
emit output and not attach, so I think we are free to change it further.
That way -d
and --dry-run
remain orthogonal and thus more composable.
2d699d7
to
897e9d4
Compare
That's a good idea. I changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! but CI is failing now
That's because of #3235. I'd love to hear your opinion on that one. |
This needs #3246 to be merged first to fix the tools check. |
897e9d4
to
b637d28
Compare
Rebased on top of master. In case no one has objections, I'll merge this today. |
Or not, unfortunately (We really need this merged ASAP to test tools loading and attachment in the CI) |
I'm looking at the regression. If you wanna |
It seems that the CI machines were updated to a kernel which has the tcp_drop function inlined. Therefore, we need to use the new version of tcpdrop.bt.
Consolidate and cleanup information that is being printed in the verbose (-v) and debugging output (-d). The main idea is: - the verbose output is intended for users to get more information on what bpftrace is doing and where it is (possibly) failing, - the debug output is intended for developers to help them debugging bpftrace by providing very detailed outputs of individual stages of bon pftrace runtime. The main (user-facing) change this brings is that it introduces a mandatory argument to the -d option which allows to pick the stage whose output should be printed. The currently supported stages are: - 'ast' - prints the AST after each pass - 'codegen' - prints the LLVM IR code as emit by CodegenLLVM - 'codegen-opt' - prints the LLVM IR code after it is optimized by LLVM (i.e. what is actually compiled to BPF bytecode) - 'libbpf' - captures and prints libbpf log for all libbpf operations that we use - 'verifier' - captures and prints the BPF verifier log On top of that, -d can be used multiple times with different arguments and the argument 'all' activates all of the above. Another change is that -d no longer executes a dry run. The reason is that we're printing information from later stages so we need to let bpftrace run all the time. A new option for dry run will be added in the following patch. In addition, there are more user-facing changes: - remove the -dd option, - allow simultaneous use of -v and -d, - add --debug as a long version of -d. Also, some minor refactorings were done: - make sure the verbosity output always goes to stderr while the debugging output always goes to stdout, - improve some formatting of verbose outputs.
The option terminates bpftrace right after all the probes are attached. This can be useful to test that the script can be parsed, loaded, and attached, without actually executing it. We use this in the tools parsing test since the -d option no longer does a dry run.
b637d28
to
bd28ce8
Compare
Consolidate and cleanup information that is being printed in the verbose (
-v
) and debugging output (-d
). The main idea is:The main (user-facing) change this brings is that it introduces a mandatory argument to the
-d
option which allows to pick the stage whose output should be printed.The currently supported stages are:
ast
- prints the AST after each pass,codegen
- prints the LLVM IR code as emit by CodegenLLVM,codegen-opt
- prints the LLVM IR code after it is optimized by LLVM (i.e. what is actually compiled to BPF bytecode),libbpf
- captures and prints libbpf log for all libbpf operations that we use,verifier
- captures and prints the BPF verifier log.On top of that,
-d
can be used multiple times with different arguments and the argumentall
activates all of the above.In addition, there are more user-facing changes:
-dd
option,-v
and-d
simultaneously,--debug
as a long version of-d
.Also, some minor refactorings were done:
Checklist
man/adoc/bpftrace.adoc
CHANGELOG.md