-
Notifications
You must be signed in to change notification settings - Fork 13.3k
fix raise_exception() #6288
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
fix raise_exception() #6288
Conversation
This is tested with gdb:
So there is room for improvement on gdb side (I'm not a specialist) |
I think that's exactly as it was for GDB. On assert/panic/etc. you get a breakpoint in the raise_exception() call and need to "up" one or two levels to get to the actual line of code (but it's still there in the stack so it's fully functional). |
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.
Minor cleanings only. Looks good logically.
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 now.
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.
Overall, I'm ok with the approach, pending my minor comments. In essence, if there is a code path that calls raise_exception(), then set a global flag before manually calling __real_system_restart_local(), then interpret that flag first.
Of course, if syscall were to actually work as it's supposed to, it would be much better and standard, but I have no idea how to do that.
And great work figuring out this solution!
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.
Nothing jumps out at me.
Out of curiosity, does this work correctly with exceptions enabled? (after they get fixed again)
It should work w/C++ exceptions, should they get fixed at some point. Exceptions don't involve this bit at all unless they're uncaught, at which point panic() is called and an exception reason printed (__unhandled_exception). |
This is a proposal
It seems this has no visible effect:On
panic
/abort
/assert
called from user context, WDT happens due to the followingwhile(1);
and finally produces an exception with the right message (after the WDT reason and delay).On ISR context, only the WDT reason is visible.
This commit permits to avoid WDT and show the right message from both user or ISR context.
Before #4482,
*((int*)0)=0
was used to trigger an hardware exception (similar to the WDT exception we have now, also showing an additional message unrelated to the real cause).On real hardware exception,
raise_exception()
is not called.fixes #6283 (thanks @mhightower83)