mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Fix backtraces on cancellation points
This commit is contained in:
parent
022536cab6
commit
0d7c265392
4 changed files with 22 additions and 13 deletions
|
@ -34,8 +34,10 @@
|
|||
#include "libc/thread/thread.h"
|
||||
#include "libc/thread/tls.h"
|
||||
|
||||
extern const char systemfive_cancellable[] hidden;
|
||||
extern const char systemfive_cancellable_end[] hidden;
|
||||
int systemfive_cancel(void);
|
||||
|
||||
extern const char systemfive_cancellable[];
|
||||
extern const char systemfive_cancellable_end[];
|
||||
|
||||
int _pthread_cancel_sys(void) {
|
||||
struct PosixThread *pt;
|
||||
|
@ -57,7 +59,7 @@ static void OnSigCancel(int sig, siginfo_t *si, void *ctx) {
|
|||
if ((pt->flags & PT_ASYNC) ||
|
||||
(systemfive_cancellable <= (char *)uc->uc_mcontext.rip &&
|
||||
(char *)uc->uc_mcontext.rip < systemfive_cancellable_end)) {
|
||||
uc->uc_mcontext.rip = (intptr_t)_pthread_cancel_sys;
|
||||
uc->uc_mcontext.rip = (intptr_t)systemfive_cancel;
|
||||
} else {
|
||||
tkill(atomic_load_explicit(&tib->tib_tid, memory_order_relaxed), sig);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue