This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Trivial patches to improve user experience of gdbtui
- From: Jan Holesovsky <kendy at suse dot cz>
- To: gdb-patches at sourceware dot org
- Date: Mon, 21 May 2007 18:15:55 +0200
- Subject: Trivial patches to improve user experience of gdbtui
Hi,
Recently I started using gdbtui; and I like it a lot, especially the SingleKey
mode. It has some issues, but I fixed the most annoying [for me ;-)] with
the following patches - please have a look & commit :-) [For descriptions,
please see the changelog.] They are trivial, so I hope I don't need the
copyright assignment for them. If yes, please let me know; and correct me
even if you prefer the patches inline instead of attachments.
ChangeLog:
2007-05-21 Jan Holesovsky <kendy@suse.cz>
* tui/tui.c: SingleKey binding for stepi and nexti; don't quit
SingleKey by 'q' when it's activated by a nontrivial ctrl+x
combination - the user is smart enough to exit this mode.
* tui/tui-win.c: Fix silly typos in help.
* tui/tui-io.c: Display prompts like ---Type <return>... even in
SingleKey mode, and be able to react there.
* tui/tui-command.c: When switched temporarily from the SingleKey mode
to command mode, bind [Up] and [Down] keys to readline history; it's
safe because we know that the user wants to type.
Thank you in advance!
Regards,
Jan
diff -pur gdb-6.6.orig/gdb/tui/tui.c gdb-6.6/gdb/tui/tui.c
--- gdb-6.6.orig/gdb/tui/tui.c 2005-12-23 11:10:03.000000000 -0800
+++ gdb-6.6/gdb/tui/tui.c 2007-05-16 14:21:11.000000000 -0700
@@ -75,12 +75,14 @@ static const struct tui_char_command tui
{ 'c', "continue" },
{ 'd', "down" },
{ 'f', "finish" },
+ { 'i', "stepi" },
{ 'n', "next" },
{ 'r', "run" },
{ 's', "step" },
{ 'u', "up" },
{ 'v', "info locals" },
{ 'w', "where" },
+ { 'x', "nexti" },
{ 0, 0 },
};
@@ -349,7 +351,6 @@ tui_initialize_readline (void)
rl_bind_key_in_map ('2', tui_rl_change_windows, tui_ctlx_keymap);
rl_bind_key_in_map ('o', tui_rl_other_window, emacs_ctlx_keymap);
rl_bind_key_in_map ('o', tui_rl_other_window, tui_ctlx_keymap);
- rl_bind_key_in_map ('q', tui_rl_next_keymap, tui_keymap);
rl_bind_key_in_map ('s', tui_rl_next_keymap, emacs_ctlx_keymap);
rl_bind_key_in_map ('s', tui_rl_next_keymap, tui_ctlx_keymap);
}
diff -pur gdb-6.6.orig/gdb/tui/tui-win.c gdb-6.6/gdb/tui/tui-win.c
--- gdb-6.6.orig/gdb/tui/tui-win.c 2006-02-14 11:05:40.000000000 -0800
+++ gdb-6.6/gdb/tui/tui-win.c 2007-05-14 18:51:40.000000000 -0700
@@ -389,10 +389,10 @@ Usage: + [win] [n]\n"));
Scroll window backward.\n\
Usage: - [win] [n]\n"));
add_com ("<", class_tui, tui_scroll_left_command, _("\
-Scroll window forward.\n\
+Scroll window left.\n\
Usage: < [win] [n]\n"));
add_com (">", class_tui, tui_scroll_right_command, _("\
-Scroll window backward.\n\
+Scroll window right.\n\
Usage: > [win] [n]\n"));
if (xdb_commands)
add_com ("w", class_xdb, tui_xdb_set_win_height_command, _("\
diff -pur gdb-6.6.orig/gdb/tui/tui-command.c gdb-6.6/gdb/tui/tui-command.c
--- gdb-6.6.orig/gdb/tui/tui-command.c 2005-12-23 11:10:02.000000000 -0800
+++ gdb-6.6/gdb/tui/tui-command.c 2007-05-15 14:46:12.000000000 -0700
@@ -32,6 +32,7 @@
#include "gdb_curses.h"
#include "gdb_string.h"
+#include <readline/readline.h>
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
@@ -112,11 +113,23 @@ tui_dispatch_ctrl_char (unsigned int ch)
break;
case KEY_DOWN:
case KEY_SF:
- tui_scroll_forward (win_info, 1);
+ if (tui_current_key_mode == TUI_ONE_COMMAND_MODE)
+ {
+ rl_get_next_history (1, 0);
+ rl_redisplay ();
+ }
+ else
+ tui_scroll_forward (win_info, 1);
break;
case KEY_UP:
case KEY_SR:
- tui_scroll_backward (win_info, 1);
+ if (tui_current_key_mode == TUI_ONE_COMMAND_MODE)
+ {
+ rl_get_previous_history (1, 0);
+ rl_redisplay ();
+ }
+ else
+ tui_scroll_backward (win_info, 1);
break;
case KEY_RIGHT:
tui_scroll_left (win_info, 1);
diff -pur gdb-6.6.orig/gdb/tui/tui-io.c gdb-6.6/gdb/tui/tui-io.c
--- gdb-6.6.orig/gdb/tui/tui-io.c 2005-12-23 11:10:02.000000000 -0800
+++ gdb-6.6/gdb/tui/tui-io.c 2007-05-16 07:59:10.000000000 -0700
@@ -211,11 +211,17 @@ tui_redisplay_readline (void)
if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
tui_set_key_mode (TUI_SINGLE_KEY_MODE);
+ /* Do display prompts like ---Type <return>... even in single command
+ mode, and be able to react on such requests. */
+ prompt = tui_rl_saved_prompt;
if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
- prompt = "";
- else
- prompt = tui_rl_saved_prompt;
-
+ {
+ if (!strcmp (tui_rl_saved_prompt, get_prompt()))
+ prompt = "";
+ else
+ tui_set_key_mode (TUI_ONE_COMMAND_MODE);
+ }
+
c_pos = -1;
c_line = -1;
w = TUI_CMD_WIN->generic.handle;