1 /* Block signals used by gdb
3 Copyright (C) 2019-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef GDBSUPPORT_BLOCK_SIGNALS_H
21 #define GDBSUPPORT_BLOCK_SIGNALS_H
25 #include "gdbsupport/gdb-sigmask.h"
30 /* This is an RAII class that temporarily blocks the signals needed by
31 gdb. This can be used before starting a new thread to ensure that
32 this thread starts with the appropriate signals blocked. */
38 #ifdef HAVE_SIGPROCMASK
41 sigaddset (&mask
, SIGINT
);
42 sigaddset (&mask
, SIGCHLD
);
43 sigaddset (&mask
, SIGALRM
);
44 sigaddset (&mask
, SIGWINCH
);
45 sigaddset (&mask
, SIGTERM
);
46 gdb_sigmask (SIG_BLOCK
, &mask
, &m_old_mask
);
52 #ifdef HAVE_SIGPROCMASK
53 gdb_sigmask (SIG_SETMASK
, &m_old_mask
, nullptr);
57 DISABLE_COPY_AND_ASSIGN (block_signals
);
61 #ifdef HAVE_SIGPROCMASK
68 #endif /* GDBSUPPORT_BLOCK_SIGNALS_H */