From: Pedro Alves Date: Thu, 17 Jun 2021 15:16:54 +0000 (+0100) Subject: Move scoped_ignore_sigttou to gdbsupport/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=965febe599ab3a5f9fa17a7aaed4dd714f265ecd;p=binutils-gdb.git Move scoped_ignore_sigttou to gdbsupport/ A following patch will want to use scoped_ignore_sigttou in code shared between GDB and GDBserver. Move it under gdbsupport/. Note that despite what inflow.h/inflow.c's first line says, inflow.c is no longer about ptrace, it is about terminal management. Some other files were unnecessarily including inflow.h, I guess a leftover from the days when inflow.c really was about ptrace. Those inclusions are simply dropped. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * Makefile.in (HFILES_NO_SRCDIR): Remove inflow.h. * inf-ptrace.c, inflow.c, procfs.c: Don't include "inflow.h". * inflow.h: Delete, moved to gdbsupport/ under a different name. * ser-unix.c: Don't include "inflow.h". Include "gdbsupport/scoped_ignore_sigttou.h". gdbsupport/ChangeLog: yyyy-mm-dd Pedro Alves * scoped_ignore_sigttou.h: New file, moved from gdb/ and renamed. Change-Id: Ie390abf42c3a78bec6d282ad2a63edd3e623559a --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 497d9f6aee4..63d7cf53b19 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2021-06-17 Pedro Alves + + * Makefile.in (HFILES_NO_SRCDIR): Remove inflow.h. + * inf-ptrace.c, inflow.c, procfs.c: Don't include "inflow.h". + * inflow.h: Delete, moved to gdbsupport/ under a different name. + * ser-unix.c: Don't include "inflow.h". Include + "gdbsupport/scoped_ignore_sigttou.h". + 2021-06-17 Pedro Alves * tui/tui-io.c (tui_dispatch_mouse_event): New, factored out from diff --git a/gdb/Makefile.in b/gdb/Makefile.in index b3d264f267c..881ebde8fb0 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1336,7 +1336,6 @@ HFILES_NO_SRCDIR = \ inf-ptrace.h \ infcall.h \ inferior.h \ - inflow.h \ inline-frame.h \ interps.h \ jit.h \ diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index b6fa71fd2c0..afa38de6ef7 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -20,7 +20,6 @@ #include "defs.h" #include "command.h" #include "inferior.h" -#include "inflow.h" #include "terminal.h" #include "gdbcore.h" #include "regcache.h" diff --git a/gdb/inflow.c b/gdb/inflow.c index d241540c4cd..f9917d6a81c 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -29,12 +29,12 @@ #include #include "gdbsupport/gdb_select.h" -#include "inflow.h" #include "gdbcmd.h" #ifdef HAVE_TERMIOS_H #include #endif #include "gdbsupport/job-control.h" +#include "gdbsupport/scoped_ignore_sigttou.h" #ifdef HAVE_SYS_IOCTL_H #include diff --git a/gdb/inflow.h b/gdb/inflow.h deleted file mode 100644 index 8a671c7c4c7..00000000000 --- a/gdb/inflow.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Low level interface to ptrace, for GDB when running under Unix. - - Copyright (C) 2003-2021 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef INFLOW_H -#define INFLOW_H - -#include -#include -#include "gdbsupport/job-control.h" - -/* RAII class used to ignore SIGTTOU in a scope. */ - -class scoped_ignore_sigttou -{ -public: - scoped_ignore_sigttou () - { -#ifdef SIGTTOU - if (job_control) - m_osigttou = signal (SIGTTOU, SIG_IGN); -#endif - } - - ~scoped_ignore_sigttou () - { -#ifdef SIGTTOU - if (job_control) - signal (SIGTTOU, m_osigttou); -#endif - } - - DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou); - -private: -#ifdef SIGTTOU - sighandler_t m_osigttou = NULL; -#endif -}; - -#endif /* inflow.h */ diff --git a/gdb/procfs.c b/gdb/procfs.c index 23c0aa22a7a..529ee33df90 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -40,7 +40,6 @@ #include #include #include "gdb_bfd.h" -#include "inflow.h" #include "auxv.h" #include "procfs.h" #include "observable.h" diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index e97dc2f925d..96d024eea3d 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -32,7 +32,7 @@ #include "gdbcmd.h" #include "gdbsupport/filestuff.h" #include -#include "inflow.h" +#include "gdbsupport/scoped_ignore_sigttou.h" struct hardwire_ttystate { diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog index b790a972300..ac424f3ae7f 100644 --- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,7 @@ +2021-06-17 Pedro Alves + + * scoped_ignore_sigttou.h: New file, moved from gdb/ and renamed. + 2021-05-17 Andrew Burgess * .dir-locals.el: Set sentence-end-double-space for all modes, and diff --git a/gdbsupport/scoped_ignore_sigttou.h b/gdbsupport/scoped_ignore_sigttou.h new file mode 100644 index 00000000000..a31316460b4 --- /dev/null +++ b/gdbsupport/scoped_ignore_sigttou.h @@ -0,0 +1,56 @@ +/* Support for signoring SIGTTOU. + + Copyright (C) 2003-2021 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef SCOPED_IGNORE_SIGTTOU_H +#define SCOPED_IGNORE_SIGTTOU_H + +#include +#include +#include "gdbsupport/job-control.h" + +/* RAII class used to ignore SIGTTOU in a scope. */ + +class scoped_ignore_sigttou +{ +public: + scoped_ignore_sigttou () + { +#ifdef SIGTTOU + if (job_control) + m_osigttou = signal (SIGTTOU, SIG_IGN); +#endif + } + + ~scoped_ignore_sigttou () + { +#ifdef SIGTTOU + if (job_control) + signal (SIGTTOU, m_osigttou); +#endif + } + + DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou); + +private: +#ifdef SIGTTOU + sighandler_t m_osigttou = NULL; +#endif +}; + +#endif /* SCOPED_IGNORE_SIGTTOU_H */