1 //===-- LinuxSignals.cpp ----------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // C Includes 11 #include <signal.h> 12 13 // C++ Includes 14 // Other libraries and framework includes 15 // Project includes 16 #include "LinuxSignals.h" 17 18 using namespace process_linux; 19 20 LinuxSignals::LinuxSignals() 21 : UnixSignals() 22 { 23 Reset(); 24 } 25 26 void 27 LinuxSignals::Reset() 28 { 29 m_signals.clear(); 30 31 // FIXME we now need *Signals classes on systems that are different OSes (e.g. LinuxSignals 32 // needed on MacOSX to debug Linux from MacOSX, and similar scenarios, used by ProcessGDBRemote). These must be defined 33 // not based on OS includes and defines. 34 35 #define ADDSIGNAL(S, SUPPRESS, STOP, NOTIFY, DESCRIPTION) \ 36 AddSignal(SIG ## S, "SIG" #S, #S, SUPPRESS, STOP, NOTIFY, DESCRIPTION) 37 38 ADDSIGNAL(HUP, false, true, true, "hangup"); 39 ADDSIGNAL(INT, true, true, true, "interrupt"); 40 ADDSIGNAL(QUIT, false, true, true, "quit"); 41 ADDSIGNAL(ILL, false, true, true, "illegal instruction"); 42 ADDSIGNAL(TRAP, true, true, true, "trace trap (not reset when caught)"); 43 ADDSIGNAL(ABRT, false, true, true, "abort"); 44 ADDSIGNAL(IOT, false, true, true, "abort"); 45 ADDSIGNAL(BUS, false, true, true, "bus error"); 46 ADDSIGNAL(FPE, false, true, true, "floating point exception"); 47 ADDSIGNAL(KILL, false, true, true, "kill"); 48 ADDSIGNAL(USR1, false, true, true, "user defined signal 1"); 49 ADDSIGNAL(SEGV, false, true, true, "segmentation violation"); 50 ADDSIGNAL(USR2, false, true, true, "user defined signal 2"); 51 ADDSIGNAL(PIPE, false, true, true, "write to pipe with reading end closed"); 52 ADDSIGNAL(ALRM, false, false, true, "alarm"); 53 ADDSIGNAL(TERM, false, true, true, "termination requested"); 54 #ifdef SIGSTKFLT 55 ADDSIGNAL(STKFLT, false, true, true, "stack fault"); 56 #endif 57 ADDSIGNAL(CHLD, false, false, true, "child process exit"); 58 ADDSIGNAL(CONT, false, true, true, "process continue"); 59 ADDSIGNAL(STOP, true, true, true, "process stop"); 60 ADDSIGNAL(TSTP, false, true, true, "tty stop"); 61 ADDSIGNAL(TTIN, false, true, true, "background tty read"); 62 ADDSIGNAL(TTOU, false, true, true, "background tty write"); 63 ADDSIGNAL(URG, false, true, true, "urgent data on socket"); 64 ADDSIGNAL(XCPU, false, true, true, "CPU resource exceeded"); 65 ADDSIGNAL(XFSZ, false, true, true, "file size limit exceeded"); 66 ADDSIGNAL(VTALRM, false, true, true, "virtual alarm"); 67 ADDSIGNAL(PROF, false, true, true, "profiling alarm"); 68 ADDSIGNAL(WINCH, false, true, true, "window size change"); 69 #ifdef SIGPOLL 70 ADDSIGNAL(POLL, false, true, true, "pollable event"); 71 #endif 72 ADDSIGNAL(IO, false, true, true, "input/output ready"); 73 #ifdef SIGPWR 74 ADDSIGNAL(PWR, false, true, true, "power failure"); 75 #endif 76 ADDSIGNAL(SYS, false, true, true, "invalid system call"); 77 78 #undef ADDSIGNAL 79 } 80