summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog52
-rw-r--r--gdb/Makefile.in10
-rw-r--r--gdb/common/gdb_termios.h78
-rw-r--r--gdb/common/job-control.c23
-rwxr-xr-xgdb/configure3
-rw-r--r--gdb/configure.ac3
-rwxr-xr-xgdb/gdbserver/configure2
-rw-r--r--gdb/gdbserver/configure.ac2
-rw-r--r--gdb/gdbserver/remote-utils.c33
-rw-r--r--gdb/inflow.c88
-rw-r--r--gdb/inflow.h12
-rw-r--r--gdb/ser-base.c8
-rw-r--r--gdb/ser-base.h3
-rw-r--r--gdb/ser-event.c1
-rw-r--r--gdb/ser-go32.c12
-rw-r--r--gdb/ser-mingw.c4
-rw-r--r--gdb/ser-pipe.c1
-rw-r--r--gdb/ser-tcp.c1
-rw-r--r--gdb/ser-unix.c264
-rw-r--r--gdb/serial.c8
-rw-r--r--gdb/serial.h12
-rw-r--r--gdb/testsuite/ChangeLog8
22 files changed, 104 insertions, 524 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 58cb4eb1346..ba45ff42395 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,55 @@
+2017-11-06 Pedro Alves <palves@redhat.com>
+
+ * Makefile.in (SER_HARDWIRE): Update comment.
+ (HFILES_NO_SRCDIR): Remove gdb_termios.h.
+ * common/gdb_termios.h: Delete file.
+ * common/job-control.c: Include termios.h and unistd.h instead of
+ gdb_termios.h.
+ (gdb_setpgid): Remove HAVE_TERMIOS || TIOCGPGRP preprocessor
+ check.
+ (have_job_control): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
+ Remove sgtty code.
+ * configure.ac: No longer check for termio.h and sgtty.h.
+ * configure: Regenerate.
+ * inflow.c: Include termios.h instead of gdb_termios.h. Replace
+ PROCESS_GROUP_TYPE checks with HAVE_TERMIOS_H checks throughout.
+ Replace PROCESS_GROUP_TYPE references with pid_t references
+ throughout.
+ (gdb_getpgrp): Delete.
+ (set_initial_gdb_ttystate): Use tcgetpgrp instead of gdb_getpgrp.
+ (child_terminal_inferior): Remove comment. Remove sgtty code.
+ (child_terminal_ours_1): Use tcgetpgrp directly instead of
+ gdb_getpgrp. Use serial_set_tty_state instead aof
+ serial_noflush_set_tty_state. Remove sgtty code.
+ * inflow.h: Include unistd.h instead of gdb_termios.h. Replace
+ PROCESS_GROUP_TYPE check with HAVE_TERMIOS_H check.
+ (inferior_process_group): Now returns pid_t.
+ * ser-base.c (ser_base_noflush_set_tty_state): Delete.
+ * ser-base.h (ser_base_noflush_set_tty_state): Delete.
+ * ser-event.c (serial_event_ops): Update.
+ * ser-go32.c (dos_noflush_set_tty_state): Delete.
+ (dos_ops): Update.
+ * ser-mingw.c (hardwire_ops, tty_ops, pipe_ops, tcp_ops): Update.
+ * ser-pipe.c (pipe_ops): Update.
+ * ser-tcp.c (tcp_ops): Update.
+ * ser-unix.c: Include termios.h instead of gdb_termios.h. Remove
+ HAVE_TERMIOS checks.
+ [HAVE_TERMIO] (struct hardwire_ttystate): Delete.
+ [HAVE_SGTTY] (struct hardwire_ttystate): Delete.
+ (get_tty_state, set_tty_state): Drop termio and sgtty code, and
+ assume termios.
+ (hardwire_noflush_set_tty_state): Delete.
+ (hardwire_print_tty_state, hardwire_drain_output)
+ (hardwire_flush_output, hardwire_flush_input)
+ (hardwire_send_break, hardwire_raw, hardwire_setbaudrate)
+ (hardwire_setstopbits, hardwire_setparity): Drop termio and sgtty
+ code, and assume termios.
+ (hardwire_ops): Update.
+ (_initialize_ser_hardwire): Remove HAVE_TERMIOS check.
+ * serial.c (serial_noflush_set_tty_state): Delete.
+ * serial.h (serial_noflush_set_tty_state): Delete.
+ (serial_ops::noflush_set_tty_state): Delete.
+
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* Makefile.in (SFILES): Remove doublest.c and dfp.c.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 84d3493efaf..6fe9b38acbd 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -729,12 +729,9 @@ XMLFILES = \
$(srcdir)/features/traceframe-info.dtd \
$(srcdir)/features/xinclude.dtd
-# This is ser-unix.o for any system which supports a v7/BSD/SYSV/POSIX
-# interface to the serial port. Hopefully if get ported to OS/2, VMS,
-# etc., then there will be (as part of the C library or perhaps as
-# part of libiberty) a POSIX interface. But at least for now the
-# host-dependent makefile fragment might need to use something else
-# besides ser-unix.o
+# Build the ser-*.o files the host supports. This includes ser-unix.o
+# for any system that supports a POSIX interface to the serial port.
+# See configure.ac.
SER_HARDWIRE = @SER_HARDWIRE@
# The `remote' debugging target is supported for most architectures,
@@ -1539,7 +1536,6 @@ HFILES_NO_SRCDIR = \
common/gdb_setjmp.h \
common/gdb_signals.h \
common/gdb_sys_time.h \
- common/gdb_termios.h \
common/gdb_vecs.h \
common/gdb_wait.h \
common/common-inferior.h \
diff --git a/gdb/common/gdb_termios.h b/gdb/common/gdb_termios.h
deleted file mode 100644
index 1d0544d74f3..00000000000
--- a/gdb/common/gdb_termios.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Common terminal interface definitions for GDB and gdbserver.
- Copyright (C) 1986-2017 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef GDB_TERMIOS_H
-#define GDB_TERMIOS_H
-
-/* If we're using autoconf, it will define HAVE_TERMIOS_H,
- HAVE_TERMIO_H and HAVE_SGTTY_H for us. One day we can rewrite
- ser-unix.c and inflow.c to inspect those names instead of
- HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither
- HAVE_TERMIOS or HAVE_TERMIO is set). Until then, make sure that
- nothing has already defined the one of the names, and do the right
- thing. */
-
-#if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY)
-#if defined(HAVE_TERMIOS_H)
-#define HAVE_TERMIOS
-#else /* ! defined (HAVE_TERMIOS_H) */
-#if defined(HAVE_TERMIO_H)
-#define HAVE_TERMIO
-#else /* ! defined (HAVE_TERMIO_H) */
-#if defined(HAVE_SGTTY_H)
-#define HAVE_SGTTY
-#endif /* ! defined (HAVE_SGTTY_H) */
-#endif /* ! defined (HAVE_TERMIO_H) */
-#endif /* ! defined (HAVE_TERMIOS_H) */
-#endif /* !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) &&
- !defined (HAVE_SGTTY) */
-
-#if defined(HAVE_TERMIOS)
-#include <termios.h>
-#endif
-
-#if !defined(_WIN32) && !defined (HAVE_TERMIOS)
-
-/* Define a common set of macros -- BSD based -- and redefine whatever
- the system offers to make it look like that. FIXME: serial.h and
- ser-*.c deal with this in a much cleaner fashion; as soon as stuff
- is converted to use them, can get rid of this crap. */
-
-#ifdef HAVE_TERMIO
-
-#include <termio.h>
-
-#undef TIOCGETP
-#define TIOCGETP TCGETA
-#undef TIOCSETN
-#define TIOCSETN TCSETA
-#undef TIOCSETP
-#define TIOCSETP TCSETAF
-#define TERMINAL struct termio
-
-#else /* sgtty */
-
-#include <fcntl.h>
-#include <sgtty.h>
-#include <sys/ioctl.h>
-#define TERMINAL struct sgttyb
-
-#endif /* sgtty */
-#endif
-
-#endif /* ! GDB_TERMIOS_H */
diff --git a/gdb/common/job-control.c b/gdb/common/job-control.c
index d76bc57313e..78fc672f2c6 100644
--- a/gdb/common/job-control.c
+++ b/gdb/common/job-control.c
@@ -20,7 +20,10 @@
#include "common-defs.h"
#include "job-control.h"
-#include "gdb_termios.h"
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#endif
+#include <unistd.h>
/* Nonzero if we have job control. */
int job_control;
@@ -41,7 +44,6 @@ gdb_setpgid ()
if (job_control)
{
-#if defined (HAVE_TERMIOS) || defined (TIOCGPGRP)
#ifdef HAVE_SETPGID
/* The call setpgid (0, 0) is supposed to work and mean the same
thing as this, but on Ultrix 4.2A it fails with EPERM (and
@@ -56,7 +58,6 @@ gdb_setpgid ()
#endif
#endif /* HAVE_SETPGRP */
#endif /* HAVE_SETPGID */
-#endif /* defined (HAVE_TERMIOS) || defined (TIOCGPGRP) */
}
return retval;
@@ -67,9 +68,9 @@ gdb_setpgid ()
void
have_job_control ()
{
- /* OK, figure out whether we have job control. If neither termios nor
- sgtty (i.e. termio or go32), leave job_control 0. */
-#if defined (HAVE_TERMIOS)
+ /* OK, figure out whether we have job control. If termios is not
+ available, leave job_control 0. */
+#if defined (HAVE_TERMIOS_H)
/* Do all systems with termios have the POSIX way of identifying job
control? I hope so. */
#ifdef _POSIX_JOB_CONTROL
@@ -81,13 +82,5 @@ have_job_control ()
job_control = 0; /* Have to assume the worst. */
#endif /* _SC_JOB_CONTROL */
#endif /* _POSIX_JOB_CONTROL */
-#endif /* HAVE_TERMIOS */
-
-#ifdef HAVE_SGTTY
-#ifdef TIOCGPGRP
- job_control = 1;
-#else
- job_control = 0;
-#endif /* TIOCGPGRP */
-#endif /* sgtty */
+#endif /* HAVE_TERMIOS_H */
}
diff --git a/gdb/configure b/gdb/configure
index 6b445e4f675..c638652416a 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -11554,8 +11554,7 @@ for ac_header in nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
- termios.h termio.h \
- sgtty.h elf_hp.h \
+ termios.h elf_hp.h \
dlfcn.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 4e64c80f62c..b909217c77d 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1298,8 +1298,7 @@ AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
- termios.h termio.h \
- sgtty.h elf_hp.h \
+ termios.h elf_hp.h \
dlfcn.h])
AC_CHECK_HEADERS(sys/proc.h, [], [],
[#if HAVE_SYS_PARAM_H
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index abab16385ab..d5c62fbbd34 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -6177,7 +6177,7 @@ $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cach
cd "$ac_popdir"
-for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h linux/elf.h fcntl.h signal.h sys/file.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h
+for ac_header in termios.h sys/reg.h string.h proc_service.h sys/procfs.h linux/elf.h fcntl.h signal.h sys/file.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 60e235d6e36..456d3b360ab 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -96,7 +96,7 @@ ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"],
ACX_CONFIGURE_DIR(["../../libiberty"], ["build-libiberty-gdbserver"])
-AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
+AC_CHECK_HEADERS(termios.h sys/reg.h string.h dnl
proc_service.h sys/procfs.h linux/elf.h dnl
fcntl.h signal.h sys/file.h dnl
sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 66e065225b1..54f27f40ea8 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -17,7 +17,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
-#include "gdb_termios.h"
+#if HAVE_TERMIOS_H
+#include <termios.h>
+#endif
#include "target.h"
#include "gdbthread.h"
#include "tdesc.h"
@@ -325,7 +327,7 @@ remote_open (const char *name)
if (remote_desc < 0)
perror_with_name ("Could not open remote device");
-#ifdef HAVE_TERMIOS
+#if HAVE_TERMIOS_H
{
struct termios termios;
tcgetattr (remote_desc, &termios);
@@ -342,33 +344,6 @@ remote_open (const char *name)
}
#endif
-#ifdef HAVE_TERMIO
- {
- struct termio termio;
- ioctl (remote_desc, TCGETA, &termio);
-
- termio.c_iflag = 0;
- termio.c_oflag = 0;
- termio.c_lflag = 0;
- termio.c_cflag &= ~(CSIZE | PARENB);
- termio.c_cflag |= CLOCAL | CS8;
- termio.c_cc[VMIN] = 1;
- termio.c_cc[VTIME] = 0;
-
- ioctl (remote_desc, TCSETA, &termio);
- }
-#endif
-
-#ifdef HAVE_SGTTY
- {
- struct sgttyb sg;
-
- ioctl (remote_desc, TIOCGETP, &sg);
- sg.sg_flags = RAW;
- ioctl (remote_desc, TIOCSETP, &sg);
- }
-#endif
-
fprintf (stderr, "Remote debugging using %s\n", name);
enable_async_notification (remote_desc);
diff --git a/gdb/inflow.c b/gdb/inflow.c
index d54b8f83454..a96d4fc4a51 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -31,7 +31,9 @@
#include "inflow.h"
#include "gdbcmd.h"
-#include "gdb_termios.h"
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#endif
#include "job-control.h"
#ifdef HAVE_SYS_IOCTL_H
@@ -64,9 +66,9 @@ struct terminal_info
it when it resumes. */
serial_ttystate ttystate;
-#ifdef PROCESS_GROUP_TYPE
+#ifdef HAVE_TERMIOS_H
/* Process group. Saved and restored just like ttystate. */
- PROCESS_GROUP_TYPE process_group;
+ pid_t process_group;
#endif
/* fcntl flags. Saved and restored just like ttystate. */
@@ -89,11 +91,11 @@ static serial_ttystate initial_gdb_ttystate;
static struct terminal_info *get_inflow_inferior_data (struct inferior *);
-#ifdef PROCESS_GROUP_TYPE
+#ifdef HAVE_TERMIOS_H
/* Return the process group of the current inferior. */
-PROCESS_GROUP_TYPE
+pid_t
inferior_process_group (void)
{
return get_inflow_inferior_data (current_inferior ())->process_group;
@@ -121,25 +123,6 @@ static const char *inferior_thisrun_terminal;
int terminal_is_ours;
-#ifdef PROCESS_GROUP_TYPE
-static PROCESS_GROUP_TYPE
-gdb_getpgrp (void)
-{
- int process_group = -1;
-
-#ifdef HAVE_TERMIOS
- process_group = tcgetpgrp (0);
-#endif
-#ifdef HAVE_TERMIO
- process_group = getpgrp ();
-#endif
-#ifdef HAVE_SGTTY
- ioctl (0, TIOCGPGRP, &process_group);
-#endif
- return process_group;
-}
-#endif
-
/* See terminal.h. */
void
@@ -157,8 +140,8 @@ set_initial_gdb_ttystate (void)
#ifdef F_GETFL
our_terminal_info.tflags = fcntl (0, F_GETFL, 0);
#endif
-#ifdef PROCESS_GROUP_TYPE
- our_terminal_info.process_group = gdb_getpgrp ();
+#ifdef HAVE_TERMIOS_H
+ our_terminal_info.process_group = tcgetpgrp (0);
#endif
}
}
@@ -187,7 +170,7 @@ child_terminal_init_with_pgrp (int pgrp)
struct inferior *inf = current_inferior ();
struct terminal_info *tinfo = get_inflow_inferior_data (inf);
-#ifdef PROCESS_GROUP_TYPE
+#ifdef HAVE_TERMIOS_H
/* Store the process group even without a terminal as it is used not
only to reset the tty foreground process group, but also to
interrupt the inferior. */
@@ -224,7 +207,7 @@ gdb_save_tty_state (void)
void
child_terminal_init (struct target_ops *self)
{
-#ifdef PROCESS_GROUP_TYPE
+#ifdef HAVE_TERMIOS_H
/* This is for Lynx, and should be cleaned up by having Lynx be a
separate debugging target with a version of target_terminal::init
which passes in the process group to a generic routine which does
@@ -232,7 +215,7 @@ child_terminal_init (struct target_ops *self)
pass in inferior_ptid to the same routine). */
/* We assume INFERIOR_PID is also the child's process group. */
child_terminal_init_with_pgrp (ptid_get_pid (inferior_ptid));
-#endif /* PROCESS_GROUP_TYPE */
+#endif /* HAVE_TERMIOS_H */
}
/* Put the inferior's terminal settings into effect.
@@ -269,11 +252,7 @@ child_terminal_inferior (struct target_ops *self)
OOPSY ("fcntl F_SETFL");
#endif
- /* Because we were careful to not change in or out of raw mode in
- terminal_ours, we will not change in our out of raw mode with
- this call, so we don't flush any input. */
- result = serial_set_tty_state (stdin_serial,
- tinfo->ttystate);
+ result = serial_set_tty_state (stdin_serial, tinfo->ttystate);
OOPSY ("setting tty state");
if (!job_control)
@@ -298,19 +277,12 @@ child_terminal_inferior (struct target_ops *self)
if (job_control)
{
-#ifdef HAVE_TERMIOS
+#ifdef HAVE_TERMIOS_H
result = tcsetpgrp (0, tinfo->process_group);
if (!inf->attach_flag)
OOPSY ("tcsetpgrp");
#endif
-
-#ifdef HAVE_SGTTY
- result = ioctl (0, TIOCSPGRP, &tinfo->process_group);
- if (!inf->attach_flag)
- OOPSY ("TIOCSPGRP");
-#endif
}
-
}
terminal_is_ours = 0;
}
@@ -388,34 +360,20 @@ child_terminal_ours_1 (int output_only)
xfree (tinfo->ttystate);
tinfo->ttystate = serial_get_tty_state (stdin_serial);
-#ifdef PROCESS_GROUP_TYPE
+#ifdef HAVE_TERMIOS_H
if (!inf->attach_flag)
- /* If setpgrp failed in terminal_inferior, this would give us
+ /* If tcsetpgrp failed in terminal_inferior, this would give us
our process group instead of the inferior's. See
terminal_inferior for details. */
- tinfo->process_group = gdb_getpgrp ();
+ tinfo->process_group = tcgetpgrp (0);
#endif
- /* Here we used to set ICANON in our ttystate, but I believe this
- was an artifact from before when we used readline. Readline sets
- the tty state when it needs to.
- FIXME-maybe: However, query() expects non-raw mode and doesn't
- use readline. Maybe query should use readline (on the other hand,
- this only matters for HAVE_SGTTY, not termio or termios, I think). */
-
- /* Set tty state to our_ttystate. We don't change in our out of raw
- mode, to avoid flushing input. We need to do the same thing
- regardless of output_only, because we don't have separate
- terminal_is_ours and terminal_is_ours_for_output flags. It's OK,
- though, since readline will deal with raw mode when/if it needs
- to. */
-
- serial_noflush_set_tty_state (stdin_serial, our_terminal_info.ttystate,
- tinfo->ttystate);
+ /* Set tty state to our_ttystate. */
+ serial_set_tty_state (stdin_serial, our_terminal_info.ttystate);
if (job_control)
{
-#ifdef HAVE_TERMIOS
+#ifdef HAVE_TERMIOS_H
result = tcsetpgrp (0, our_terminal_info.process_group);
#if 0
/* This fails on Ultrix with EINVAL if you run the testsuite
@@ -428,10 +386,6 @@ child_terminal_ours_1 (int output_only)
safe_strerror (errno));
#endif
#endif /* termios */
-
-#ifdef HAVE_SGTTY
- result = ioctl (0, TIOCSPGRP, &our_terminal_info.process_group);
-#endif
}
#ifdef SIGTTOU
@@ -616,7 +570,7 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty)
printf_filtered ("\n");
}
-#ifdef PROCESS_GROUP_TYPE
+#ifdef HAVE_TERMIOS_H
printf_filtered ("Process group = %d\n", (int) tinfo->process_group);
#endif
diff --git a/gdb/inflow.h b/gdb/inflow.h
index 428aed41b1a..0b00c61745f 100644
--- a/gdb/inflow.h
+++ b/gdb/inflow.h
@@ -20,17 +20,11 @@
#ifndef INFLOW_H
#define INFLOW_H
-#include "gdb_termios.h"
+#include <unistd.h>
-#ifdef HAVE_TERMIOS
-# define PROCESS_GROUP_TYPE pid_t
-#elif defined (HAVE_TERMIO) || defined (HAVE_SGTTY)
-# define PROCESS_GROUP_TYPE int
-#endif
-
-#ifdef PROCESS_GROUP_TYPE
/* Process group of the current inferior. */
-extern PROCESS_GROUP_TYPE inferior_process_group (void);
+#ifdef HAVE_TERMIOS_H
+extern pid_t inferior_process_group (void);
#endif
#endif /* inflow.h */
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 2bfe82b22fb..3262dcc4abf 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -551,14 +551,6 @@ ser_base_set_tty_state (struct serial *scb, serial_ttystate ttystate)
return 0;
}
-int
-ser_base_noflush_set_tty_state (struct serial *scb,
- serial_ttystate new_ttystate,
- serial_ttystate old_ttystate)
-{
- return 0;
-}
-
void
ser_base_print_tty_state (struct serial *scb,
serial_ttystate ttystate,
diff --git a/gdb/ser-base.h b/gdb/ser-base.h
index 964d640587a..ceeb7de8760 100644
--- a/gdb/ser-base.h
+++ b/gdb/ser-base.h
@@ -40,9 +40,6 @@ extern int ser_base_set_tty_state (struct serial *scb,
extern void ser_base_print_tty_state (struct serial *scb,
serial_ttystate ttystate,
struct ui_file *stream);
-extern int ser_base_noflush_set_tty_state (struct serial *scb,
- serial_ttystate new_ttystate,
- serial_ttystate old_ttystate);
extern int ser_base_setbaudrate (struct serial *scb, int rate);
extern int ser_base_setstopbits (struct serial *scb, int num);
extern int ser_base_setparity (struct serial *scb, int parity);
diff --git a/gdb/ser-event.c b/gdb/ser-event.c
index 08b56a3174c..8b88ca0b601 100644
--- a/gdb/ser-event.c
+++ b/gdb/ser-event.c
@@ -144,7 +144,6 @@ static const struct serial_ops serial_event_ops =
NULL, /* copy_tty_state */
NULL, /* set_tty_state */
NULL, /* print_tty_state */
- NULL, /* noflush_set_tty_state */
NULL, /* setbaudrate */
NULL, /* setstopbits */
NULL, /* setparity */
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index e3528951b4b..6965f19a805 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -689,17 +689,6 @@ dos_set_tty_state (struct serial *scb, serial_ttystate ttystate)
}
static int
-dos_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate,
- serial_ttystate old_ttystate)
-{
- struct dos_ttystate *state;
-
- state = (struct dos_ttystate *) new_ttystate;
- dos_setbaudrate (scb, state->baudrate);
- return 0;
-}
-
-static int
dos_flush_input (struct serial *scb)
{
struct dos_ttystate *port = &ports[scb->fd];
@@ -882,7 +871,6 @@ static const struct serial_ops dos_ops =
dos_copy_tty_state,
dos_set_tty_state,
dos_print_tty_state,
- dos_noflush_set_tty_state,
dos_setbaudrate,
dos_setstopbits,
dos_setparity,
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 33e4df3b219..2359a4953c8 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -1248,7 +1248,6 @@ static const struct serial_ops hardwire_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_windows_setbaudrate,
ser_windows_setstopbits,
ser_windows_setparity,
@@ -1279,7 +1278,6 @@ static const struct serial_ops tty_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
NULL,
NULL,
NULL,
@@ -1310,7 +1308,6 @@ static const struct serial_ops pipe_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
@@ -1341,7 +1338,6 @@ static const struct serial_ops tcp_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index cb94242745a..56a91fccc8e 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -219,7 +219,6 @@ static const struct serial_ops pipe_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 7ff588b09d5..cc6de300bfa 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -399,7 +399,6 @@ static const struct serial_ops tcp_ops =
ser_base_copy_tty_state,
ser_base_set_tty_state,
ser_base_print_tty_state,
- ser_base_noflush_set_tty_state,
ser_base_setbaudrate,
ser_base_setstopbits,
ser_base_setparity,
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 53c33e663f0..3cbb77fb98d 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -31,9 +31,7 @@
#include "gdb_select.h"
#include "gdbcmd.h"
#include "filestuff.h"
-#include "gdb_termios.h"
-
-#ifdef HAVE_TERMIOS
+#include <termios.h>
struct hardwire_ttystate
{
@@ -51,32 +49,6 @@ show_serial_hwflow (struct ui_file *file, int from_tty,
}
#endif
-#endif /* termios */
-
-#ifdef HAVE_TERMIO
-
-/* It is believed that all systems which have added job control to SVR3
- (e.g. sco) have also added termios. Even if not, trying to figure out
- all the variations (TIOCGPGRP vs. TCGETPGRP, etc.) would be pretty
- bewildering. So we don't attempt it. */
-
-struct hardwire_ttystate
- {
- struct termio termio;
- };
-#endif /* termio */
-
-#ifdef HAVE_SGTTY
-struct hardwire_ttystate
- {
- struct sgttyb sgttyb;
- struct tchars tc;
- struct ltchars ltc;
- /* Line discipline flags. */
- int lmode;
- };
-#endif /* sgtty */
-
static int hardwire_open (struct serial *scb, const char *name);
static void hardwire_raw (struct serial *scb);
static int rate_to_code (int rate);
@@ -89,8 +61,6 @@ static int set_tty_state (struct serial *scb,
struct hardwire_ttystate * state);
static serial_ttystate hardwire_get_tty_state (struct serial *scb);
static int hardwire_set_tty_state (struct serial *scb, serial_ttystate state);
-static int hardwire_noflush_set_tty_state (struct serial *, serial_ttystate,
- serial_ttystate);
static void hardwire_print_tty_state (struct serial *, serial_ttystate,
struct ui_file *);
static int hardwire_drain_output (struct serial *);
@@ -114,61 +84,19 @@ hardwire_open (struct serial *scb, const char *name)
static int
get_tty_state (struct serial *scb, struct hardwire_ttystate *state)
{
-#ifdef HAVE_TERMIOS
if (tcgetattr (scb->fd, &state->termios) < 0)
return -1;
return 0;
-#endif
-
-#ifdef HAVE_TERMIO
- if (ioctl (scb->fd, TCGETA, &state->termio) < 0)
- return -1;
- return 0;
-#endif
-
-#ifdef HAVE_SGTTY
- if (ioctl (scb->fd, TIOCGETP, &state->sgttyb) < 0)
- return -1;
- if (ioctl (scb->fd, TIOCGETC, &state->tc) < 0)
- return -1;
- if (ioctl (scb->fd, TIOCGLTC, &state->ltc) < 0)
- return -1;
- if (ioctl (scb->fd, TIOCLGET, &state->lmode) < 0)
- return -1;
-
- return 0;
-#endif
}
static int
set_tty_state (struct serial *scb, struct hardwire_ttystate *state)
{
-#ifdef HAVE_TERMIOS
if (tcsetattr (scb->fd, TCSANOW, &state->termios) < 0)
return -1;
return 0;
-#endif
-
-#ifdef HAVE_TERMIO
- if (ioctl (scb->fd, TCSETA, &state->termio) < 0)
- return -1;
- return 0;
-#endif
-
-#ifdef HAVE_SGTTY
- if (ioctl (scb->fd, TIOCSETN, &state->sgttyb) < 0)
- return -1;
- if (ioctl (scb->fd, TIOCSETC, &state->tc) < 0)
- return -1;
- if (ioctl (scb->fd, TIOCSLTC, &state->ltc) < 0)
- return -1;
- if (ioctl (scb->fd, TIOCLSET, &state->lmode) < 0)
- return -1;
-
- return 0;
-#endif
}
static serial_ttystate
@@ -205,39 +133,6 @@ hardwire_set_tty_state (struct serial *scb, serial_ttystate ttystate)
return set_tty_state (scb, state);
}
-static int
-hardwire_noflush_set_tty_state (struct serial *scb,
- serial_ttystate new_ttystate,
- serial_ttystate old_ttystate)
-{
- struct hardwire_ttystate new_state;
-#ifdef HAVE_SGTTY
- struct hardwire_ttystate *state = (struct hardwire_ttystate *) old_ttystate;
-#endif
-
- new_state = *(struct hardwire_ttystate *) new_ttystate;
-
- /* Don't change in or out of raw mode; we don't want to flush input.
- termio and termios have no such restriction; for them flushing input
- is separate from setting the attributes. */
-
-#ifdef HAVE_SGTTY
- if (state->sgttyb.sg_flags & RAW)
- new_state.sgttyb.sg_flags |= RAW;
- else
- new_state.sgttyb.sg_flags &= ~RAW;
-
- /* I'm not sure whether this is necessary; the manpage just mentions
- RAW not CBREAK. */
- if (state->sgttyb.sg_flags & CBREAK)
- new_state.sgttyb.sg_flags |= CBREAK;
- else
- new_state.sgttyb.sg_flags &= ~CBREAK;
-#endif
-
- return set_tty_state (scb, &new_state);
-}
-
static void
hardwire_print_tty_state (struct serial *scb,
serial_ttystate ttystate,
@@ -246,7 +141,6 @@ hardwire_print_tty_state (struct serial *scb,
struct hardwire_ttystate *state = (struct hardwire_ttystate *) ttystate;
int i;
-#ifdef HAVE_TERMIOS
fprintf_filtered (stream, "c_iflag = 0x%x, c_oflag = 0x%x,\n",
(int) state->termios.c_iflag,
(int) state->termios.c_oflag);
@@ -262,36 +156,6 @@ hardwire_print_tty_state (struct serial *scb,
for (i = 0; i < NCCS; i += 1)
fprintf_filtered (stream, "0x%x ", state->termios.c_cc[i]);
fprintf_filtered (stream, "\n");
-#endif
-
-#ifdef HAVE_TERMIO
- fprintf_filtered (stream, "c_iflag = 0x%x, c_oflag = 0x%x,\n",
- state->termio.c_iflag, state->termio.c_oflag);
- fprintf_filtered (stream, "c_cflag = 0x%x, c_lflag = 0x%x, c_line = 0x%x.\n",
- state->termio.c_cflag, state->termio.c_lflag,
- state->termio.c_line);
- fprintf_filtered (stream, "c_cc: ");
- for (i = 0; i < NCC; i += 1)
- fprintf_filtered (stream, "0x%x ", state->termio.c_cc[i]);
- fprintf_filtered (stream, "\n");
-#endif
-
-#ifdef HAVE_SGTTY
- fprintf_filtered (stream, "sgttyb.sg_flags = 0x%x.\n",
- state->sgttyb.sg_flags);
-
- fprintf_filtered (stream, "tchars: ");
- for (i = 0; i < (int) sizeof (struct tchars); i++)
- fprintf_filtered (stream, "0x%x ", ((unsigned char *) &state->tc)[i]);
- fprintf_filtered (stream, "\n");
-
- fprintf_filtered (stream, "ltchars: ");
- for (i = 0; i < (int) sizeof (struct ltchars); i++)
- fprintf_filtered (stream, "0x%x ", ((unsigned char *) &state->ltc)[i]);
- fprintf_filtered (stream, "\n");
-
- fprintf_filtered (stream, "lmode: 0x%x\n", state->lmode);
-#endif
}
/* Wait for the output to drain away, as opposed to flushing
@@ -300,48 +164,13 @@ hardwire_print_tty_state (struct serial *scb,
static int
hardwire_drain_output (struct serial *scb)
{
-#ifdef HAVE_TERMIOS
return tcdrain (scb->fd);
-#endif
-
-#ifdef HAVE_TERMIO
- return ioctl (scb->fd, TCSBRK, 1);
-#endif
-
-#ifdef HAVE_SGTTY
- /* Get the current state and then restore it using TIOCSETP,
- which should cause the output to drain and pending input
- to be discarded. */
- {
- struct hardwire_ttystate state;
-
- if (get_tty_state (scb, &state))
- {
- return (-1);
- }
- else
- {
- return (ioctl (scb->fd, TIOCSETP, &state.sgttyb));
- }
- }
-#endif
}
static int
hardwire_flush_output (struct serial *scb)
{
-#ifdef HAVE_TERMIOS
return tcflush (scb->fd, TCOFLUSH);
-#endif
-
-#ifdef HAVE_TERMIO
- return ioctl (scb->fd, TCFLSH, 1);
-#endif
-
-#ifdef HAVE_SGTTY
- /* This flushes both input and output, but we can't do better. */
- return ioctl (scb->fd, TIOCFLUSH, 0);
-#endif
}
static int
@@ -349,45 +178,13 @@ hardwire_flush_input (struct serial *scb)
{
ser_base_flush_input (scb);
-#ifdef HAVE_TERMIOS
return tcflush (scb->fd, TCIFLUSH);
-#endif
-
-#ifdef HAVE_TERMIO
- return ioctl (scb->fd, TCFLSH, 0);
-#endif
-
-#ifdef HAVE_SGTTY
- /* This flushes both input and output, but we can't do better. */
- return ioctl (scb->fd, TIOCFLUSH, 0);
-#endif
}
static int
hardwire_send_break (struct serial *scb)
{
-#ifdef HAVE_TERMIOS
return tcsendbreak (scb->fd, 0);
-#endif
-
-#ifdef HAVE_TERMIO
- return ioctl (scb->fd, TCSBRK, 0);
-#endif
-
-#ifdef HAVE_SGTTY
- {
- int status;
-
- status = ioctl (scb->fd, TIOCSBRK, 0);
-
- /* Can't use usleep; it doesn't exist in BSD 4.2. */
- /* Note that if this gdb_select() is interrupted by a signal it will not
- wait the full length of time. I think that is OK. */
- gdb_usleep (250000);
- status = ioctl (scb->fd, TIOCCBRK, 0);
- return status;
- }
-#endif
}
static void
@@ -399,7 +196,6 @@ hardwire_raw (struct serial *scb)
fprintf_unfiltered (gdb_stderr, "get_tty_state failed: %s\n",
safe_strerror (errno));
-#ifdef HAVE_TERMIOS
state.termios.c_iflag = 0;
state.termios.c_oflag = 0;
state.termios.c_lflag = 0;
@@ -420,22 +216,6 @@ hardwire_raw (struct serial *scb)
#endif
state.termios.c_cc[VMIN] = 0;
state.termios.c_cc[VTIME] = 0;
-#endif
-
-#ifdef HAVE_TERMIO
- state.termio.c_iflag = 0;
- state.termio.c_oflag = 0;
- state.termio.c_lflag = 0;
- state.termio.c_cflag &= ~CSIZE;
- state.termio.c_cflag |= CLOCAL | CS8;
- state.termio.c_cc[VMIN] = 0;
- state.termio.c_cc[VTIME] = 0;
-#endif
-
-#ifdef HAVE_SGTTY
- state.sgttyb.sg_flags |= RAW | ANYP;
- state.sgttyb.sg_flags &= ~(CBREAK | ECHO);
-#endif
if (set_tty_state (scb, &state))
fprintf_unfiltered (gdb_stderr, "set_tty_state failed: %s\n",
@@ -604,24 +384,8 @@ hardwire_setbaudrate (struct serial *scb, int rate)
if (get_tty_state (scb, &state))
return -1;
-#ifdef HAVE_TERMIOS
cfsetospeed (&state.termios, baud_code);
cfsetispeed (&state.termios, baud_code);
-#endif
-
-#ifdef HAVE_TERMIO
-#ifndef CIBAUD
-#define CIBAUD CBAUD
-#endif
-
- state.termio.c_cflag &= ~(CBAUD | CIBAUD);
- state.termio.c_cflag |= baud_code;
-#endif
-
-#ifdef HAVE_SGTTY
- state.sgttyb.sg_ispeed = baud_code;
- state.sgttyb.sg_ospeed = baud_code;
-#endif
return set_tty_state (scb, &state);
}
@@ -648,23 +412,10 @@ hardwire_setstopbits (struct serial *scb, int num)
return 1;
}
-#ifdef HAVE_TERMIOS
if (!newbit)
state.termios.c_cflag &= ~CSTOPB;
else
state.termios.c_cflag |= CSTOPB; /* two bits */
-#endif
-
-#ifdef HAVE_TERMIO
- if (!newbit)
- state.termio.c_cflag &= ~CSTOPB;
- else
- state.termio.c_cflag |= CSTOPB; /* two bits */
-#endif
-
-#ifdef HAVE_SGTTY
- return 0; /* sgtty doesn't support this */
-#endif
return set_tty_state (scb, &state);
}
@@ -697,19 +448,9 @@ hardwire_setparity (struct serial *scb, int parity)
return -1;
}
-#ifdef HAVE_TERMIOS
state.termios.c_cflag &= ~(PARENB | PARODD);
state.termios.c_cflag |= newparity;
-#endif
-#ifdef HAVE_TERMIO
- state.termio.c_cflag &= ~(PARENB | PARODD);
- state.termio.c_cflag |= newparity;
-#endif
-
-#ifdef HAVE_SGTTY
- return 0; /* sgtty doesn't support this */
-#endif
return set_tty_state (scb, &state);
}
@@ -744,7 +485,6 @@ static const struct serial_ops hardwire_ops =
hardwire_copy_tty_state,
hardwire_set_tty_state,
hardwire_print_tty_state,
- hardwire_noflush_set_tty_state,
hardwire_setbaudrate,
hardwire_setstopbits,
hardwire_setparity,
@@ -759,7 +499,6 @@ _initialize_ser_hardwire (void)
{
serial_add_interface (&hardwire_ops);
-#ifdef HAVE_TERMIOS
#ifdef CRTSCTS
add_setshow_boolean_cmd ("remoteflow", no_class,
&serial_hwflow, _("\
@@ -771,7 +510,6 @@ when debugging using remote targets."),
show_serial_hwflow,
&setlist, &showlist);
#endif
-#endif
}
int
diff --git a/gdb/serial.c b/gdb/serial.c
index 68665491307..32d4f5a7bb2 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -514,14 +514,6 @@ serial_print_tty_state (struct serial *scb,
}
int
-serial_noflush_set_tty_state (struct serial *scb,
- serial_ttystate new_ttystate,
- serial_ttystate old_ttystate)
-{
- return scb->ops->noflush_set_tty_state (scb, new_ttystate, old_ttystate);
-}
-
-int
serial_setbaudrate (struct serial *scb, int rate)
{
return scb->ops->setbaudrate (scb, rate);
diff --git a/gdb/serial.h b/gdb/serial.h
index c76ddbee108..647eab369df 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -169,16 +169,6 @@ extern void serial_print_tty_state (struct serial *scb,
serial_ttystate ttystate,
struct ui_file *);
-/* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the
- current state (generally obtained from a recent call to
- serial_get_tty_state()), but be careful not to discard any input.
- This means that we never switch in or out of raw mode, even if
- NEW_TTYSTATE specifies a switch. */
-
-extern int serial_noflush_set_tty_state (struct serial *scb,
- serial_ttystate new_ttystate,
- serial_ttystate old_ttystate);
-
/* Set the baudrate to the decimal value supplied. Returns 0 for
success, -1 for failure. */
@@ -276,8 +266,6 @@ struct serial_ops
int (*set_tty_state) (struct serial *, serial_ttystate);
void (*print_tty_state) (struct serial *, serial_ttystate,
struct ui_file *);
- int (*noflush_set_tty_state) (struct serial *, serial_ttystate,
- serial_ttystate);
int (*setbaudrate) (struct serial *, int rate);
int (*setstopbits) (struct serial *, int num);
/* Set the value PARITY as parity setting for serial object.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 158fea4f746..fce9deb5bad 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2017-11-06 Pedro Alves <palves@redhat.com>
+
+ * configure.ac: No longer check for termio.h and sgtty.h.
+ * configure: Regenerate.
+ * remote-utils.c: Include termios.h instead of gdb_termios.h.
+ (remote_open): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
+ Remove termio and sgtty code.
+
2017-11-03 Yao Qi <yao.qi@linaro.org>
* gdb.mi/list-thread-groups-available.exp: Skip it if XML parsing