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

Consider introducing debug messages in the compiler that are guarded by a flag #2242

Open
mohammadfawaz opened this issue Jul 6, 2022 · 0 comments
Labels
bikeshedding For bikeshedding trivialities compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request

Comments

@mohammadfawaz
Copy link
Contributor

mohammadfawaz commented Jul 6, 2022

Inspired by Clang/LLVM, it would be nice to have messages in the compiler that are guarded by a flag that tells us what the compiler is doing at any given point. These could be per compiler stage or optimization pass. The way this works in LLVM is something like:

LLVM_DEBUG(dbg() << "Starting some complex step");

LLVM_DEBUG is just a C++ macro and dbg() is just like println.

These message are hidden unless explicitly asked for in the command line by passing a flag --debug or --debug-only=<stage> or something like that.

It is also important to somehow remove these in production so they're not part of the final compiler binaries. I haven't look into how to do any of that in Rust yet.

As the compiler becomes more complex and the codebase grows larger, we're going to have to debug many complex issues (like #2240) and it would be nice to be able to pass a --debug/--debug-only flag to quickly figure out what stage is problematic before needing an actual debugger.

@mohammadfawaz mohammadfawaz added enhancement New feature or request bikeshedding For bikeshedding trivialities compiler General compiler. Should eventually become more specific as the issue is triaged labels Jul 6, 2022
@adlerjohn adlerjohn moved this to Todo in Fuel Network Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bikeshedding For bikeshedding trivialities compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant