* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
/* TUI support I/O functions.
|
2002-03-01 06:19:28 +00:00
|
|
|
|
2009-01-03 05:58:08 +00:00
|
|
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
|
2007-01-09 17:59:20 +00:00
|
|
|
Free Software Foundation, Inc.
|
2002-03-01 06:19:28 +00:00
|
|
|
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
Contributed by Hewlett-Packard Company.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
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
|
2007-08-23 18:08:50 +00:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 18:08:50 +00:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
#include "defs.h"
|
2001-07-21 19:56:54 +00:00
|
|
|
#include "target.h"
|
|
|
|
#include "event-loop.h"
|
2002-08-31 12:02:14 +00:00
|
|
|
#include "event-top.h"
|
2001-07-21 19:56:54 +00:00
|
|
|
#include "command.h"
|
|
|
|
#include "top.h"
|
2004-01-19 04:31:53 +00:00
|
|
|
#include "tui/tui.h"
|
|
|
|
#include "tui/tui-data.h"
|
|
|
|
#include "tui/tui-io.h"
|
|
|
|
#include "tui/tui-command.h"
|
|
|
|
#include "tui/tui-win.h"
|
|
|
|
#include "tui/tui-wingeneral.h"
|
|
|
|
#include "tui/tui-file.h"
|
2001-07-21 19:56:54 +00:00
|
|
|
#include "ui-out.h"
|
|
|
|
#include "cli-out.h"
|
|
|
|
#include <fcntl.h>
|
2001-07-21 22:35:40 +00:00
|
|
|
#include <signal.h>
|
2003-06-22 15:21:39 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2004-02-10 Andrew Cagney <cagney@redhat.com>
* defs.h: Do not include "tui.h".
* gdb_curses.h: New file.
* tui/tui-hooks.h: New file.
* tui/tui.h (tui_update_all_exec_infos): Delete declaration.
(tui_install_hooks, tui_remove_hooks): Delete declarations.
(tui_initialize_io): Delete declaration.
(tui_initialize_readline: Delete redundant declaration.
(struct tui_point): Delete definition.
* tui/tui-data.h (struct tui_point): Define.
* cli/cli-decode.c [TUI]: Include "tui/tui.h".
* utils.c: Include "tui/tui.h".
* tui/tui-data.h: Include "tui/tui.h" and "gdb_curses.h".
* printcmd.c [TUI]: Include "tui/tui.h".
* cli/cli-cmds.c [TUI]: Include "tui/tui.h".
* tui/tui-command.c: Include "gdb_curses.h".
* tui/tui.c, tui/tui-winsource.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-windata.c, tui/tui-win.c, tui/tui-stack.c: Ditto.
* tui/tui-source.c, tui/tui-regs.c, tui/tui-layout.c: Ditto.
* tui/tui-io.c, tui/tui-disasm.c, tui/tui-data.c: : Ditto.
* tui/tui-hooks.c: Include "tui-hooks.h" and "gdb_curses.h".
* Makefile.in: Update all dependencies.
(tui_hooks_h, gdb_curses_h): Define.
(SUBDIR_TUI_CFLAGS): Remove -I${srcdir}/tui.
2004-02-10 19:08:19 +00:00
|
|
|
#include "gdb_curses.h"
|
2001-07-21 19:56:54 +00:00
|
|
|
|
2004-04-09 13:54:34 +00:00
|
|
|
/* This redefines CTRL if it is not already defined, so it must come
|
|
|
|
after terminal state releated include files like <term.h> and
|
|
|
|
"gdb_curses.h". */
|
|
|
|
#include "readline/readline.h"
|
|
|
|
|
2004-01-18 Andrew Cagney <cagney@redhat.com>
* tui/tui-io.c: Update copyright.
(key_is_end_sequence, key_is_backspace): New functions.
(key_is_command_char, key_is_start_sequence): New function.
(tui_getc): Update references.
* tui/tui-io.h: Update copyright.
(m_tuiStartNewLine): Delete macro.
(m_isBackspace, m_isDeleteChar): Delete macros.
(m_isDeleteLine, m_isDeleteToEol): Delete macros.
(m_isNextPage, m_isPrevPage): Delete macros.
(m_isLeftArrow, m_isRightArrow): Delete macros.
(m_isXdbStyleCommandChar): Delete macro.
(key_is_start_sequence): Declare, replace m_isStartSequence.
(key_is_end_sequence): Declare, replace m_isEndSequence.
(key_is_backspace): Declare ,replace m_isBackspace.
(key_is_command_char): Declare, replace m_isCommandChar.
* tui/tui-command.c: Update copyright.
(tuiDispatchCtrlChar): Update references.
2004-01-19 05:06:34 +00:00
|
|
|
int
|
|
|
|
key_is_start_sequence (int ch)
|
|
|
|
{
|
|
|
|
return (ch == 27);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
key_is_end_sequence (int ch)
|
|
|
|
{
|
|
|
|
return (ch == 126);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
key_is_backspace (int ch)
|
|
|
|
{
|
|
|
|
return (ch == 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
key_is_command_char (int ch)
|
|
|
|
{
|
|
|
|
return ((ch == KEY_NPAGE) || (ch == KEY_PPAGE)
|
|
|
|
|| (ch == KEY_LEFT) || (ch == KEY_RIGHT)
|
|
|
|
|| (ch == KEY_UP) || (ch == KEY_DOWN)
|
|
|
|
|| (ch == KEY_SF) || (ch == KEY_SR)
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-disasm.c, tui-file.c, tui-io.c,
tui-layout.c, tui-regs.c, tui-source.c, tui-win.c, tui-windata.c,
tui-wingeneral.c, tui-winsource.c: Coding standard, && and ||
go at beginning of new line.
2007-08-15 00:19:44 +00:00
|
|
|
|| (ch == (int)'\f')
|
|
|
|
|| key_is_start_sequence (ch));
|
2004-01-18 Andrew Cagney <cagney@redhat.com>
* tui/tui-io.c: Update copyright.
(key_is_end_sequence, key_is_backspace): New functions.
(key_is_command_char, key_is_start_sequence): New function.
(tui_getc): Update references.
* tui/tui-io.h: Update copyright.
(m_tuiStartNewLine): Delete macro.
(m_isBackspace, m_isDeleteChar): Delete macros.
(m_isDeleteLine, m_isDeleteToEol): Delete macros.
(m_isNextPage, m_isPrevPage): Delete macros.
(m_isLeftArrow, m_isRightArrow): Delete macros.
(m_isXdbStyleCommandChar): Delete macro.
(key_is_start_sequence): Declare, replace m_isStartSequence.
(key_is_end_sequence): Declare, replace m_isEndSequence.
(key_is_backspace): Declare ,replace m_isBackspace.
(key_is_command_char): Declare, replace m_isCommandChar.
* tui/tui-command.c: Update copyright.
(tuiDispatchCtrlChar): Update references.
2004-01-19 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
2002-08-27 20:58:27 +00:00
|
|
|
/* Use definition from readline 4.3. */
|
|
|
|
#undef CTRL_CHAR
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-data.c, tui-data.h, tui-disasm.c, tui-disasm.h, tui-hooks.c,
tui-io.c, tui-layout.c, tui-layout.h, tui-out.c, tui-regs.c,
tui-source.c, tui-source.h, tui-stack.c, tui-win.c, tui-win.h,
tui-windata.c, tui-windata.h, tui-wingeneral.c, tui-winsource.c,
tui-winsource.h, tui.c, tui.h: Function declarations and
definitions, wrap long lines.
2007-08-14 23:50:39 +00:00
|
|
|
#define CTRL_CHAR(c) \
|
|
|
|
((c) < control_character_threshold && (((c) & 0x80) == 0))
|
2002-08-27 20:58:27 +00:00
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
/* This file controls the IO interactions between gdb and curses.
|
|
|
|
When the TUI is enabled, gdb has two modes a curses and a standard
|
|
|
|
mode.
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
In curses mode, the gdb outputs are made in a curses command
|
|
|
|
window. For this, the gdb_stdout and gdb_stderr are redirected to
|
|
|
|
the specific ui_file implemented by TUI. The output is handled by
|
|
|
|
tui_puts(). The input is also controlled by curses with
|
|
|
|
tui_getc(). The readline library uses this function to get its
|
|
|
|
input. Several readline hooks are installed to redirect readline
|
|
|
|
output to the TUI (see also the note below).
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
In normal mode, the gdb outputs are restored to their origin, that
|
|
|
|
is as if TUI is not used. Readline also uses its original getc()
|
|
|
|
function with stdin.
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
Note SCz/2001-07-21: the current readline is not clean in its
|
|
|
|
management of the output. Even if we install a redisplay handler,
|
|
|
|
it sometimes writes on a stdout file. It is important to redirect
|
|
|
|
every output produced by readline, otherwise the curses window will
|
|
|
|
be garbled. This is implemented with a pipe that TUI reads and
|
|
|
|
readline writes to. A gdb input handler is created so that reading
|
|
|
|
the pipe is handled automatically. This will probably not work on
|
|
|
|
non-Unix platforms. The best fix is to make readline clean enougth
|
|
|
|
so that is never write on stdout.
|
|
|
|
|
|
|
|
Note SCz/2002-09-01: we now use more readline hooks and it seems
|
|
|
|
that with them we don't need the pipe anymore (verified by creating
|
|
|
|
the pipe and closing its end so that write causes a SIGPIPE). The
|
|
|
|
old pipe code is still there and can be conditionally removed by
|
2002-09-03 20:47:48 +00:00
|
|
|
#undef TUI_USE_PIPE_FOR_READLINE. */
|
|
|
|
|
|
|
|
/* For gdb 5.3, prefer to continue the pipe hack as a backup wheel. */
|
|
|
|
#define TUI_USE_PIPE_FOR_READLINE
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* #undef TUI_USE_PIPE_FOR_READLINE */
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
/* TUI output files. */
|
|
|
|
static struct ui_file *tui_stdout;
|
|
|
|
static struct ui_file *tui_stderr;
|
2002-09-10 19:59:31 +00:00
|
|
|
struct ui_out *tui_out;
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
/* GDB output files in non-curses mode. */
|
|
|
|
static struct ui_file *tui_old_stdout;
|
|
|
|
static struct ui_file *tui_old_stderr;
|
2002-09-10 19:59:31 +00:00
|
|
|
struct ui_out *tui_old_uiout;
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
/* Readline previous hooks. */
|
|
|
|
static Function *tui_old_rl_getc_function;
|
|
|
|
static VFunction *tui_old_rl_redisplay_function;
|
|
|
|
static VFunction *tui_old_rl_prep_terminal;
|
|
|
|
static VFunction *tui_old_rl_deprep_terminal;
|
|
|
|
static int tui_old_readline_echoing_p;
|
|
|
|
|
|
|
|
/* Readline output stream.
|
|
|
|
Should be removed when readline is clean. */
|
|
|
|
static FILE *tui_rl_outstream;
|
|
|
|
static FILE *tui_old_rl_outstream;
|
2002-09-03 20:47:48 +00:00
|
|
|
#ifdef TUI_USE_PIPE_FOR_READLINE
|
2001-07-21 19:56:54 +00:00
|
|
|
static int tui_readline_pipe[2];
|
2002-09-03 20:47:48 +00:00
|
|
|
#endif
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2002-10-26 10:38:57 +00:00
|
|
|
/* The last gdb prompt that was registered in readline.
|
|
|
|
This may be the main gdb prompt or a secondary prompt. */
|
|
|
|
static char *tui_rl_saved_prompt;
|
|
|
|
|
2004-02-08 00:05:16 +00:00
|
|
|
static unsigned int tui_handle_resize_during_io (unsigned int);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2002-09-03 20:47:48 +00:00
|
|
|
static void
|
|
|
|
tui_putc (char c)
|
|
|
|
{
|
|
|
|
char buf[2];
|
|
|
|
|
|
|
|
buf[0] = c;
|
|
|
|
buf[1] = 0;
|
|
|
|
tui_puts (buf);
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Print the string in the curses command window. */
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-21 19:56:54 +00:00
|
|
|
tui_puts (const char *string)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
static int tui_skip_line = -1;
|
|
|
|
char c;
|
|
|
|
WINDOW *w;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
w = TUI_CMD_WIN->generic.handle;
|
2001-07-21 19:56:54 +00:00
|
|
|
while ((c = *string++) != 0)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Catch annotation and discard them. We need two \032 and
|
|
|
|
discard until a \n is seen. */
|
|
|
|
if (c == '\032')
|
|
|
|
{
|
|
|
|
tui_skip_line++;
|
|
|
|
}
|
|
|
|
else if (tui_skip_line != 1)
|
|
|
|
{
|
|
|
|
tui_skip_line = -1;
|
|
|
|
waddch (w, c);
|
|
|
|
}
|
|
|
|
else if (c == '\n')
|
|
|
|
tui_skip_line = -1;
|
|
|
|
}
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
getyx (w, TUI_CMD_WIN->detail.command_info.cur_line,
|
|
|
|
TUI_CMD_WIN->detail.command_info.curch);
|
|
|
|
TUI_CMD_WIN->detail.command_info.start_line = TUI_CMD_WIN->detail.command_info.cur_line;
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
/* We could defer the following. */
|
|
|
|
wrefresh (w);
|
|
|
|
fflush (stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Readline callback.
|
|
|
|
Redisplay the command line with its prompt after readline has
|
|
|
|
changed the edited text. */
|
2002-08-31 12:02:14 +00:00
|
|
|
void
|
2001-07-21 19:56:54 +00:00
|
|
|
tui_redisplay_readline (void)
|
|
|
|
{
|
|
|
|
int prev_col;
|
|
|
|
int height;
|
|
|
|
int col, line;
|
|
|
|
int c_pos;
|
|
|
|
int c_line;
|
|
|
|
int in;
|
|
|
|
WINDOW *w;
|
|
|
|
char *prompt;
|
|
|
|
int start_line;
|
2002-09-13 20:06:56 +00:00
|
|
|
|
|
|
|
/* Detect when we temporarily left SingleKey and now the readline
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
edit buffer is empty, automatically restore the SingleKey
|
|
|
|
mode. */
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
|
|
|
|
tui_set_key_mode (TUI_SINGLE_KEY_MODE);
|
2002-09-13 20:06:56 +00:00
|
|
|
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
|
2002-08-31 12:02:14 +00:00
|
|
|
prompt = "";
|
|
|
|
else
|
2002-10-26 10:38:57 +00:00
|
|
|
prompt = tui_rl_saved_prompt;
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
c_pos = -1;
|
|
|
|
c_line = -1;
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
w = TUI_CMD_WIN->generic.handle;
|
|
|
|
start_line = TUI_CMD_WIN->detail.command_info.start_line;
|
2001-07-21 19:56:54 +00:00
|
|
|
wmove (w, start_line, 0);
|
|
|
|
prev_col = 0;
|
|
|
|
height = 1;
|
|
|
|
for (in = 0; prompt && prompt[in]; in++)
|
|
|
|
{
|
|
|
|
waddch (w, prompt[in]);
|
|
|
|
getyx (w, line, col);
|
|
|
|
if (col < prev_col)
|
|
|
|
height++;
|
|
|
|
prev_col = col;
|
|
|
|
}
|
|
|
|
for (in = 0; in < rl_end; in++)
|
|
|
|
{
|
|
|
|
unsigned char c;
|
|
|
|
|
|
|
|
c = (unsigned char) rl_line_buffer[in];
|
|
|
|
if (in == rl_point)
|
|
|
|
{
|
|
|
|
getyx (w, c_line, c_pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CTRL_CHAR (c) || c == RUBOUT)
|
|
|
|
{
|
|
|
|
waddch (w, '^');
|
|
|
|
waddch (w, CTRL_CHAR (c) ? UNCTRL (c) : '?');
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
else
|
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
waddch (w, c);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2001-07-21 19:56:54 +00:00
|
|
|
if (c == '\n')
|
|
|
|
{
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
getyx (w, TUI_CMD_WIN->detail.command_info.start_line,
|
|
|
|
TUI_CMD_WIN->detail.command_info.curch);
|
2001-07-21 19:56:54 +00:00
|
|
|
}
|
|
|
|
getyx (w, line, col);
|
|
|
|
if (col < prev_col)
|
|
|
|
height++;
|
|
|
|
prev_col = col;
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2001-07-21 19:56:54 +00:00
|
|
|
wclrtobot (w);
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
getyx (w, TUI_CMD_WIN->detail.command_info.start_line,
|
|
|
|
TUI_CMD_WIN->detail.command_info.curch);
|
2001-07-21 19:56:54 +00:00
|
|
|
if (c_line >= 0)
|
2001-07-23 21:16:20 +00:00
|
|
|
{
|
|
|
|
wmove (w, c_line, c_pos);
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
TUI_CMD_WIN->detail.command_info.cur_line = c_line;
|
|
|
|
TUI_CMD_WIN->detail.command_info.curch = c_pos;
|
2001-07-23 21:16:20 +00:00
|
|
|
}
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
TUI_CMD_WIN->detail.command_info.start_line -= height - 1;
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
wrefresh (w);
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Readline callback to prepare the terminal. It is called once each
|
|
|
|
time we enter readline. Terminal is already setup in curses
|
|
|
|
mode. */
|
2001-07-21 19:56:54 +00:00
|
|
|
static void
|
2003-02-12 15:14:36 +00:00
|
|
|
tui_prep_terminal (int notused1)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2002-10-26 10:38:57 +00:00
|
|
|
/* Save the prompt registered in readline to correctly display it.
|
|
|
|
(we can't use gdb_prompt() due to secondary prompts and can't use
|
|
|
|
rl_prompt because it points to an alloca buffer). */
|
|
|
|
xfree (tui_rl_saved_prompt);
|
|
|
|
tui_rl_saved_prompt = xstrdup (rl_prompt);
|
2001-07-21 19:56:54 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Readline callback to restore the terminal. It is called once each
|
|
|
|
time we leave readline. There is nothing to do in curses mode. */
|
2001-07-21 19:56:54 +00:00
|
|
|
static void
|
|
|
|
tui_deprep_terminal (void)
|
|
|
|
{
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2002-09-03 20:47:48 +00:00
|
|
|
#ifdef TUI_USE_PIPE_FOR_READLINE
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Read readline output pipe and feed the command window with it.
|
|
|
|
Should be removed when readline is clean. */
|
|
|
|
static void
|
|
|
|
tui_readline_output (int code, gdb_client_data data)
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
char buf[256];
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
size = read (tui_readline_pipe[0], buf, sizeof (buf) - 1);
|
|
|
|
if (size > 0 && tui_active)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
buf[size] = 0;
|
|
|
|
tui_puts (buf);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2001-07-21 19:56:54 +00:00
|
|
|
}
|
2002-09-03 20:47:48 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Return the portion of PATHNAME that should be output when listing
|
|
|
|
possible completions. If we are hacking filename completion, we
|
|
|
|
are only interested in the basename, the portion following the
|
|
|
|
final slash. Otherwise, we return what we were passed.
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
Comes from readline/complete.c. */
|
2002-09-03 20:47:48 +00:00
|
|
|
static char *
|
2004-02-08 01:32:26 +00:00
|
|
|
printable_part (char *pathname)
|
2002-09-03 20:47:48 +00:00
|
|
|
{
|
|
|
|
char *temp;
|
|
|
|
|
|
|
|
temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
|
|
|
|
#if defined (__MSDOS__)
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-disasm.c, tui-file.c, tui-io.c,
tui-layout.c, tui-regs.c, tui-source.c, tui-win.c, tui-windata.c,
tui-wingeneral.c, tui-winsource.c: Coding standard, && and ||
go at beginning of new line.
2007-08-15 00:19:44 +00:00
|
|
|
if (rl_filename_completion_desired
|
|
|
|
&& temp == 0 && isalpha (pathname[0])
|
|
|
|
&& pathname[1] == ':')
|
2002-09-03 20:47:48 +00:00
|
|
|
temp = pathname + 1;
|
|
|
|
#endif
|
|
|
|
return (temp ? ++temp : pathname);
|
|
|
|
}
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and
|
|
|
|
we are using it, check for and output a single character for
|
|
|
|
`special' filenames. Return the number of characters we
|
|
|
|
output. */
|
2002-09-03 20:47:48 +00:00
|
|
|
|
|
|
|
#define PUTX(c) \
|
|
|
|
do { \
|
|
|
|
if (CTRL_CHAR (c)) \
|
|
|
|
{ \
|
|
|
|
tui_puts ("^"); \
|
|
|
|
tui_putc (UNCTRL (c)); \
|
|
|
|
printed_len += 2; \
|
|
|
|
} \
|
|
|
|
else if (c == RUBOUT) \
|
|
|
|
{ \
|
|
|
|
tui_puts ("^?"); \
|
|
|
|
printed_len += 2; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
tui_putc (c); \
|
|
|
|
printed_len++; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static int
|
2004-02-08 01:32:26 +00:00
|
|
|
print_filename (char *to_print, char *full_pathname)
|
2002-09-03 20:47:48 +00:00
|
|
|
{
|
|
|
|
int printed_len = 0;
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
for (s = to_print; *s; s++)
|
|
|
|
{
|
|
|
|
PUTX (*s);
|
|
|
|
}
|
|
|
|
return printed_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The user must press "y" or "n". Non-zero return means "y" pressed.
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
Comes from readline/complete.c. */
|
2002-09-03 20:47:48 +00:00
|
|
|
static int
|
2004-02-08 01:32:26 +00:00
|
|
|
get_y_or_n (void)
|
2002-09-03 20:47:48 +00:00
|
|
|
{
|
|
|
|
extern int _rl_abort_internal ();
|
|
|
|
int c;
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
c = rl_read_key ();
|
|
|
|
if (c == 'y' || c == 'Y' || c == ' ')
|
|
|
|
return (1);
|
|
|
|
if (c == 'n' || c == 'N' || c == RUBOUT)
|
|
|
|
return (0);
|
|
|
|
if (c == ABORT_CHAR)
|
|
|
|
_rl_abort_internal ();
|
|
|
|
beep ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A convenience function for displaying a list of strings in
|
|
|
|
columnar format on readline's output stream. MATCHES is the list
|
|
|
|
of strings, in argv format, LEN is the number of strings in MATCHES,
|
|
|
|
and MAX is the length of the longest string in MATCHES.
|
|
|
|
|
|
|
|
Comes from readline/complete.c and modified to write in
|
|
|
|
the TUI command window using tui_putc/tui_puts. */
|
|
|
|
static void
|
2004-02-08 01:32:26 +00:00
|
|
|
tui_rl_display_match_list (char **matches, int len, int max)
|
2002-09-03 20:47:48 +00:00
|
|
|
{
|
|
|
|
typedef int QSFUNC (const void *, const void *);
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-data.c, tui-data.h, tui-disasm.c, tui-disasm.h, tui-hooks.c,
tui-io.c, tui-layout.c, tui-layout.h, tui-out.c, tui-regs.c,
tui-source.c, tui-source.h, tui-stack.c, tui-win.c, tui-win.h,
tui-windata.c, tui-windata.h, tui-wingeneral.c, tui-winsource.c,
tui-winsource.h, tui.c, tui.h: Function declarations and
definitions, wrap long lines.
2007-08-14 23:50:39 +00:00
|
|
|
extern int _rl_qsort_string_compare (const void *,
|
|
|
|
const void *);
|
2002-09-03 20:47:48 +00:00
|
|
|
extern int _rl_print_completions_horizontally;
|
|
|
|
|
|
|
|
int count, limit, printed_len;
|
|
|
|
int i, j, k, l;
|
|
|
|
char *temp;
|
|
|
|
|
|
|
|
/* Screen dimension correspond to the TUI command window. */
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
int screenwidth = TUI_CMD_WIN->generic.width;
|
2002-09-03 20:47:48 +00:00
|
|
|
|
|
|
|
/* If there are many items, then ask the user if she really wants to
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
see them all. */
|
2002-09-03 20:47:48 +00:00
|
|
|
if (len >= rl_completion_query_items)
|
|
|
|
{
|
|
|
|
char msg[256];
|
|
|
|
|
|
|
|
sprintf (msg, "\nDisplay all %d possibilities? (y or n)", len);
|
|
|
|
tui_puts (msg);
|
|
|
|
if (get_y_or_n () == 0)
|
|
|
|
{
|
|
|
|
tui_puts ("\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* How many items of MAX length can we fit in the screen window? */
|
2002-09-03 20:47:48 +00:00
|
|
|
max += 2;
|
|
|
|
limit = screenwidth / max;
|
|
|
|
if (limit != 1 && (limit * max == screenwidth))
|
|
|
|
limit--;
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Avoid a possible floating exception. If max > screenwidth, limit
|
|
|
|
will be 0 and a divide-by-zero fault will result. */
|
2002-09-03 20:47:48 +00:00
|
|
|
if (limit == 0)
|
|
|
|
limit = 1;
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* How many iterations of the printing loop? */
|
2002-09-03 20:47:48 +00:00
|
|
|
count = (len + (limit - 1)) / limit;
|
|
|
|
|
|
|
|
/* Watch out for special case. If LEN is less than LIMIT, then
|
|
|
|
just do the inner printing loop.
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
0 < len <= limit implies count = 1. */
|
2002-09-03 20:47:48 +00:00
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Sort the items if they are not already sorted. */
|
2002-09-03 20:47:48 +00:00
|
|
|
if (rl_ignore_completion_duplicates == 0)
|
|
|
|
qsort (matches + 1, len, sizeof (char *),
|
|
|
|
(QSFUNC *)_rl_qsort_string_compare);
|
|
|
|
|
|
|
|
tui_putc ('\n');
|
|
|
|
|
|
|
|
if (_rl_print_completions_horizontally == 0)
|
|
|
|
{
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Print the sorted items, up-and-down alphabetically, like ls. */
|
2002-09-03 20:47:48 +00:00
|
|
|
for (i = 1; i <= count; i++)
|
|
|
|
{
|
|
|
|
for (j = 0, l = i; j < limit; j++)
|
|
|
|
{
|
|
|
|
if (l > len || matches[l] == 0)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
temp = printable_part (matches[l]);
|
|
|
|
printed_len = print_filename (temp, matches[l]);
|
|
|
|
|
|
|
|
if (j + 1 < limit)
|
|
|
|
for (k = 0; k < max - printed_len; k++)
|
|
|
|
tui_putc (' ');
|
|
|
|
}
|
|
|
|
l += count;
|
|
|
|
}
|
|
|
|
tui_putc ('\n');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Print the sorted items, across alphabetically, like ls -x. */
|
2002-09-03 20:47:48 +00:00
|
|
|
for (i = 1; matches[i]; i++)
|
|
|
|
{
|
|
|
|
temp = printable_part (matches[i]);
|
|
|
|
printed_len = print_filename (temp, matches[i]);
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Have we reached the end of this line? */
|
2002-09-03 20:47:48 +00:00
|
|
|
if (matches[i+1])
|
|
|
|
{
|
|
|
|
if (i && (limit > 1) && (i % limit) == 0)
|
|
|
|
tui_putc ('\n');
|
|
|
|
else
|
|
|
|
for (k = 0; k < max - printed_len; k++)
|
|
|
|
tui_putc (' ');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tui_putc ('\n');
|
|
|
|
}
|
|
|
|
}
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
/* Setup the IO for curses or non-curses mode.
|
|
|
|
- In non-curses mode, readline and gdb use the standard input and
|
|
|
|
standard output/error directly.
|
|
|
|
- In curses mode, the standard output/error is controlled by TUI
|
|
|
|
with the tui_stdout and tui_stderr. The output is redirected in
|
|
|
|
the curses command window. Several readline callbacks are installed
|
|
|
|
so that readline asks for its input to the curses command window
|
|
|
|
with wgetch(). */
|
|
|
|
void
|
|
|
|
tui_setup_io (int mode)
|
|
|
|
{
|
|
|
|
extern int readline_echoing_p;
|
|
|
|
|
|
|
|
if (mode)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Redirect readline to TUI. */
|
|
|
|
tui_old_rl_redisplay_function = rl_redisplay_function;
|
|
|
|
tui_old_rl_deprep_terminal = rl_deprep_term_function;
|
|
|
|
tui_old_rl_prep_terminal = rl_prep_term_function;
|
|
|
|
tui_old_rl_getc_function = rl_getc_function;
|
|
|
|
tui_old_rl_outstream = rl_outstream;
|
|
|
|
tui_old_readline_echoing_p = readline_echoing_p;
|
|
|
|
rl_redisplay_function = tui_redisplay_readline;
|
|
|
|
rl_deprep_term_function = tui_deprep_terminal;
|
|
|
|
rl_prep_term_function = tui_prep_terminal;
|
|
|
|
rl_getc_function = tui_getc;
|
|
|
|
readline_echoing_p = 0;
|
|
|
|
rl_outstream = tui_rl_outstream;
|
|
|
|
rl_prompt = 0;
|
2002-09-03 20:47:48 +00:00
|
|
|
rl_completion_display_matches_hook = tui_rl_display_match_list;
|
|
|
|
rl_already_prompted = 0;
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
/* Keep track of previous gdb output. */
|
|
|
|
tui_old_stdout = gdb_stdout;
|
|
|
|
tui_old_stderr = gdb_stderr;
|
|
|
|
tui_old_uiout = uiout;
|
|
|
|
|
|
|
|
/* Reconfigure gdb output. */
|
|
|
|
gdb_stdout = tui_stdout;
|
|
|
|
gdb_stderr = tui_stderr;
|
|
|
|
gdb_stdlog = gdb_stdout; /* for moment */
|
|
|
|
gdb_stdtarg = gdb_stderr; /* for moment */
|
|
|
|
uiout = tui_out;
|
2001-07-21 22:35:40 +00:00
|
|
|
|
|
|
|
/* Save tty for SIGCONT. */
|
|
|
|
savetty ();
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2001-07-21 19:56:54 +00:00
|
|
|
else
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Restore gdb output. */
|
|
|
|
gdb_stdout = tui_old_stdout;
|
|
|
|
gdb_stderr = tui_old_stderr;
|
|
|
|
gdb_stdlog = gdb_stdout; /* for moment */
|
|
|
|
gdb_stdtarg = gdb_stderr; /* for moment */
|
|
|
|
uiout = tui_old_uiout;
|
|
|
|
|
|
|
|
/* Restore readline. */
|
|
|
|
rl_redisplay_function = tui_old_rl_redisplay_function;
|
|
|
|
rl_deprep_term_function = tui_old_rl_deprep_terminal;
|
|
|
|
rl_prep_term_function = tui_old_rl_prep_terminal;
|
|
|
|
rl_getc_function = tui_old_rl_getc_function;
|
|
|
|
rl_outstream = tui_old_rl_outstream;
|
2002-09-03 20:47:48 +00:00
|
|
|
rl_completion_display_matches_hook = 0;
|
2001-07-21 19:56:54 +00:00
|
|
|
readline_echoing_p = tui_old_readline_echoing_p;
|
2002-09-13 19:47:21 +00:00
|
|
|
rl_already_prompted = 0;
|
2001-07-21 22:35:40 +00:00
|
|
|
|
|
|
|
/* Save tty for SIGCONT. */
|
|
|
|
savetty ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef SIGCONT
|
|
|
|
/* Catch SIGCONT to restore the terminal and refresh the screen. */
|
|
|
|
static void
|
|
|
|
tui_cont_sig (int sig)
|
|
|
|
{
|
|
|
|
if (tui_active)
|
|
|
|
{
|
|
|
|
/* Restore the terminal setting because another process (shell)
|
|
|
|
might have changed it. */
|
|
|
|
resetty ();
|
|
|
|
|
|
|
|
/* Force a refresh of the screen. */
|
2004-02-07 01:02:54 +00:00
|
|
|
tui_refresh_all_win ();
|
2001-07-23 21:16:20 +00:00
|
|
|
|
|
|
|
/* Update cursor position on the screen. */
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
wmove (TUI_CMD_WIN->generic.handle,
|
|
|
|
TUI_CMD_WIN->detail.command_info.start_line,
|
|
|
|
TUI_CMD_WIN->detail.command_info.curch);
|
|
|
|
wrefresh (TUI_CMD_WIN->generic.handle);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2001-07-21 22:35:40 +00:00
|
|
|
signal (sig, tui_cont_sig);
|
2001-07-21 19:56:54 +00:00
|
|
|
}
|
2001-07-21 22:35:40 +00:00
|
|
|
#endif
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Initialize the IO for gdb in curses mode. */
|
|
|
|
void
|
2004-02-08 01:32:26 +00:00
|
|
|
tui_initialize_io (void)
|
2001-07-21 19:56:54 +00:00
|
|
|
{
|
2001-07-21 22:35:40 +00:00
|
|
|
#ifdef SIGCONT
|
|
|
|
signal (SIGCONT, tui_cont_sig);
|
|
|
|
#endif
|
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Create tui output streams. */
|
|
|
|
tui_stdout = tui_fileopen (stdout);
|
|
|
|
tui_stderr = tui_fileopen (stderr);
|
|
|
|
tui_out = tui_out_new (tui_stdout);
|
|
|
|
|
2004-04-21 Andrew Cagney <cagney@redhat.com>
* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
* tracepoint.h (deprecated_create_tracepoint_hook)
(deprecated_delete_tracepoint_hook)
(deprecated_modify_tracepoint_hook)
(deprecated_trace_find_hook)
(deprecated_trace_start_stop_hook): Deprecate.
* target.h (deprecated_target_new_objfile_hook): Deprecate.
* remote.h (deprecated_target_resume_hook)
(deprecated_target_wait_loop_hook): Deprecate.
* gdbcore.h (deprecated_exec_file_display_hook)
(deprecated_file_changed_hook): Deprecate.
* frame.h (deprecated_selected_frame_level_changed_hook): Deprecate.
* defs.h (deprecated_modify_breakpoint_hook)
(deprecated_command_loop_hook, deprecated_show_load_progress)
(deprecated_print_frame_info_listing_hook)
(deprecated_query_hook, deprecated_warning_hook)
(deprecated_flush_hook, deprecated_create_breakpoint_hook)
(deprecated_delete_breakpoint_hook)
(deprecated_interactive_hook, deprecated_registers_changed_hook)
(deprecated_readline_begin_hook, deprecated_readline_hook)
(deprecated_readline_end_hook, deprecated_register_changed_hook)
(deprecated_memory_changed_hook, deprecated_init_ui_hook)
(deprecated_context_hook, deprecated_target_wait_hook)
(deprecated_attach_hook, deprecated_detach_hook)
(deprecated_call_command_hook, deprecated_set_hook)
(deprecated_error_hook, deprecated_error_begin_hook)
(deprecated_ui_load_progress_hook): Deprecate.
* valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update.
* tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update.
* target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update.
* remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update.
* main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update.
* exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update.
* annotate.c, aix-thread.c: Update.
2004-04-21 23:52:21 +00:00
|
|
|
/* Create the default UI. It is not created because we installed a
|
|
|
|
deprecated_init_ui_hook. */
|
2002-09-10 19:59:31 +00:00
|
|
|
tui_old_uiout = uiout = cli_out_new (gdb_stdout);
|
2001-07-21 19:56:54 +00:00
|
|
|
|
2002-09-03 20:47:48 +00:00
|
|
|
#ifdef TUI_USE_PIPE_FOR_READLINE
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Temporary solution for readline writing to stdout: redirect
|
|
|
|
readline output in a pipe, read that pipe and output the content
|
|
|
|
in the curses command window. */
|
2001-07-21 19:56:54 +00:00
|
|
|
if (pipe (tui_readline_pipe) != 0)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline");
|
|
|
|
exit (1);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2001-07-21 19:56:54 +00:00
|
|
|
tui_rl_outstream = fdopen (tui_readline_pipe[1], "w");
|
|
|
|
if (tui_rl_outstream == 0)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-21 19:56:54 +00:00
|
|
|
fprintf_unfiltered (gdb_stderr, "Cannot redirect readline output");
|
|
|
|
exit (1);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2002-10-25 19:24:01 +00:00
|
|
|
setvbuf (tui_rl_outstream, (char*) NULL, _IOLBF, 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
#ifdef O_NONBLOCK
|
|
|
|
(void) fcntl (tui_readline_pipe[0], F_SETFL, O_NONBLOCK);
|
1999-04-16 01:35:26 +00:00
|
|
|
#else
|
2001-07-21 19:56:54 +00:00
|
|
|
#ifdef O_NDELAY
|
|
|
|
(void) fcntl (tui_readline_pipe[0], F_SETFL, O_NDELAY);
|
1999-04-16 01:35:26 +00:00
|
|
|
#endif
|
2001-07-21 19:56:54 +00:00
|
|
|
#endif
|
|
|
|
add_file_handler (tui_readline_pipe[0], tui_readline_output, 0);
|
2002-09-03 20:47:48 +00:00
|
|
|
#else
|
|
|
|
tui_rl_outstream = stdout;
|
|
|
|
#endif
|
2001-07-21 19:56:54 +00:00
|
|
|
}
|
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* Get a character from the command window. This is called from the
|
|
|
|
readline package. */
|
2001-07-21 19:56:54 +00:00
|
|
|
int
|
|
|
|
tui_getc (FILE *fp)
|
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
WINDOW *w;
|
|
|
|
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
w = TUI_CMD_WIN->generic.handle;
|
2001-07-21 19:56:54 +00:00
|
|
|
|
2002-09-03 20:47:48 +00:00
|
|
|
#ifdef TUI_USE_PIPE_FOR_READLINE
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Flush readline output. */
|
|
|
|
tui_readline_output (GDB_READABLE, 0);
|
2002-09-03 20:47:48 +00:00
|
|
|
#endif
|
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
ch = wgetch (w);
|
2004-02-08 00:05:16 +00:00
|
|
|
ch = tui_handle_resize_during_io (ch);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
/* The \n must be echoed because it will not be printed by
|
|
|
|
readline. */
|
2001-07-21 19:56:54 +00:00
|
|
|
if (ch == '\n')
|
|
|
|
{
|
|
|
|
/* When hitting return with an empty input, gdb executes the last
|
|
|
|
command. If we emit a newline, this fills up the command window
|
|
|
|
with empty lines with gdb prompt at beginning. Instead of that,
|
|
|
|
stay on the same line but provide a visual effect to show the
|
|
|
|
user we recognized the command. */
|
|
|
|
if (rl_end == 0)
|
|
|
|
{
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, 0);
|
2001-07-21 19:56:54 +00:00
|
|
|
|
|
|
|
/* Clear the line. This will blink the gdb prompt since
|
|
|
|
it will be redrawn at the same line. */
|
|
|
|
wclrtoeol (w);
|
|
|
|
wrefresh (w);
|
|
|
|
napms (20);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
wmove (w, TUI_CMD_WIN->detail.command_info.cur_line,
|
|
|
|
TUI_CMD_WIN->detail.command_info.curch);
|
2001-07-21 19:56:54 +00:00
|
|
|
waddch (w, ch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-18 Andrew Cagney <cagney@redhat.com>
* tui/tui-io.c: Update copyright.
(key_is_end_sequence, key_is_backspace): New functions.
(key_is_command_char, key_is_start_sequence): New function.
(tui_getc): Update references.
* tui/tui-io.h: Update copyright.
(m_tuiStartNewLine): Delete macro.
(m_isBackspace, m_isDeleteChar): Delete macros.
(m_isDeleteLine, m_isDeleteToEol): Delete macros.
(m_isNextPage, m_isPrevPage): Delete macros.
(m_isLeftArrow, m_isRightArrow): Delete macros.
(m_isXdbStyleCommandChar): Delete macro.
(key_is_start_sequence): Declare, replace m_isStartSequence.
(key_is_end_sequence): Declare, replace m_isEndSequence.
(key_is_backspace): Declare ,replace m_isBackspace.
(key_is_command_char): Declare, replace m_isCommandChar.
* tui/tui-command.c: Update copyright.
(tuiDispatchCtrlChar): Update references.
2004-01-19 05:06:34 +00:00
|
|
|
if (key_is_command_char (ch))
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 21:20:09 +00:00
|
|
|
{ /* Handle prev/next/up/down here. */
|
2004-01-21 04:16:53 +00:00
|
|
|
ch = tui_dispatch_ctrl_char (ch);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2001-07-21 19:56:54 +00:00
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
if (ch == '\n' || ch == '\r' || ch == '\f')
|
2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
"ansidecl.h". Do not undef "reg" and "chtype". Fix case of
fields and variables.
* tui/tui-wingeneral.h (m_beVisible): Delete macro.
(m_beInvisible): Delete macro.
* tui/tui-data.h: Fix case case fields and variables.
(m_genWinPtrIsNull): Delete macro.
(tui_win_list): Rename winList.
(TUI_SRC_WIN): Rename srcWin.
(TUI_DISASM_WIN): Rename disassemWin.
(TUI_DATA_WIN): Rename dataWin.
(TUI_CMD_WIN): Rename cmdWin.
(m_genWinPtrNotNull): Delete macro.
(m_winPtrIsNull): Delete macro.
(m_winPtrNotNull): Delete macro.
(tui_win_is_source_type): Replace m_winIsSourceType
(tui_win_is_auxillary): Replace m_winIsAuzillary.
(tui_win_has_locator): Replace m_hasLocator.
(tui_set_win_highlight): Replace m_setWinHighlightOn and
m_setWinHighlightOff.
* tui/tui-data.c: Update references.
(tui_win_is_source_type, tui_set_win_highlight): New functions.
(tui_win_has_locator, tui_win_is_auxillary): New functions.
* tui/tui-command.c, tui/tui-disasm.c: Update references.
* tui/tui-io.c, tui/tui-layout.c, tui/tui-regs.c: Ditto.
* tui/tui-regs.h, tui/tui-source.c, tui/tui-stack.c: Ditto.
* tui/tui-win.c, tui/tui-windata.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c, tui/tui.c: Ditto.
2004-02-07 20:57:02 +00:00
|
|
|
TUI_CMD_WIN->detail.command_info.curch = 0;
|
2001-07-21 19:56:54 +00:00
|
|
|
if (ch == KEY_BACKSPACE)
|
|
|
|
return '\b';
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
return ch;
|
2001-07-21 19:56:54 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
2001-07-21 19:56:54 +00:00
|
|
|
/* Cleanup when a resize has occured.
|
|
|
|
Returns the character that must be processed. */
|
1999-04-16 01:35:26 +00:00
|
|
|
static unsigned int
|
2004-02-08 00:05:16 +00:00
|
|
|
tui_handle_resize_during_io (unsigned int original_ch)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2004-02-07 04:40:36 +00:00
|
|
|
if (tui_win_resized ())
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2004-02-07 01:02:54 +00:00
|
|
|
tui_refresh_all_win ();
|
1999-04-16 01:35:26 +00:00
|
|
|
dont_repeat ();
|
2004-02-07 04:40:36 +00:00
|
|
|
tui_set_win_resized_to (FALSE);
|
1999-04-16 01:35:26 +00:00
|
|
|
return '\n';
|
|
|
|
}
|
|
|
|
else
|
2004-02-08 00:05:16 +00:00
|
|
|
return original_ch;
|
2001-07-21 19:56:54 +00:00
|
|
|
}
|