Update years in copyright notice for the GDB files.
[deliverable/binutils-gdb.git] / gdb / tui / tui.c
index 7c0d0ce45f2b77a3f4a869151e620c6b0c5c945b..d609de337e2769593a4bfad68bf6dc6db0984e71 100644 (file)
@@ -1,7 +1,6 @@
 /* General functions for the WDB TUI.
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   Copyright (C) 1998-2013 Free Software Foundation, Inc.
 
    Contributed by Hewlett-Packard Company.
 
@@ -241,11 +240,17 @@ tui_rl_command_key (int count, int key)
     {
       if (tui_commands[i].key == key)
         {
-          /* Must save the command because it can be modified by
-             execute_command.  */
-          char *cmd = alloca (strlen (tui_commands[i].cmd) + 1);
-          strcpy (cmd, tui_commands[i].cmd);
-          execute_command (cmd, TRUE);
+          /* Insert the command in the readline buffer.
+             Avoid calling the gdb command here since it creates
+             a possible recursion on readline if prompt_for_continue
+             is called (See PR 9584).  The command will also appear
+             in the readline history which turns out to be better.  */
+          rl_insert_text (tui_commands[i].cmd);
+          rl_newline (1, '\n');
+
+          /* Switch to gdb command mode while executing the command.
+             This way the gdb's continue prompty will be displayed.  */
+          tui_set_key_mode (TUI_ONE_COMMAND_MODE);
           return 0;
         }
     }
@@ -284,7 +289,7 @@ static int
 tui_rl_startup_hook (void)
 {
   rl_already_prompted = 1;
-  if (tui_current_key_mode != TUI_COMMAND_MODE)
+  if (tui_current_key_mode != TUI_COMMAND_MODE && immediate_quit == 0)
     tui_set_key_mode (TUI_SINGLE_KEY_MODE);
   tui_redisplay_readline ();
   return 0;
@@ -364,6 +369,9 @@ tui_initialize_readline (void)
 void
 tui_enable (void)
 {
+  if (!tui_allowed_p ())
+    error (_("TUI mode not allowed"));
+
   if (tui_active)
     return;
 
@@ -527,6 +535,7 @@ void
 tui_show_source (const char *file, int line)
 {
   struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+
   /* Make sure that the source window is displayed.  */
   tui_add_win_to_layout (SRC_WIN);
 
This page took 0.024125 seconds and 4 git commands to generate.