Skip to content

Commit

Permalink
Fix stack trace unwinding within continuation lib (esp8266#4385)
Browse files Browse the repository at this point in the history
(cherry picked from commit 70f522c)
  • Loading branch information
kylefleming authored and bryceschober committed Apr 5, 2018
1 parent 98978ef commit bcac411
Showing 1 changed file with 26 additions and 2 deletions.
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

0 comments on commit bcac411

Please sign in to comment.