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
sys/sys: Add DEBUG_PANIC()
macro
#1471
Conversation
This macro just expands to a call to `__assert_func()`. Unlike the `assert()` macro, defining `NDEBUG` does not disable this macro. This macro can be used to trigger an unconditional crash.
The `DEBUG_PANIC()` macro triggers a crash if the `DEBUG_PANIC_ENABLED` syscfg setting is enabled. If this setting is disabled, the macro expands to nothing.
quick question, how this differ from assert? |
nevermind, I see that those are just convenient macros around asserts |
The dev list email probably goes into more detail than anyone is interested in :). The short answer is:
|
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.
Changes look good to me.
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.
LGTM. Only additional thing I could think of is adding a 3rd option for DEBUG_PANIC(), which would call user defined routine (defined in app, most likely) which could e.g. log the error. But we can add that later if there's an actual use case for such a thing.
The
DEBUG_PANIC()
macro triggers a crash if theDEBUG_PANIC_ENABLED
syscfg setting is enabled. If this setting is disabled, the macro expands to nothing.This feature is discussed briefly here: https://lists.apache.org/thread.html/0ce981b90eb74226fd660f25ba88f4ce6804eea2943edac70bf8731e@%3Cdev.mynewt.apache.org%3E