ld: =fillexp different behaviors for hexidecimal literal
[binutils-gdb.git] / gdbsupport / block-signals.h
blobfe0900bb30d1b4b6f42bb24081524a5e82699bb3
1 /* Block signals used by gdb
3 Copyright (C) 2019-2023 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
23 #include <signal.h>
25 #include "gdbsupport/gdb-sigmask.h"
27 namespace gdb
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. */
33 class block_signals
35 public:
36 block_signals ()
38 #ifdef HAVE_SIGPROCMASK
39 sigset_t mask;
40 sigemptyset (&mask);
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);
47 #endif
50 ~block_signals ()
52 #ifdef HAVE_SIGPROCMASK
53 gdb_sigmask (SIG_SETMASK, &m_old_mask, nullptr);
54 #endif
57 DISABLE_COPY_AND_ASSIGN (block_signals);
59 private:
61 #ifdef HAVE_SIGPROCMASK
62 sigset_t m_old_mask;
63 #endif
68 #endif /* GDBSUPPORT_BLOCK_SIGNALS_H */