gdb/terminal.h - gdb

Macros defined

Source code

  1. /* Terminal interface definitions for GDB, the GNU Debugger.
  2.    Copyright (C) 1986-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #if !defined (TERMINAL_H)
  15. #define TERMINAL_H 1


  16. /* If we're using autoconf, it will define HAVE_TERMIOS_H,
  17.    HAVE_TERMIO_H and HAVE_SGTTY_H for usOne day we can rewrite
  18.    ser-unix.c and inflow.c to inspect those names instead of
  19.    HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither
  20.    HAVE_TERMIOS or HAVE_TERMIO is set).  Until then, make sure that
  21.    nothing has already defined the one of the names, and do the right
  22.    thing.  */

  23. #if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY)
  24. #if defined(HAVE_TERMIOS_H)
  25. #define HAVE_TERMIOS
  26. #else /* ! defined (HAVE_TERMIOS_H) */
  27. #if defined(HAVE_TERMIO_H)
  28. #define HAVE_TERMIO
  29. #else /* ! defined (HAVE_TERMIO_H) */
  30. #if defined(HAVE_SGTTY_H)
  31. #define HAVE_SGTTY
  32. #endif /* ! defined (HAVE_SGTTY_H) */
  33. #endif /* ! defined (HAVE_TERMIO_H) */
  34. #endif /* ! defined (HAVE_TERMIOS_H) */
  35. #endif /* !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) &&
  36.           !defined (HAVE_SGTTY) */

  37. #if defined(HAVE_TERMIOS)
  38. #include <termios.h>
  39. #endif

  40. #if !defined(_WIN32) && !defined (HAVE_TERMIOS)

  41. /* Define a common set of macros -- BSD based -- and redefine whatever
  42.    the system offers to make it look like that.  FIXME: serial.h and
  43.    ser-*.c deal with this in a much cleaner fashion; as soon as stuff
  44.    is converted to use them, can get rid of this crap.  */

  45. #ifdef HAVE_TERMIO

  46. #include <termio.h>

  47. #undef TIOCGETP
  48. #define TIOCGETP TCGETA
  49. #undef TIOCSETN
  50. #define TIOCSETN TCSETA
  51. #undef TIOCSETP
  52. #define TIOCSETP TCSETAF
  53. #define TERMINAL struct termio

  54. #else /* sgtty */

  55. #include <fcntl.h>
  56. #include <sgtty.h>
  57. #include <sys/ioctl.h>
  58. #define TERMINAL struct sgttyb

  59. #endif /* sgtty */
  60. #endif

  61. struct inferior;

  62. extern void new_tty_prefork (const char *);

  63. extern void new_tty (void);

  64. extern void new_tty_postfork (void);

  65. extern void copy_terminal_info (struct inferior *to, struct inferior *from);

  66. /* Do we have job control?  Can be assumed to always be the same within
  67.    a given run of GDB.  In inflow.c.  */
  68. extern int job_control;

  69. extern pid_t create_tty_session (void);

  70. /* Set the process group of the caller to its own pid, or do nothing if
  71.    we lack job control.  */
  72. extern int gdb_setpgid (void);

  73. /* Set up a serial structure describing standard input.  In inflow.c.  */
  74. extern void initialize_stdin_serial (void);

  75. extern int gdb_has_a_terminal (void);

  76. extern void gdb_save_tty_state (void);

  77. extern void set_initial_gdb_ttystate (void);

  78. /* Set the process group of the caller to its own pid, or do nothing
  79.    if we lack job control.  */
  80. extern int gdb_setpgid (void);

  81. #endif /* !defined (TERMINAL_H) */