-
Notifications
You must be signed in to change notification settings - Fork 104
Use cpptrace for prettier backtraces from exceptions
#3225
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
base: next
Are you sure you want to change the base?
Conversation
a0c128d to
19ae202
Compare
|
Lots of CMake pain here |
|
Thanks @ZedThree ! This does look nice, if the CMake pain can be overcome. I think if it works portably then it could replace all the MsgStack / AUTOTRACE code. |
Always generating the backtraces can slow the unit tests down by a factor x2-3 An alternative might be to store the `cpptrace:stacktrace` and only convert to string in `BoutException::what()`
- Add paths to `FetchContent` dirs in config file - Switch to custom versions of cpptrace/libdward-lite - Includes some cmake fixes in both projects
Required because cpptrace prevents in-source builds Also switch to using `subprocess.run` so we can better see errors
Seems to cause MPI problems?
|
I've removed That leaves uses like Same goes for uses like Here's an example with And here's what it looks like with Clearly the @bendudson Thoughts on completely removing CUDA tests are failing due to #3233 |
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.
clang-tidy made some suggestions
| bout::globals::mesh = Mesh::create(); | ||
| // Load from sources. Required for Field initialisation | ||
| bout::globals::mesh->load(); | ||
| bout::globals::mpi = new MpiWrapper(); |
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.
warning: assigning newly created 'gsl::owner<>' to non-owner 'MpiWrapper *' [cppcoreguidelines-owning-memory]
bout::globals::mpi = new MpiWrapper();
^Technically `base.h` is sufficient, but this causes backwards compatibility issues, and the compilation penalty is minor
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.
clang-tidy made some suggestions
|
|
||
| #include <fmt/base.h> | ||
| #include <fmt/format.h> | ||
|
|
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.
warning: included header format.h is not used directly [misc-include-cleaner]
We have historically been reluctant to add too many external dependencies, but with CMake and spack making it easier to pull them in and build them, I thought I'd try this library for generating stack traces.
Two useful things:
addr2lineand instead can always enable backtracesand can even enable colour:
It also has its own signal handler we could perhaps use instead of ours (though I've not tested this out).
Lastly, this is maybe a complete enough solution that we could also remove
MsgStack/TRACE/AUTO_TRACE?