summaryrefslogtreecommitdiffstats
path: root/contrib/gdb/gdb/inflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gdb/gdb/inflow.c')
-rw-r--r--contrib/gdb/gdb/inflow.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/contrib/gdb/gdb/inflow.c b/contrib/gdb/gdb/inflow.c
index 66671f7..35cd799 100644
--- a/contrib/gdb/gdb/inflow.c
+++ b/contrib/gdb/gdb/inflow.c
@@ -1,6 +1,7 @@
/* Low level interface to ptrace, for GDB when running under Unix.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -35,22 +36,7 @@
#include <sys/select.h>
#endif
-#ifdef HAVE_TERMIOS
-#define PROCESS_GROUP_TYPE pid_t
-#endif
-
-#ifdef HAVE_TERMIO
-#define PROCESS_GROUP_TYPE int
-#endif
-
-#ifdef HAVE_SGTTY
-#ifdef SHORT_PGRP
-/* This is only used for the ultra. Does it have pid_t? */
-#define PROCESS_GROUP_TYPE short
-#else
-#define PROCESS_GROUP_TYPE int
-#endif
-#endif /* sgtty */
+#include "inflow.h"
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
@@ -171,7 +157,7 @@ gdb_has_a_terminal (void)
#define OOPSY(what) \
if (result == -1) \
fprintf_unfiltered(gdb_stderr, "[%s failed in terminal_inferior: %s]\n", \
- what, strerror (errno))
+ what, safe_strerror (errno))
static void terminal_ours_1 (int);
@@ -200,6 +186,23 @@ terminal_init_inferior_with_pgrp (int pgrp)
}
}
+/* Save the terminal settings again. This is necessary for the TUI
+ when it switches to TUI or non-TUI mode; curses changes the terminal
+ and gdb must be able to restore it correctly. */
+
+void
+terminal_save_ours (void)
+{
+ if (gdb_has_a_terminal ())
+ {
+ /* We could just as well copy our_ttystate (if we felt like adding
+ a new function serial_copy_tty_state). */
+ if (our_ttystate)
+ xfree (our_ttystate);
+ our_ttystate = serial_get_tty_state (stdin_serial);
+ }
+}
+
void
terminal_init_inferior (void)
{
@@ -221,6 +224,7 @@ void
terminal_inferior (void)
{
if (gdb_has_a_terminal () && terminal_is_ours
+ && inferior_ttystate != NULL
&& inferior_thisrun_terminal == 0)
{
int result;
@@ -374,7 +378,7 @@ terminal_ours_1 (int output_only)
such situations as well. */
if (result == -1)
fprintf_unfiltered (gdb_stderr, "[tcsetpgrp failed in terminal_ours: %s]\n",
- strerror (errno));
+ safe_strerror (errno));
#endif
#endif /* termios */
@@ -410,14 +414,12 @@ terminal_ours_1 (int output_only)
}
}
-/* ARGSUSED */
void
term_info (char *arg, int from_tty)
{
target_terminal_info (arg, from_tty);
}
-/* ARGSUSED */
void
child_terminal_info (char *args, int from_tty)
{
@@ -513,7 +515,7 @@ new_tty_prefork (char *ttyname)
void
new_tty (void)
{
- register int tty;
+ int tty;
if (inferior_thisrun_terminal == 0)
return;
@@ -570,7 +572,6 @@ new_tty (void)
/* Kill the inferior process. Make us have no inferior. */
-/* ARGSUSED */
static void
kill_command (char *arg, int from_tty)
{
@@ -591,17 +592,17 @@ kill_command (char *arg, int from_tty)
if (target_has_stack)
{
printf_filtered ("In %s,\n", target_longname);
- if (selected_frame == NULL)
+ if (deprecated_selected_frame == NULL)
fputs_filtered ("No selected stack frame.\n", gdb_stdout);
else
- print_stack_frame (selected_frame, selected_frame_level, 1);
+ print_stack_frame (deprecated_selected_frame,
+ frame_relative_level (deprecated_selected_frame), 1);
}
}
/* Call set_sigint_trap when you need to pass a signal on to an attached
process when handling SIGINT */
-/* ARGSUSED */
static void
pass_signal (int signo)
{
OpenPOWER on IntegriCloud