This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Fix tui warnings and a readline tty pb
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH]: Fix tui warnings and a readline tty pb
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Mon, 23 Jul 2001 23:19:52 +0200
Hi!
Hum... TUI virus is back again...
I've integrated this patch to:
- fix warnings in the tui code,
- add tui_show_source() used by tui-out.c to display the source file
- fix a readline tty problem when we enter/leave tui mode
Stephane
2001-07-23 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* tuiStack.c (tuiUpdateLocatorFilename): Use const char*.
* tuiStack.h (tuiUpdateLocatorFilename): Update prototype.
* tuiWin.c (_initialize_tuiWin): Don't cast table of enum in calls
to add_set_enum_cmd.
* tui.c (tui_show_source): New function.
(tuiGetLowDisassemblyAddress): Use CORE_ADDR for newLow.
(tui_switch_mode): Prep or deprep readline terminal;
make sure the \n we return does not redo the last command.
* tui.h (tui_show_source): Declare.
(tui_out_new, tui_install_hooks, tui_remove_hooks): Likewise.
(tui_active, tui_initialize_io, tui_initialize_readline): Likewise.
Index: tui.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.c,v
retrieving revision 1.12
diff -u -p -r1.12 tui.c
--- tui.c 2001/07/21 22:24:44 1.12
+++ tui.c 2001/07/23 21:11:29
@@ -39,10 +39,12 @@
#include "tuiRegs.h"
#include "tuiStack.h"
#include "tuiWin.h"
+#include "tuiSourceWin.h"
#include "readline/readline.h"
#include "target.h"
#include "frame.h"
#include "breakpoint.h"
+#include "inferior.h"
/* Tells whether the TUI is active or not. */
int tui_active = 0;
@@ -55,10 +57,13 @@ tui_switch_mode (void)
if (tui_active)
{
tui_disable ();
+ rl_prep_terminal (0);
+
printf_filtered ("Left the TUI mode\n");
}
else
{
+ rl_deprep_terminal ();
tui_enable ();
printf_filtered ("Entered the TUI mode\n");
}
@@ -74,6 +79,9 @@ tui_switch_mode (void)
will be able to setup the terminal for its needs. By re-entering
in readline, we also redisplay its prompt in the non-curses mode. */
rl_newline (1, '\n');
+
+ /* Make sure the \n we are returning does not repeat the last command. */
+ dont_repeat ();
return 0;
}
@@ -232,6 +240,9 @@ tui_enable (void)
tui_version = 1;
tui_active = 1;
refresh ();
+
+ /* Update gdb's knowledge of its terminal. */
+ terminal_save_ours ();
}
/* Leave the tui mode.
@@ -254,6 +265,8 @@ tui_disable (void)
so that terminal management with the inferior works. */
tui_setup_io (0);
+ /* Update gdb's knowledge of its terminal. */
+ terminal_save_ours ();
tui_version = 0;
tui_active = 0;
}
@@ -276,7 +289,7 @@ CORE_ADDR
tuiGetLowDisassemblyAddress (CORE_ADDR low, CORE_ADDR pc)
{
int line;
- Opaque newLow;
+ CORE_ADDR newLow;
/* Determine where to start the disassembly so that the pc is about in the
middle of the viewport. */
@@ -385,6 +398,15 @@ _tuiReset (void)
} /* _tuiReset */
#endif
+void
+tui_show_source (const char *file, int line)
+{
+ /* make sure that the source window is displayed */
+ tuiAddWinToLayout (SRC_WIN);
+
+ tuiUpdateSourceWindowsWithLine (current_source_symtab, line);
+ tuiUpdateLocatorFilename (file);
+}
void
tui_show_assembly (CORE_ADDR addr)
Index: tui.h
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.h,v
retrieving revision 1.9
diff -u -p -r1.9 tui.h
--- tui.h 2001/07/21 22:24:44 1.9
+++ tui.h 2001/07/23 21:11:29
@@ -106,6 +106,19 @@ extern void tui_enable (void);
/* Leave the tui mode. */
extern void tui_disable (void);
+extern void tui_initialize_io (void);
+
+extern void tui_initialize_readline (void);
+
+extern int tui_active;
+
+extern void tui_install_hooks (void);
+extern void tui_remove_hooks (void);
+
+extern void tui_show_source (const char *file, int line);
+
+extern struct ui_out *tui_out_new (struct ui_file *stream);
+
/* tuiDataWin.c */
extern void tui_vCheckDataValues (va_list);
Index: tuiStack.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiStack.c,v
retrieving revision 1.10
diff -u -p -r1.10 tuiStack.c
--- tuiStack.c 2001/07/21 20:52:56 1.10
+++ tuiStack.c 2001/07/23 21:11:33
@@ -126,7 +126,7 @@ tuiSetLocatorInfo (char *fname, char *pr
** Update only the filename portion of the locator.
*/
void
-tuiUpdateLocatorFilename (char *fileName)
+tuiUpdateLocatorFilename (const char *fileName)
{
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
Index: tuiStack.h
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiStack.h,v
retrieving revision 1.6
diff -u -p -r1.6 tuiStack.h
--- tuiStack.h 2001/07/21 20:52:56 1.6
+++ tuiStack.h 2001/07/23 21:11:33
@@ -27,7 +27,7 @@
extern void tuiSetLocatorInfo (char *, char *, int, CORE_ADDR,
TuiLocatorElementPtr);
-extern void tuiUpdateLocatorFilename (char *);
+extern void tuiUpdateLocatorFilename (const char *);
extern void tuiUpdateLocatorInfoFromFrame
(struct frame_info *, TuiLocatorElementPtr);
extern void tuiUpdateLocatorDisplay (struct frame_info *);
Index: tuiWin.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiWin.c,v
retrieving revision 1.14
diff -u -p -r1.14 tuiWin.c
--- tuiWin.c 2001/07/21 20:57:17 1.14
+++ tuiWin.c 2001/07/23 21:11:36
@@ -317,7 +317,7 @@ Usage: w <#lines>\n");
/* Define the tui control variables. */
c = add_set_enum_cmd
("tui-border-kind", class_tui,
- tui_border_kind_enums, (char*) &tui_border_kind,
+ tui_border_kind_enums, &tui_border_kind,
"Set the kind of border for TUI windows.\n"
"This variable controls the border of TUI windows:\n"
"space use a white space\n"
@@ -328,7 +328,7 @@ Usage: w <#lines>\n");
c = add_set_enum_cmd
("tui-border-mode", class_tui,
- tui_border_mode_enums, (char*) &tui_border_mode,
+ tui_border_mode_enums, &tui_border_mode,
"Set the attribute mode to use for the TUI window borders.\n"
"This variable controls the attributes to use for the window borders:\n"
"normal normal display\n"
@@ -343,7 +343,7 @@ Usage: w <#lines>\n");
c = add_set_enum_cmd
("tui-active-border-mode", class_tui,
- tui_border_mode_enums, (char*) &tui_active_border_mode,
+ tui_border_mode_enums, &tui_active_border_mode,
"Set the attribute mode to use for the active TUI window border.\n"
"This variable controls the attributes to use for the active window border:\n"
"normal normal display\n"