<div dir="ltr">Hi all,<div><br></div><div>Now that I think about it, being able to continue the process after it hits a SIGSEGV is very important for Android because the ART runtime (and dalvik?) use SIGSEGV to detect and generate NullPointerExceptions in Java.</div><div><br></div><div>Ideally, on Android, if we see a SIGSEGV at a PC that belongs to jit code we should probably just transparently continue the process.</div><div><br></div><div>Vince</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 20, 2015 at 10:01 AM, Eugene Birukov <span dir="ltr"><<a href="mailto:eugenebi@hotmail.com" target="_blank">eugenebi@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Thank you!<br> <br>I have another concern about this file: why do we use numerical constants like 1,2,3,... here instead of symbolic SIGHUP,SIGINT,SIGQUIT,...?<br>Linux signal(7) man page gives 3 different values for some signals on different platforms. For example, SIGUSR1 could be 30, 10, or 16.<br> <br><font face="Courier New,sans-serif" size="2"> Standard signals<br> Linux supports the standard signals listed below. Several signal numbers are architecture-dependent, as<br> indicated in the "Value" column. (Where three values are given, the first one is usually valid for alpha<br> and sparc, the middle one for x86, arm, and most other architectures, and the last one for mips. (Values<br> for parisc are not shown; see the Linux kernel source for signal numbering on that architecture.) A -<br> denotes that a signal is absent on the corresponding architecture.)</font><br><font face="Courier New,sans-serif" size="2"> First the signals described in the original POSIX.1-1990 standard.</font><br><font face="Courier New,sans-serif" size="2"> Signal Value Action Comment<br> ──────────────────────────────────────────────────────────────────────<br> SIGHUP 1 Term Hangup detected on controlling terminal<br> or death of controlling process<br> SIGINT 2 Term Interrupt from keyboard<br> SIGQUIT 3 Core Quit from keyboard<br> SIGILL 4 Core Illegal Instruction<br> SIGABRT 6 Core Abort signal from abort(3)<br> SIGFPE 8 Core Floating point exception<br> SIGKILL 9 Term Kill signal<br> SIGSEGV 11 Core Invalid memory reference<br> SIGPIPE 13 Term Broken pipe: write to pipe with no<br> readers<br> SIGALRM 14 Term Timer signal from alarm(2)<br> SIGTERM 15 Term Termination signal<br> SIGUSR1 30,10,16 Term User-defined signal 1<br> SIGUSR2 31,12,17 Term User-defined signal 2<br> SIGCHLD 20,17,18 Ign Child stopped or terminated</font><br><font face="Courier New,sans-serif" size="2"> ...</font><br> <br>Eugene<br> <br><div>> From: <a href="mailto:labath@google.com" target="_blank">labath@google.com</a><br>> Date: Wed, 20 May 2015 11:43:20 +0100<br>> Subject: Re: [lldb-dev] LLDB 3.7 swallows real-time signals<br>> To: <a href="mailto:eugenebi@hotmail.com" target="_blank">eugenebi@hotmail.com</a><br>> CC: <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><div><div class="h5"><br>> <br>> Hello Eugene,<br>> <br>> thanks for diagnosing this issue. I will commit something similar to<br>> LLDB shortly.<br>> <br>> cheers,<br>> pl<br>> <br>> <br>> On 19 May 2015 at 19:52, Eugene Birukov <<a href="mailto:eugenebi@hotmail.com" target="_blank">eugenebi@hotmail.com</a>> wrote:<br>> > Hello,<br>> ><br>> > I debugged signal processing a bit, and I think that the right solution<br>> > would be just to add these signals to the list of known signals. I.e. in<br>> > LinuxSignals.cpp:<br>> ><br>> > void<br>> > LinuxSignals::Reset()<br>> > {<br>> > m_signals.clear();<br>> > AddSignal (1, "SIGHUP", "HUP", false, true , true ,<br>> > "hangup");<br>> > AddSignal (2, "SIGINT", "INT", true , true , true ,<br>> > "interrupt");<br>> > AddSignal (3, "SIGQUIT", "QUIT", false, true , true , "quit");<br>> > AddSignal (4, "SIGILL", "ILL", false, true , true , "illegal<br>> > instruction");<br>> > AddSignal (5, "SIGTRAP", "TRAP", true , true , true , "trace<br>> > trap (not reset when caught)");<br>> > AddSignal (6, "SIGABRT", "ABRT", false, true , true ,<br>> > "abort()");<br>> > AddSignal (6, "SIGIOT", "IOT", false, true , true , "IOT<br>> > trap");<br>> > AddSignal (7, "SIGBUS", "BUS", false, true , true , "bus<br>> > error");<br>> > AddSignal (8, "SIGFPE", "FPE", false, true , true ,<br>> > "floating point exception");<br>> > AddSignal (9, "SIGKILL", "KILL", false, true , true , "kill");<br>> > AddSignal (10, "SIGUSR1", "USR1", false, true , true , "user<br>> > defined signal 1");<br>> > AddSignal (11, "SIGSEGV", "SEGV", false, true , true ,<br>> > "segmentation violation");<br>> > AddSignal (12, "SIGUSR2", "USR2", false, true , true , "user<br>> > defined signal 2");<br>> > AddSignal (13, "SIGPIPE", "PIPE", false, true , true , "write<br>> > to pipe with reading end closed");<br>> > AddSignal (14, "SIGALRM", "ALRM", false, false, false,<br>> > "alarm");<br>> > AddSignal (15, "SIGTERM", "TERM", false, true , true ,<br>> > "termination requested");<br>> > AddSignal (16, "SIGSTKFLT", "STKFLT", false, true , true , "stack<br>> > fault");<br>> > AddSignal (16, "SIGCLD", "CLD", false, false, true , "same as<br>> > SIGCHLD");<br>> > AddSignal (17, "SIGCHLD", "CHLD", false, false, true , "child<br>> > status has changed");<br>> > AddSignal (18, "SIGCONT", "CONT", false, true , true , "process<br>> > continue");<br>> > AddSignal (19, "SIGSTOP", "STOP", true , true , true , "process<br>> > stop");<br>> > AddSignal (20, "SIGTSTP", "TSTP", false, true , true , "tty<br>> > stop");<br>> > AddSignal (21, "SIGTTIN", "TTIN", false, true , true ,<br>> > "background tty read");<br>> > AddSignal (22, "SIGTTOU", "TTOU", false, true , true ,<br>> > "background tty write");<br>> > AddSignal (23, "SIGURG", "URG", false, true , true , "urgent<br>> > data on socket");<br>> > AddSignal (24, "SIGXCPU", "XCPU", false, true , true , "CPU<br>> > resource exceeded");<br>> > AddSignal (25, "SIGXFSZ", "XFSZ", false, true , true , "file<br>> > size limit exceeded");<br>> > AddSignal (26, "SIGVTALRM", "VTALRM", false, true , true , "virtual<br>> > time alarm");<br>> > AddSignal (27, "SIGPROF", "PROF", false, false, false,<br>> > "profiling time alarm");<br>> > AddSignal (28, "SIGWINCH", "WINCH", false, true , true , "window<br>> > size changes");<br>> > AddSignal (29, "SIGPOLL", "POLL", false, true , true ,<br>> > "pollable event");<br>> > AddSignal (29, "SIGIO", "IO", false, true , true ,<br>> > "input/output ready");<br>> > AddSignal (30, "SIGPWR", "PWR", false, true , true , "power<br>> > failure");<br>> > AddSignal (31, "SIGSYS", "SYS", false, true , true , "invalid<br>> > system call");<br>> ><br>> > // Add real-time signals<br>> > for (int rtsig = SIGRTMIN + 1; rtsig < SIGRTMAX; ++rtsig)<br>> > {<br>> > char signame[16];<br>> > char sigdescr[64];<br>> > ::snprintf(signame, sizeof(signame), "SIG%d", rtsig);<br>> > ::snprintf(sigdescr, sizeof(sigdescr), "Real-time event %d", rtsig);<br>> > AddSignal (rtsig, signame, signame, false, true, true, sigdescr);<br>> > }<br>> > }<br>> ><br>> > Thanks,<br>> > Eugene<br>> > ________________________________<br>> > From: <a href="mailto:eugenebi@hotmail.com" target="_blank">eugenebi@hotmail.com</a><br>> > To: <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>> > Date: Tue, 19 May 2015 10:22:14 -0700<br>> > Subject: [lldb-dev] LLDB 3.7 swallows real-time signals<br>> ><br>> ><br>> > Hi,<br>> ><br>> > I have a simple program that uses real-time signals on Linux Ubuntu 14.04:<br>> ><br>> ><br>> > $ cat rt.cpp<br>> > #include <iostream><br>> > #include <sys/mman.h><br>> > #include <signal.h><br>> > #include <assert.h><br>> > #include <sys/types.h><br>> > #include <unistd.h><br>> ><br>> > void handler(int sig, siginfo_t* info, void* context)<br>> > {<br>> > std::cout << "signal " << sig << " received with value " <<<br>> > info->si_value.sival_in << "\n";<br>> > }<br>> > int main()<br>> > {<br>> > int signo = SIGRTMIN + 1;<br>> > if (SIGRTMAX > SIGRTMIN)<br>> > {<br>> > struct sigaction action;<br>> > action.sa_sigaction = handler;<br>> > action.sa_flags = SA_SIGINFO;<br>> > sigaction(signo, &action, NULL);<br>> > for (int i = 0; i < 3; ++i)<br>> > {<br>> > sigval value;<br>> > value.sival_int = i + 10;<br>> > sigqueue(getpid(), signo, value);<br>> > }<br>> > }<br>> > else<br>> > {<br>> > std::cerr << "real-time signals not supported";<br>> > }<br>> > }<br>> ><br>> > This program works correctly standalone. GDB is capable of intercepting this<br>> > signal and continue. LLDB-3.6 that I installed using apt-get does not<br>> > intercept the signal but the program still receives it. But LLDB 3.7 that I<br>> > built from sources from <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_svn_llvm-2Dproject_lldb_trunk&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=DDUMf06MYELAe1Nlv7KChiwJLLHbYha4jtK_AOiWqwQ&m=bI03wHO6-k0Y0zUgS8KxIWZcwzu-d-xtsVNtl7J9wUU&s=OmiIN68JEmr2iaYjCI-VaRe-KkmQQbyGxYaSexBkb-w&e=" target="_blank">http://llvm.org/svn/llvm-project/lldb/trunk</a> simply<br>> > swallows the signals. I think GDB behavior is the best option, but I could<br>> > live with 3.6 behavior.<br>> ><br>> > Is this a known problem? Is there a workaround or fix I can apply locally?<br>> ><br>> > Thanks,<br>> > Eugene<br>> ><br>> > $ cat rt.cpp<br>> > #include <iostream><br>> > #include <sys/mman.h><br>> > #include <signal.h><br>> > #include <assert.h><br>> > #include <sys/types.h><br>> > #include <unistd.h><br>> ><br>> > void handler(int sig, siginfo_t* info, void* context)<br>> > {<br>> > std::cout << "signal " << sig << " received with value " <<<br>> > info->si_value.sival_in << "\n";<br>> > }<br>> ><br>> > int main()<br>> > {<br>> > int signo = SIGRTMIN + 1;<br>> > if (SIGRTMAX > SIGRTMIN)<br>> > {<br>> > struct sigaction action;<br>> > action.sa_sigaction = handler;<br>> > action.sa_flags = SA_SIGINFO;<br>> > sigaction(signo, &action, NULL);<br>> > for (int i = 0; i < 3; ++i)<br>> > {<br>> > sigval value;<br>> > value.sival_int = i + 10;<br>> > sigqueue(getpid(), signo, value);<br>> > }<br>> > }<br>> > else<br>> > {<br>> > std::cerr << "real-time signals are not supported";<br>> > }<br>> > }<br>> ><br>> > $ ./rt<br>> > signal 35 received with value 10<br>> > signal 35 received with value 11<br>> > signal 35 received with value 12<br>> ><br>> > $ ~/llvm/bin/lldb ./rt<br>> > (lldb) target create "./rt"<br>> > Current executable set to './rt' (x86_64).<br>> > (lldb) pr lau<br>> > Process 18697 launched: './rt' (x86_64)<br>> > Process 18697 exited with status = 0 (0x00000000)<br>> > (lldb) q<br>> ><br>> > $ lldb-3.6 ./rt<br>> > (lldb) target create "./rt"<br>> > Current executable set to './rt' (x86_64).<br>> > (lldb) pr lau<br>> > Process 18674 launching<br>> > Process 18674 launched: './rt' (x86_64)<br>> > signal 35 received with value 10<br>> > signal 35 received with value 11<br>> > signal 35 received with value 12<br>> > Process 18674 exited with status = 0 (0x00000000)<br>> > (lldb) q<br>> ><br>> > $ gdb --quiet ./rt<br>> > Reading symbols from ./rt...done.<br>> > (gdb) r<br>> > Starting program: /home/eugene/Z/tmp/rt<br>> > Program received signal SIG35, Real-time event 35.<br>> > 0x00007ffff722cfc4 in __sigqueue (pid=18662, sig=35, val=...) at<br>> > ../sysdeps/unix/sysv/linux/sigqueue.c:46<br>> > 46 ../sysdeps/unix/sysv/linux/sigqueue.c: No such file or directory.<br>> > (gdb) c<br>> > Continuing.<br>> > signal 35 received with value 10<br>> > Program received signal SIG35, Real-time event 35.<br>> > 0x00007ffff722cfc4 in __sigqueue (pid=18662, sig=35, val=...) at<br>> > ../sysdeps/unix/sysv/linux/sigqueue.c:46<br>> > 46 in ../sysdeps/unix/sysv/linux/sigqueue.c<br>> > (gdb) c<br>> > Continuing.<br>> > signal 35 received with value 11<br>> > Program received signal SIG35, Real-time event 35.<br>> > 0x00007ffff722cfc4 in __sigqueue (pid=18662, sig=35, val=...) at<br>> > ../sysdeps/unix/sysv/linux/sigqueue.c:46<br>> > 46 in ../sysdeps/unix/sysv/linux/sigqueue.c<br>> > (gdb) c<br>> > Continuing.<br>> > signal 35 received with value 12<br>> > [Inferior 1 (process 18662) exited normally]<br>> > (gdb) q<br>> ><br>> ><br>> > _______________________________________________ lldb-dev mailing list<br>> > <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>> ><br>> > _______________________________________________<br>> > lldb-dev mailing list<br>> > <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>> ><br></div></div></div> </div></div>
<br>_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div><br></div>