[lldb-dev] LLDB 3.7 swallows real-time signals

Eugene Birukov eugenebi at hotmail.com
Tue May 19 10:22:14 PDT 2015


 Hi,
 
I have a simple program that uses real-time signals on Linux Ubuntu 14.04:
 
$ cat rt.cpp
#include <iostream>
#include <sys/mman.h>
#include <signal.h>
#include <assert.h>
#include <sys/types.h>
#include <unistd.h>

void handler(int sig, siginfo_t* info, void* context)
{
    std::cout << "signal " << sig << " received with value " << info->si_value.sival_in << "\n";
}
int main()
{
    int signo = SIGRTMIN + 1;
    if (SIGRTMAX > SIGRTMIN)
    {
        struct sigaction action;
        action.sa_sigaction = handler;
        action.sa_flags = SA_SIGINFO;
        sigaction(signo, &action, NULL);
        for (int i = 0; i < 3; ++i)
        {
            sigval value;
            value.sival_int = i + 10;
            sigqueue(getpid(), signo, value);
        }
    }
    else
    {
        std::cerr << "real-time signals not supported";
    }
}

This program works correctly standalone. GDB is capable of intercepting this signal and continue. LLDB-3.6 that I installed using apt-get does not intercept the signal but the program still receives it. But LLDB 3.7 that I built from sources from http://llvm.org/svn/llvm-project/lldb/trunk  simply swallows the signals. I think GDB behavior is the best option, but I could live with 3.6 behavior.
 
Is this a known problem? Is there a workaround or fix I can apply locally?
 
Thanks,
Eugene
 
$ cat rt.cpp
#include <iostream>
#include <sys/mman.h>
#include <signal.h>
#include <assert.h>
#include <sys/types.h>
#include <unistd.h>

void handler(int sig, siginfo_t* info, void* context)
{
    std::cout << "signal " << sig << " received with value " << info->si_value.sival_in << "\n";
}
 
int main()
{
    int signo = SIGRTMIN + 1;
    if (SIGRTMAX > SIGRTMIN)
    {
        struct sigaction action;
        action.sa_sigaction = handler;
        action.sa_flags = SA_SIGINFO;
        sigaction(signo, &action, NULL);
        for (int i = 0; i < 3; ++i)
        {
            sigval value;
            value.sival_int = i + 10;
            sigqueue(getpid(), signo, value);
        }
    }
    else
    {
        std::cerr << "real-time signals are not supported";
    }
}
 
$  ./rt
signal 35 received with value 10
signal 35 received with value 11
signal 35 received with value 12
 
$ ~/llvm/bin/lldb ./rt
(lldb) target create "./rt"
Current executable set to './rt' (x86_64).
(lldb) pr lau
Process 18697 launched: './rt' (x86_64)
Process 18697 exited with status = 0 (0x00000000)
(lldb) q

$ lldb-3.6 ./rt
(lldb) target create "./rt"
Current executable set to './rt' (x86_64).
(lldb) pr lau
Process 18674 launching
Process 18674 launched: './rt' (x86_64)
signal 35 received with value 10
signal 35 received with value 11
signal 35 received with value 12
Process 18674 exited with status = 0 (0x00000000)
(lldb) q
 
$ gdb --quiet ./rt
Reading symbols from ./rt...done.
(gdb) r
Starting program: /home/eugene/Z/tmp/rt
Program received signal SIG35, Real-time event 35.
0x00007ffff722cfc4 in __sigqueue (pid=18662, sig=35, val=...) at ../sysdeps/unix/sysv/linux/sigqueue.c:46
46      ../sysdeps/unix/sysv/linux/sigqueue.c: No such file or directory.
(gdb) c
Continuing.
signal 35 received with value 10
Program received signal SIG35, Real-time event 35.
0x00007ffff722cfc4 in __sigqueue (pid=18662, sig=35, val=...) at ../sysdeps/unix/sysv/linux/sigqueue.c:46
46      in ../sysdeps/unix/sysv/linux/sigqueue.c
(gdb) c
Continuing.
signal 35 received with value 11
Program received signal SIG35, Real-time event 35.
0x00007ffff722cfc4 in __sigqueue (pid=18662, sig=35, val=...) at ../sysdeps/unix/sysv/linux/sigqueue.c:46
46      in ../sysdeps/unix/sysv/linux/sigqueue.c
(gdb) c
Continuing.
signal 35 received with value 12
[Inferior 1 (process 18662) exited normally]
(gdb) q

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150519/5a66ab5b/attachment.html>


More information about the lldb-dev mailing list