Skip to content

Commit 70f522c

Browse files
kyleflemingdevyte
authored andcommitted
Fix stack trace unwinding within continuation lib (#4385)
1 parent 7f0b9d1 commit 70f522c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Diff for: cores/esp8266/cont.S

+26-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,30 @@ cont_continue:
5858
ret
5959
.size cont_yield, . - cont_yield
6060

61+
////////////////////////////////////////////////////
62+
63+
/*
64+
The purpose of cont_wrapper is to signal to xtensa-gdb
65+
that we want to treat this function as the outermost one.
66+
67+
From: binutils-gdb-xtensa/gdb/xtensa-tdep.c:2677 <https://git.io/vA8Ps>
68+
"Special case for terminating backtrace at a function that wants to
69+
be seen as the outermost one. Such a function will clear it's RA (A0)
70+
register to 0 in the prologue instead of saving its original value."
71+
*/
72+
73+
.text
74+
.align 4
75+
.literal_position
76+
.global cont_wrapper
77+
.type cont_wrapper, @function
78+
cont_wrapper:
79+
movi a0, 0
80+
callx0 a3
81+
movi a2, cont_norm
82+
jx a2
83+
.size cont_wrapper, . - cont_wrapper
84+
6185
////////////////////////////////////////////////////
6286

6387
.text
@@ -91,8 +115,8 @@ cont_run:
91115
/* set new stack*/
92116
l32i a1, a2, 16;
93117
/* goto pfn */
94-
movi a0, cont_norm
95-
jx a3
118+
movi a2, cont_wrapper
119+
jx a2
96120

97121
cont_resume:
98122
/* a1 <- cont_ctx.sp_yield */

0 commit comments

Comments
 (0)