1 //===-- UnixSignals.h -------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_UnixSignals_h_
11 #define lldb_UnixSignals_h_
18 // Other libraries and framework includes
20 #include "lldb/Core/ConstString.h"
21 #include "lldb/lldb-private.h"
23 namespace lldb_private {
27 static lldb::UnixSignalsSP Create(const ArchSpec &arch);
29 //------------------------------------------------------------------
30 // Constructors and Destructors
31 //------------------------------------------------------------------
34 virtual ~UnixSignals();
36 const char *GetSignalAsCString(int32_t signo) const;
38 bool SignalIsValid(int32_t signo) const;
40 int32_t GetSignalNumberFromName(const char *name) const;
42 const char *GetSignalInfo(int32_t signo, bool &should_suppress,
43 bool &should_stop, bool &should_notify) const;
45 bool GetShouldSuppress(int32_t signo) const;
47 bool SetShouldSuppress(int32_t signo, bool value);
49 bool SetShouldSuppress(const char *signal_name, bool value);
51 bool GetShouldStop(int32_t signo) const;
53 bool SetShouldStop(int32_t signo, bool value);
54 bool SetShouldStop(const char *signal_name, bool value);
56 bool GetShouldNotify(int32_t signo) const;
58 bool SetShouldNotify(int32_t signo, bool value);
60 bool SetShouldNotify(const char *signal_name, bool value);
62 // These provide an iterator through the signals available on this system.
63 // Call GetFirstSignalNumber to get the first entry, then iterate on
64 // GetNextSignalNumber
65 // till you get back LLDB_INVALID_SIGNAL_NUMBER.
66 int32_t GetFirstSignalNumber() const;
68 int32_t GetNextSignalNumber(int32_t current_signal) const;
70 int32_t GetNumSignals() const;
72 int32_t GetSignalAtIndex(int32_t index) const;
74 ConstString GetShortName(ConstString name) const;
76 // We assume that the elements of this object are constant once it is
78 // since a process should never need to add or remove symbols as it runs. So
80 // call these functions anywhere but the constructor of your subclass of
82 // your Process Plugin's GetUnixSignals method before you return the
85 void AddSignal(int signo, const char *name, bool default_suppress,
86 bool default_stop, bool default_notify,
87 const char *description, const char *alias = nullptr);
89 void RemoveSignal(int signo);
92 //------------------------------------------------------------------
93 // Classes that inherit from UnixSignals can see and modify these
94 //------------------------------------------------------------------
99 std::string m_description;
100 bool m_suppress : 1, m_stop : 1, m_notify : 1;
102 Signal(const char *name, bool default_suppress, bool default_stop,
103 bool default_notify, const char *description, const char *alias);
108 virtual void Reset();
110 typedef std::map<int32_t, Signal> collection;
112 collection m_signals;
114 // GDBRemote signals need to be copyable.
115 UnixSignals(const UnixSignals &rhs);
117 const UnixSignals &operator=(const UnixSignals &rhs) = delete;
121 #endif // lldb_UnixSignals_h_