Skip to content
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 stack trace unwinding when inside a continuation #4385

Merged
merged 4 commits into from
Mar 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions cores/esp8266/cont.S
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ cont_continue:
ret
.size cont_yield, . - cont_yield

////////////////////////////////////////////////////

/*
The purpose of cont_wrapper is to signal to xtensa-gdb
that we want to treat this function as the outermost one.

From: binutils-gdb-xtensa/gdb/xtensa-tdep.c:2677 <https://git.io/vA8Ps>
"Special case for terminating backtrace at a function that wants to
be seen as the outermost one. Such a function will clear it's RA (A0)
register to 0 in the prologue instead of saving its original value."
*/

.text
.align 4
.literal_position
.global cont_wrapper
.type cont_wrapper, @function
cont_wrapper:
movi a0, 0
callx0 a3
movi a2, cont_norm
jx a2
.size cont_wrapper, . - cont_wrapper

////////////////////////////////////////////////////

.text
Expand Down Expand Up @@ -91,8 +115,8 @@ cont_run:
/* set new stack*/
l32i a1, a2, 16;
/* goto pfn */
movi a0, cont_norm
jx a3
movi a2, cont_wrapper
jx a2

cont_resume:
/* a1 <- cont_ctx.sp_yield */
Expand Down