/* General functions for the WDB TUI.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1998-2013 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
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 2 of the License, or
+ 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,
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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "gdbcmd.h"
{
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;
}
}
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;
void
tui_enable (void)
{
+ if (!tui_allowed_p ())
+ error (_("TUI mode not allowed"));
+
if (tui_active)
return;
}
void
-strcat_to_buf (char *buf, int buflen, const char *item_to_add)
+strcat_to_buf (char *buf, int buflen,
+ const char *item_to_add)
{
if (item_to_add != (char *) NULL && buf != (char *) NULL)
{
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);
}
void
-tui_show_assembly (CORE_ADDR addr)
+tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr)
{
tui_add_win_to_layout (DISASSEM_WIN);
- tui_update_source_windows_with_addr (addr);
+ tui_update_source_windows_with_addr (gdbarch, addr);
}
int
}
int
-tui_get_command_dimension (unsigned int *width, unsigned int *height)
+tui_get_command_dimension (unsigned int *width,
+ unsigned int *height)
{
if (!tui_active || (TUI_CMD_WIN == NULL))
{