Implement more descriptive pretty stack printing for generated derivatives. - #1402
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Probably not for this PR, but I think we need to include DVI in the DiffRequest dump. I did it locally while working on static graph PRs as it's crucial for matching requests and caused the most trouble. |
|
This functionality looks very useful. At first, I thought it would be amazing to see the last original statement we started visiting (ideally, with location). This would be enough info for 80% of the cases when I need to run debuggers. But perhaps this would be hard to implement. Dumping the last generated stmts seems like a great idea as it does pretty much the same job. |
Did you mean: |
5918828 to
e31fe6c
Compare
| clang::Expr* m_ThisExprDerivative = nullptr; | ||
|
|
||
| /// The currently visited statement. Useful for crash pretty-printing. | ||
| const clang::Stmt* m_CurVisitedStmt = nullptr; |
There was a problem hiding this comment.
warning: member variable 'm_CurVisitedStmt' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
const clang::Stmt* m_CurVisitedStmt = nullptr;
^e31fe6c to
d454e8e
Compare
d454e8e to
fa0387b
Compare
| #ifndef NDEBUG | ||
| // Enable testing of the pretty printing of the state when clad crashes. | ||
| if (const char* Env = std::getenv("CLAD_FORCE_CRASH")) | ||
| std::terminate(); |
There was a problem hiding this comment.
This is tested but only run in debug mode. Our codecov infrastructure does not do run in debug mode that's why it complains.
fa0387b to
41c8785
Compare
41c8785 to
5b032bf
Compare
This prints:
@PetroZarytskyi, can you help me put what would help us make more sense out of a stack trace? I thought it might be a good idea to print also the last statement of the forward and reverse passes. Would that help?