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

Add and use top-level TriggerSegmentationFault() for critical invariant checks? #847

Open
dkorolev opened this issue Mar 26, 2019 · 0 comments
Assignees

Comments

@dkorolev
Copy link
Member

Hi @mzhurovich, @grixa, @nyospe,

I'm finding my code to have a few CURRENT_THROW( ... _internal error_ ...) exceptions, which, during debugging, I often end up forcefully making into SEGFAULT-s to get a stack trace. Here is how it's done (originally found as part of googletest).

inline void TriggerSegmentationFault() { *reinterpret_cast<volatile int*>(0) = 0; }

Now I am thinking: if an error is indeed critical and not recoverable, and if it makes debugging easier (stack trace available) with a solid crash, perhaps it's a good idea to just add TriggerSegmentationFault() into the top-level port.h and to not hesitate to use it instead of a yet another kind-of-unrecoverable CURRENT_THROW(ModuleXInternalError()).

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants