-
Notifications
You must be signed in to change notification settings - Fork 392
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
Don't catch std::exception in Debug mode so we can catch array bound errors in debugger #10678
Conversation
… error in debugger cmake will properly define NDEBUG on msvc as well in release mode cf https://gitlab.kitware.com/cmake/cmake/-/blob/1e35163a/Modules/Platform/Windows-MSVC.cmake#L481-483
Oooh, does this mean I won't have to set a breakpoint here in
|
@mjwitte maybe? I mean this appears to just add a section of code inside a NDEBUG (Not-Debug) that will gracefully catch generic std::exceptions and report them to the error file nicely. I may edit the title of the PR to be a bit more clear. Or maybe I'm missing something. (@jmarrec ?) But on that note, @mjwitte, if there is something we can do to make your debugging easier, I'm all for it. So you regularly have to just put a breakpoint in the vector code!? |
Yep. If it's std::vector that's overrun, then you just get "invalid vector subscript" in the err output, even when running in the debugger. So adding a breakpoint let's you look up the chain to find the offending line. I'll test that with this branch. |
Geez, it's not adding the section of code, it's just nesting it inside ndebug. Yep, got it. This is great and should help. If you are able to confirm the behavior at some point, it would be great to drop this in. If not, I'll whip up a windows test situation. |
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.
sigh
I can't reproduce the need for a breakpoint in vector (I know I stumbled over that several times in the past month). But this change looks good to me.
Can you try this #10677 Basically try to run https://github.com/NREL/EnergyPlusDevSupport/blob/master/DefectFiles/10000s/10665/in.idf This is what prompted me to open this PR. I got annoyed one time too many about E+ gracefully handling an out of bounds error when I really do want it to throw so I know WHERE it's happening. Definitely works on gcc/clang. |
OK, let's drop this little maybe no-op / maybe improvement in. CI is completely clean so this won't affect any other PRs waiting on CI results. Thanks @jmarrec |
Pull request overview
cmake will properly define NDEBUG on msvc as well in release mode cf https://gitlab.kitware.com/cmake/cmake/-/blob/1e35163a/Modules/Platform/Windows-MSVC.cmake#L481-483
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.