Postmortem - allow more control over crash dump#9271
Open
mcspr wants to merge 4 commits intoesp8266:masterfrom
Open
Postmortem - allow more control over crash dump#9271mcspr wants to merge 4 commits intoesp8266:masterfrom
mcspr wants to merge 4 commits intoesp8266:masterfrom
Conversation
ref. esp8266#9193, esp8266#9194, esp8266#9196 - persistent & public REASON_USER_... for user callback rst_info reason - public postmortem callback functions, don't overly hide the implementation - separate reasons for panic, assert, abort and c++ exceptions - put postmortem func one level down in the function chain, allow to override both the function itself or individual internals - stack offset for -fexceptions, skip unwind data to the actual point of origin
mcspr
commented
Aug 27, 2025
Comment on lines
+117
to
+118
| auto *rtc_sys = reinterpret_cast<uint32_t *>(0x60001100ul); | ||
| memset(rst_info, 0, sizeof(*rst_info)); |
Collaborator
Author
There was a problem hiding this comment.
slightly cheaper than system_rtc_... and no need to remember its logic
Comment on lines
+47
to
+51
| #ifdef __cplusplus | ||
| #define ESP8266_POSTMORTEM_NOEXCEPT noexcept | ||
| #else | ||
| #define ESP8266_POSTMORTEM_NOEXCEPT | ||
| #endif |
Collaborator
Author
There was a problem hiding this comment.
General idea here is to restrict crash opportunities in the functions. Even when exceptions are on.
| USF(1) = c; | ||
| } | ||
|
|
||
| void crash_system_prepare_rst_info(rst_info *rst_info, uint32_t user_reset_reason) noexcept { |
Collaborator
Author
There was a problem hiding this comment.
Output is optional, so rst_info has to be modified earlier
5 tasks
Contributor
Thank you, this is excellent, I've been waiting for something like this for ages! 🚀 I have some comments I've been meaning to post, I've been doing some tests, would update later soon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref. #9193
resolves #9194
resolves #9196
@DRSDavidSoft
this got somewhat forgotten... my draft patch was just replacing the restart, but I figured it would be better to also replace/refactor internals to make things more consistent
possibly a minor breakage for anyone tracking reason==254 specifically, but very easily noticed
override both the function itself or individual internals
also separates rst_info modifications and output, since the idea is to strip .o from the needless PSTR(...) strings when output is disabled (~1..2KiB)
as top comment states, tested by throwing a dummy exception with just what(). this would stop at the
~Foo()(hm) and the line throwing it