-
Notifications
You must be signed in to change notification settings - Fork 2k
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
core/lib: make the use of DEBUG_BREAKPOINT on assert optional #19766
core/lib: make the use of DEBUG_BREAKPOINT on assert optional #19766
Conversation
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.
Makes sense. I think the reason this got in was that behavior on a break instruction when no debugger is attached is platform dependent. Some just treat the break instruction as a nop without a debugger attached, which would be fine here
bors merge |
19766: core/lib: make the use of DEBUG_BREAKPOINT on assert optional r=maribu a=gschorcht ### Contribution description This PR makes the use of `DEBUG_BREAKPOINT` on failed assertion optional. The behavior of `assert` has been changed with PR #19368. Instead of printing some useful information, either a breakpoint is inserted and the execution of the MCU stops in debugger or a endless while loop is executed. Before PR #19368 the user got on failed assertion: ``` Starting ESP32x with ID: 7cdfa1e36a34 ESP-IDF SDK Version v4.4.1-0-g1329b19fe49 ... *** RIOT kernel panic: FAILED ASSERTION. *** halted. ``` This was very helpful during development, especially to identify quickly the cause of problems with `DEBUG_ASSERT_VERBOSE` enabled, e.g. when misconfiguration led to failed assertions. With PR #19368 the user gets an address in best case (or even `0` on platforms like ESP32), in worst case the MCU seems to stuck, e.g. ``` Starting ESP32x with ID: 7cdfa1e36a34 ESP-IDF SDK Version v4.4.1-0-g1329b19fe49 ... 0 ``` The problem with the new behavior is that - a user doesn't get a quick indication of what happened - there is not always an easy way to attach a debugger This PR therefore makes the use of `DEBUG_BREAKPOINT` optional using `DEBUG_ASSERT_BREAKPOINT` define. ### Testing procedure Add `assert(0)` in `examples/hello-world/main.c` and compile with and w/o `CFLAGS='-DDEBUG_ASSERT_BREAKPOINT'`. With `DEBUG_ASSERT_BREAKPOINT` the execution should stop in `assert_failue`. Without `DEBUG_ASSERT_BREAKPOINT`, the information as generated before PR #19368 and the execution should stop in `panic_arch`. ### Issues/PRs references Co-authored-by: Gunar Schorcht <[email protected]>
Build failed: |
The CI failure is quite unexpected and interesting |
Compilation works with No wonder, you removed Atmega328p boards in |
That one is not related. The commit allowing it to compile there was storing string literals (the first argument to |
Ahh, AVR doesn't implement |
OK 🤔 then the RAM usage has been increased after PR #19368 but we didn't notice that because it was previously reduced by PR #19368:
That is, without PR #19368 there was only one byte left 😎 With PR #19368 we had 19 Bytes left, but now we have only 7 bytes left, too less to reenable
|
Sorry if I made the impression that bumping I just was confused as to why it was needed and thought that this may trigger (but not cause) an unrelated issue. But now that the reason is obvious, I can sleep well again. |
Indeed, reducing the string in this call reduces the RAM usage Line 35 in b209fdd
|
bors retry |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
bors merge |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Thx for the fix :) |
Contribution description
This PR makes the use of
DEBUG_BREAKPOINT
on failed assertion optional.The behavior of
assert
has been changed with PR #19368. Instead of printing some useful information, either a breakpoint is inserted and the execution of the MCU stops in debugger or a endless while loop is executed.Before PR #19368 the user got on failed assertion:
This was very helpful during development, especially to identify quickly the cause of problems with
DEBUG_ASSERT_VERBOSE
enabled, e.g. when misconfiguration led to failed assertions.With PR #19368 the user gets an address in best case (or even
0
on platforms like ESP32), in worst case the MCU seems to stuck, e.g.The problem with the new behavior is that
This PR therefore makes the use of
DEBUG_BREAKPOINT
optional usingDEBUG_ASSERT_BREAKPOINT
define.Testing procedure
Add
assert(0)
inexamples/hello-world/main.c
and compile with and w/oCFLAGS='-DDEBUG_ASSERT_BREAKPOINT'
.With
DEBUG_ASSERT_BREAKPOINT
the execution should stop inassert_failue
. WithoutDEBUG_ASSERT_BREAKPOINT
, the information as generated before PR #19368 and the execution should stop inpanic_arch
.Issues/PRs references