From: Stephane Carrez Date: Mon, 23 Jul 2001 21:13:57 +0000 (+0000) Subject: * tuiStack.c (tuiUpdateLocatorFilename): Use const char*. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c6f60bcd2c458714bd21da267719d55ba7e10736;p=binutils-gdb.git * 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. --- diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 6c1dea0d1e6..b224be9bd6d 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -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) diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index c26802bc6ab..9e3ccda9b05 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -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); diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c index bf02dec77a7..501252c850e 100644 --- a/gdb/tui/tuiStack.c +++ b/gdb/tui/tuiStack.c @@ -126,7 +126,7 @@ tuiSetLocatorInfo (char *fname, char *procname, int lineNo, ** Update only the filename portion of the locator. */ void -tuiUpdateLocatorFilename (char *fileName) +tuiUpdateLocatorFilename (const char *fileName) { TuiGenWinInfoPtr locator = locatorWinInfoPtr (); diff --git a/gdb/tui/tuiStack.h b/gdb/tui/tuiStack.h index c348f6d341d..90aab5abe22 100644 --- a/gdb/tui/tuiStack.h +++ b/gdb/tui/tuiStack.h @@ -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 *); diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c index 509f590ab78..024a29546ac 100644 --- a/gdb/tui/tuiWin.c +++ b/gdb/tui/tuiWin.c @@ -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"