⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdb-sim-inftty.patch

📁 microwindows移植到S3C44B0的源码
💻 PATCH
字号:
2001-09-05  Miles Bader  <miles@gnu.org>	* remote-sim.c (gdbsim_create_inferior): Call target_terminal_init.	(stdin_serial, our_ttystate, inferior_ttystate, terminal_is_ours):	New variables.	(gdbsim_terminal_init, gdbsim_terminal_inferior) 	(gdbsim_terminal_ours_for_output, gdbsim_terminal_ours) 	(gdbsim_terminal_ours_1): New functions.	(init_gdbsim_ops): Add terminal control ops.diff -up gdb/remote-sim.c.\~1\~ gdb/remote-sim.c--- gdb/remote-sim.c.~1~	Wed Jan 17 20:52:03 2001+++ gdb/remote-sim.c	Wed Sep  5 11:48:50 2001@@ -469,6 +469,8 @@ gdbsim_create_inferior (exec_file, args, 		     (exec_file ? exec_file: "(NULL)"), 		     args); +  target_terminal_init ();+   gdbsim_kill ();	    remove_breakpoints ();   init_wait_for_inferior ();@@ -922,6 +924,135 @@ simulator_command (args, from_tty)      something funny. */   registers_changed ();  }++/* Record terminal status separately for debugger and inferior.  */+static serial_t stdin_serial;++/* Our own tty state, which we restore every time we need to deal with the+   terminal.  We only set it once, when GDB first starts.  The settings of+   flags which readline saves and restores and unimportant.  */+static serial_ttystate our_ttystate;++/* TTY state for the inferior.  We save it whenever the inferior stops, and+   restore it when it resumes.  */+static serial_ttystate inferior_ttystate;++/* Nonzero if our terminal settings are in effect.  Zero if the+   inferior's settings are in effect.  Ignored if stdin isn't a terminal.  */+extern int terminal_is_ours;+++/* Initialize the terminal settings we record for the inferior,+   before we actually run the inferior.  */+void+gdbsim_terminal_init ()+{+  if (! stdin_serial)+    {+      stdin_serial = SERIAL_FDOPEN (0);+      if (stdin_serial)+	our_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);+    }++  if (stdin_serial)+    {+      if (inferior_ttystate)+	free (inferior_ttystate);+      inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);+    }++  terminal_is_ours = 1;+}++/* Put the inferior's terminal settings into effect.+   This is preparation for starting or resuming the inferior.  */+void+gdbsim_terminal_inferior ()+{+  if (stdin_serial && terminal_is_ours)+    /* 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.  */+    if (SERIAL_SET_TTY_STATE (stdin_serial, inferior_ttystate) == -1)+      fprintf_unfiltered+	(gdb_stderr,+	 "[setting tty state failed in terminal_inferior: %s]\n",+	 strerror (errno));+  terminal_is_ours = 0;+}++static void gdbsim_terminal_ours_1 PARAMS ((int));++/* Put some of our terminal settings into effect,+   enough to get proper results from our output,+   but do not change into or out of RAW mode+   so that no input is discarded.++   After doing this, either terminal_ours or terminal_inferior+   should be called to get back to a normal state of affairs.  */+void+gdbsim_terminal_ours_for_output ()+{+  gdbsim_terminal_ours_1 (1);+}++/* Put our terminal settings into effect.+   First record the inferior's terminal settings+   so they can be restored properly later.  */+void+gdbsim_terminal_ours ()+{+  gdbsim_terminal_ours_1 (0);+}++/* output_only is not used, and should not be used unless we introduce+   separate terminal_is_ours and terminal_is_ours_for_output+   flags.  */+static void+gdbsim_terminal_ours_1 (output_only)+     int output_only;+{+  if (stdin_serial && !terminal_is_ours)+    {+      terminal_is_ours = 1;++      /* 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_ttystate,+				    inferior_ttystate);+    }+}++/* ARGSUSED */+void+gdbsim_terminal_info (args, from_tty)+     char *args;+     int from_tty;+{+  if (stdin_serial)+    {+      printf_filtered ("Inferior's terminal status (currently saved by GDB):\n");+      SERIAL_PRINT_TTY_STATE (stdin_serial, inferior_ttystate);+    }+  else+    {+      printf_filtered ("This GDB does not control a terminal.\n");+      return;+    }+}+  /* Define the target subroutine names */ @@ -950,11 +1081,11 @@ init_gdbsim_ops(void)   gdbsim_ops.to_files_info  =   gdbsim_files_info;	   gdbsim_ops.to_insert_breakpoint =   gdbsim_insert_breakpoint;   gdbsim_ops.to_remove_breakpoint =   gdbsim_remove_breakpoint;-  gdbsim_ops.to_terminal_init  =   NULL;		-  gdbsim_ops.to_terminal_inferior =   NULL;		-  gdbsim_ops.to_terminal_ours_for_output =   NULL;-  gdbsim_ops.to_terminal_ours  =   NULL;-  gdbsim_ops.to_terminal_info  =   NULL;+  gdbsim_ops.to_terminal_init  =   gdbsim_terminal_init;+  gdbsim_ops.to_terminal_inferior =   gdbsim_terminal_inferior;+  gdbsim_ops.to_terminal_ours_for_output =  gdbsim_terminal_ours_for_output;+  gdbsim_ops.to_terminal_ours  =   gdbsim_terminal_ours;+  gdbsim_ops.to_terminal_info  =   gdbsim_terminal_info;   gdbsim_ops.to_kill  =   gdbsim_kill;	   gdbsim_ops.to_load  =   gdbsim_load;	   gdbsim_ops.to_lookup_symbol =   NULL;	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -