ST: Add support to save RBP register that allows stack backtrace #3987
+68
−5
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.
Duplicate the entire stack (backtrace) during coroutine creation, store the RBP in the jmpbuf, and replicate the parent RBP and stack home space containing local variables from the parent function.
Keep in mind that local variables might be freed after coroutine creation and should be freed while the coroutine is running. Please be caution with these variables; they only serve as backtrace hints and do not guarantee the validity of all local variables.
This Pull Request primarily serves as a helpful debugging tool for tracking the stack, with limited but valuable utility, particularly for identifying the creators of the current coroutine.
I have tested it in cygwin, before this patch, the backtrace is bellow:
After this patch, the backtrace is:
Because only save the parent RBP, so only trace some levels of backtrace.