Output without dynamorio:
before thread creation
signal 37 received
leaving signal handler after one second
signal 37 received
leaving signal handler after one second
good morning from thread
Output with dynamorio:
before thread creation
signal 37 received
leaving signal handler after one second
good morning from thread
Code:
#include <pthread.h>
#include <iostream>
#include <signal.h>
#include <unistd.h>
using std::cout;
using std::endl;
void* sayGoodMorningAfterFiveSeconds(void*)
{
usleep(5000000);
cout << "good morning from thread" << endl;
return NULL;
}
static const int signalNumber = 37;
void registerSignalHandler(void (*handler)(int, siginfo_t*, void*))
{
struct sigaction action;
struct sigaction oldAction;
action.sa_handler = NULL;
action.sa_sigaction = handler;
sigemptyset(&action.sa_mask);
action.sa_flags = SA_ONSTACK | SA_SIGINFO;
sigaction(signalNumber, &action, &oldAction);
}
void handleSignal(int signalNumber, siginfo_t* signalInfo, void* context)
{
cout << "signal " << signalNumber << " received" << endl;
usleep(1000000);
cout << "leaving signal handler after one second" << endl;
}
int main()
{
registerSignalHandler(handleSignal);
pthread_t thread;
cout << "before thread creation" << endl;
pthread_create(&thread, NULL, sayGoodMorningAfterFiveSeconds, NULL);
//send signal twice to thread, both should be processed
pthread_kill(thread, signalNumber);
pthread_kill(thread, signalNumber);
pthread_join(thread, NULL);
return 0;
}
--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To post to this group, send email to dynamor...@googlegroups.com.
Visit this group at http://groups.google.com/group/dynamorio-users.
For more options, visit https://groups.google.com/d/optout.
On my machine, I cannot use the build due to another version of libc.
Update: There was an error on my side. I have used a wrong value for vm_size. Interesting enough, that didn't cause a problem before but with the latest version or even the bugfix applied, it DOES make a difference. Using a smaller vm_size (or none at all), shows that the the problem is really fixed.
A little BUT: From time to time, a signal still got lost. But not in every case as before.