Skip to content

Commit e1c115e

Browse files
authored
Merge pull request #2640 from natalie-lang/gc-thread-sp
Store real end of stack when thread suspends for amd64
2 parents f9ab06a + 3d27422 commit e1c115e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/natalie.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,11 @@ void gc_signal_handler(int signal, siginfo_t *, void *ucontext) {
959959
}
960960
memcpy(ctx, ucontext, sizeof(ucontext_t));
961961
thread->set_suspend_status(ThreadObject::SuspendStatus::Suspended);
962+
963+
#if defined(__x86_64__)
964+
thread->set_end_of_stack(reinterpret_cast<void *>(ctx->uc_mcontext.gregs[REG_RSP]));
965+
#endif
966+
962967
#ifdef NAT_DEBUG_THREADS
963968
char msg[] = "THREAD DEBUG: Thread suspended\n";
964969
assert(::write(STDERR_FILENO, msg, sizeof(msg)) != -1);

0 commit comments

Comments
 (0)