This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/20485] sigprocmask in tracee affects tracer as well


https://sourceware.org/bugzilla/show_bug.cgi?id=20485

--- Comment #2 from Jan Engelhardt <jengelh at inai dot de> ---
Hm. So what is the best way to put gdb in a position to successfully interrupt
a process that implements a signal thread in the style of pthread_sigmask(3)'s
example?
---
#include <stdio.h>
#include <signal.h>
#include <pthread.h>
#include <unistd.h>
static sigset_t m;
static void *signal_handler(void *x) {
        int sig;
        while (sigwait(&m, &sig) == 0) printf("acting upon signal %d\n", sig);
        return NULL;
}
int main(void) {
        pthread_t t2;
        sigemptyset(&m);
        sigaddset(&m, SIGINT);
        pthread_sigmask(SIG_BLOCK, &m, NULL);
        pthread_create(&t2, NULL, signal_handler, NULL);
        while (1) sleep(1);
        return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]