diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Target/UnixSignals.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Target/UnixSignals.cpp | 95 |
1 files changed, 54 insertions, 41 deletions
diff --git a/contrib/llvm/tools/lldb/source/Target/UnixSignals.cpp b/contrib/llvm/tools/lldb/source/Target/UnixSignals.cpp index 91579e8..8a98c21 100644 --- a/contrib/llvm/tools/lldb/source/Target/UnixSignals.cpp +++ b/contrib/llvm/tools/lldb/source/Target/UnixSignals.cpp @@ -19,20 +19,21 @@ #include "Plugins/Process/Utility/FreeBSDSignals.h" #include "Plugins/Process/Utility/LinuxSignals.h" #include "Plugins/Process/Utility/MipsLinuxSignals.h" +#include "Plugins/Process/Utility/NetBSDSignals.h" using namespace lldb_private; UnixSignals::Signal::Signal ( const char *name, - const char *short_name, bool default_suppress, bool default_stop, bool default_notify, - const char *description + const char *description, + const char *alias ) : m_name (name), - m_short_name (short_name), + m_alias (alias), m_description (), m_suppress (default_suppress), m_stop (default_stop), @@ -63,8 +64,9 @@ UnixSignals::Create(const ArchSpec &arch) } case llvm::Triple::FreeBSD: case llvm::Triple::OpenBSD: - case llvm::Triple::NetBSD: return std::make_shared<FreeBSDSignals>(); + case llvm::Triple::NetBSD: + return std::make_shared<NetBSDSignals>(); default: return std::make_shared<UnixSignals>(); } @@ -97,39 +99,39 @@ UnixSignals::Reset () // order, you can either subclass this class, and use Add & Remove to change them // or you can subclass and build them afresh in your constructor; m_signals.clear(); - // SIGNO NAME SHORT NAME SUPPRESS STOP NOTIFY DESCRIPTION - // ====== ============ ========== ======== ====== ====== =================================================== - AddSignal (1, "SIGHUP", "HUP", false, true , true , "hangup"); - AddSignal (2, "SIGINT", "INT", true , true , true , "interrupt"); - AddSignal (3, "SIGQUIT", "QUIT", false, true , true , "quit"); - AddSignal (4, "SIGILL", "ILL", false, true , true , "illegal instruction"); - AddSignal (5, "SIGTRAP", "TRAP", true , true , true , "trace trap (not reset when caught)"); - AddSignal (6, "SIGABRT", "ABRT", false, true , true , "abort()"); - AddSignal (7, "SIGEMT", "EMT", false, true , true , "pollable event"); - AddSignal (8, "SIGFPE", "FPE", false, true , true , "floating point exception"); - AddSignal (9, "SIGKILL", "KILL", false, true , true , "kill"); - AddSignal (10, "SIGBUS", "BUS", false, true , true , "bus error"); - AddSignal (11, "SIGSEGV", "SEGV", false, true , true , "segmentation violation"); - AddSignal (12, "SIGSYS", "SYS", false, true , true , "bad argument to system call"); - AddSignal (13, "SIGPIPE", "PIPE", false, true , true , "write on a pipe with no one to read it"); - AddSignal (14, "SIGALRM", "ALRM", false, false, false, "alarm clock"); - AddSignal (15, "SIGTERM", "TERM", false, true , true , "software termination signal from kill"); - AddSignal (16, "SIGURG", "URG", false, false, false, "urgent condition on IO channel"); - AddSignal (17, "SIGSTOP", "STOP", true , true , true , "sendable stop signal not from tty"); - AddSignal (18, "SIGTSTP", "TSTP", false, true , true , "stop signal from tty"); - AddSignal (19, "SIGCONT", "CONT", false, true , true , "continue a stopped process"); - AddSignal (20, "SIGCHLD", "CHLD", false, false, false, "to parent on child stop or exit"); - AddSignal (21, "SIGTTIN", "TTIN", false, true , true , "to readers process group upon background tty read"); - AddSignal (22, "SIGTTOU", "TTOU", false, true , true , "to readers process group upon background tty write"); - AddSignal (23, "SIGIO", "IO", false, false, false, "input/output possible signal"); - AddSignal (24, "SIGXCPU", "XCPU", false, true , true , "exceeded CPU time limit"); - AddSignal (25, "SIGXFSZ", "XFSZ", false, true , true , "exceeded file size limit"); - AddSignal (26, "SIGVTALRM", "VTALRM", false, false, false, "virtual time alarm"); - AddSignal (27, "SIGPROF", "PROF", false, false, false, "profiling time alarm"); - AddSignal (28, "SIGWINCH", "WINCH", false, false, false, "window size changes"); - AddSignal (29, "SIGINFO", "INFO", false, true , true , "information request"); - AddSignal (30, "SIGUSR1", "USR1", false, true , true , "user defined signal 1"); - AddSignal (31, "SIGUSR2", "USR2", false, true , true , "user defined signal 2"); + // SIGNO NAME SUPPRESS STOP NOTIFY DESCRIPTION + // ====== ============ ======== ====== ====== =================================================== + AddSignal (1, "SIGHUP", false, true , true , "hangup"); + AddSignal (2, "SIGINT", true , true , true , "interrupt"); + AddSignal (3, "SIGQUIT", false, true , true , "quit"); + AddSignal (4, "SIGILL", false, true , true , "illegal instruction"); + AddSignal (5, "SIGTRAP", true , true , true , "trace trap (not reset when caught)"); + AddSignal (6, "SIGABRT", false, true , true , "abort()"); + AddSignal (7, "SIGEMT", false, true , true , "pollable event"); + AddSignal (8, "SIGFPE", false, true , true , "floating point exception"); + AddSignal (9, "SIGKILL", false, true , true , "kill"); + AddSignal (10, "SIGBUS", false, true , true , "bus error"); + AddSignal (11, "SIGSEGV", false, true , true , "segmentation violation"); + AddSignal (12, "SIGSYS", false, true , true , "bad argument to system call"); + AddSignal (13, "SIGPIPE", false, true , true , "write on a pipe with no one to read it"); + AddSignal (14, "SIGALRM", false, false, false, "alarm clock"); + AddSignal (15, "SIGTERM", false, true , true , "software termination signal from kill"); + AddSignal (16, "SIGURG", false, false, false, "urgent condition on IO channel"); + AddSignal (17, "SIGSTOP", true , true , true , "sendable stop signal not from tty"); + AddSignal (18, "SIGTSTP", false, true , true , "stop signal from tty"); + AddSignal (19, "SIGCONT", false, true , true , "continue a stopped process"); + AddSignal (20, "SIGCHLD", false, false, false, "to parent on child stop or exit"); + AddSignal (21, "SIGTTIN", false, true , true , "to readers process group upon background tty read"); + AddSignal (22, "SIGTTOU", false, true , true , "to readers process group upon background tty write"); + AddSignal (23, "SIGIO", false, false, false, "input/output possible signal"); + AddSignal (24, "SIGXCPU", false, true , true , "exceeded CPU time limit"); + AddSignal (25, "SIGXFSZ", false, true , true , "exceeded file size limit"); + AddSignal (26, "SIGVTALRM", false, false, false, "virtual time alarm"); + AddSignal (27, "SIGPROF", false, false, false, "profiling time alarm"); + AddSignal (28, "SIGWINCH", false, false, false, "window size changes"); + AddSignal (29, "SIGINFO", false, true , true , "information request"); + AddSignal (30, "SIGUSR1", false, true , true , "user defined signal 1"); + AddSignal (31, "SIGUSR2", false, true , true , "user defined signal 2"); } void @@ -137,14 +139,14 @@ UnixSignals::AddSignal ( int signo, const char *name, - const char *short_name, bool default_suppress, bool default_stop, bool default_notify, - const char *description + const char *description, + const char *alias ) { - Signal new_signal (name, short_name, default_suppress, default_stop, default_notify, description); + Signal new_signal (name, default_suppress, default_stop, default_notify, description, alias); m_signals.insert (std::make_pair(signo, new_signal)); } @@ -173,6 +175,16 @@ UnixSignals::SignalIsValid (int32_t signo) const return m_signals.find (signo) != m_signals.end(); } +ConstString +UnixSignals::GetShortName(ConstString name) const +{ + if (name) + { + char* signame = (char*)(name.AsCString()); + return ConstString(signame + 3); // Remove "SIG" from name + } + return name; +} int32_t UnixSignals::GetSignalNumberFromName (const char *name) const @@ -182,7 +194,8 @@ UnixSignals::GetSignalNumberFromName (const char *name) const collection::const_iterator pos, end = m_signals.end (); for (pos = m_signals.begin (); pos != end; pos++) { - if ((const_name == pos->second.m_name) || (const_name == pos->second.m_short_name)) + if ((const_name == pos->second.m_name) || (const_name == pos->second.m_alias) || + (const_name == GetShortName(pos->second.m_name)) || (const_name == GetShortName(pos->second.m_alias))) return pos->first; } |