This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA]: Cleanup gdb to remove some TUI hacks
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFA]: Cleanup gdb to remove some TUI hacks
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Sat, 14 Jul 2001 16:31:30 +0200
Hi!
The following patch is a cleanup of TUI hacks in GDB. It does not repair
the TUI. It aggravates the thing... but there is a clean solution for each
TUI hack that is removed (breakpoint hook, frame select hook, query hook,
init ui hook, registers hook, and others).
This patch does not take care of `source.c' nor `printcmd.c' because I've not
yet solved the tui in these 2 files in a suitable clean way.
Can you approve this patch?
Stephane
2001-07-14 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* utils.c (query): Remove tui hacks; tui must use the query_hook.
* top.c (command_loop): Remove tui insert_mode hacks; don't call
tuiCleanUp because this must be made with atexit by tui.
* symfile.c (symbol_file_command): Remove call to TUIDO
* stack.c (show_and_print_stack_frame_stub): Remove tui check;
not necessary when using the selected frame hooks.
(print_stack_frame_stub): Likewise.
(print_frame_info_base): Likewise.
(print_frame_info): Likewise.
(up_silently_command): Likewise.
(down_silently_command): Likewise.
(show_stack_frame): Likewise for TUIDO.
(select_frame): Likewise.
(select_and_print_frame): Likewise.
(stack_publish_stopped_with_no_frame): Remove.
(select_and_maybe_print_frame): Remove.
* main.c (captured_main): Remove tui_fileopen and tuiInit; tui
must use the initialize ui hook.
* infrun.c (normal_stop): Remove call to TUIDO; tui must use the
selected frame hooks.
* event-top.c (command_handler): Remove tui insert_mode hack.
* defs.h: Remove TUIDO; Only include tui.h.
* breakpoint.c (mention): Remove calls to TUIDO.
(delete_breakpoint): Remove tui hacks; tui must install
the breakpoint hooks.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.49
diff -u -p -r1.49 breakpoint.c
--- breakpoint.c 2001/07/06 03:53:11 1.49
+++ breakpoint.c 2001/07/14 14:21:17
@@ -4576,8 +4576,6 @@ mention (struct breakpoint *b)
if (b->source_file)
printf_filtered (": file %s, line %d.",
b->source_file, b->line_number);
- TUIDO (((TuiOpaqueFuncPtr) tui_vAllSetHasBreakAt, b, 1));
- TUIDO (((TuiOpaqueFuncPtr) tuiUpdateAllExecInfos));
}
#ifdef UI_OUT
do_cleanups (old_chain);
@@ -6829,26 +6827,6 @@ delete_breakpoint (struct breakpoint *bp
{
b->next = bpt->next;
break;
- }
-
- /* Before turning off the visuals for the bp, check to see that
- there are no other bps at the same address. */
- if (tui_version)
- {
- int clearIt;
-
- ALL_BREAKPOINTS (b)
- {
- clearIt = (b->address != bpt->address);
- if (!clearIt)
- break;
- }
-
- if (clearIt)
- {
- TUIDO (((TuiOpaqueFuncPtr) tui_vAllSetHasBreakAt, bpt, 0));
- TUIDO (((TuiOpaqueFuncPtr) tuiUpdateAllExecInfos));
- }
}
check_duplicates (bpt);
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.57
diff -u -p -r1.57 defs.h
--- defs.h 2001/07/07 17:19:50 1.57
+++ defs.h 2001/07/14 14:21:22
@@ -165,13 +165,6 @@ extern int is_cplus_marker (int);
/* use tui interface if non-zero */
extern int tui_version;
-#if defined(TUI)
-/* all invocations of TUIDO should have two sets of parens */
-#define TUIDO(x) tuiDo x
-#else
-#define TUIDO(x)
-#endif
-
/* enable xdb commands if set */
extern int xdb_commands;
@@ -625,11 +618,6 @@ extern struct ui_file *gdb_stdtarg;
#if defined(TUI)
#include "tui.h"
-#include "tuiCommand.h"
-#include "tuiData.h"
-#include "tuiIO.h"
-#include "tuiLayout.h"
-#include "tuiWin.h"
#endif
#include "ui-file.h"
Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.14
diff -u -p -r1.14 event-top.c
--- event-top.c 2001/04/19 23:56:13 1.14
+++ event-top.c 2001/07/14 14:21:27
@@ -478,18 +478,11 @@ command_handler (char *command)
extern int display_time;
extern int display_space;
-#if defined(TUI)
- extern int insert_mode;
-#endif
-
quit_flag = 0;
if (instream == stdin && stdin_is_tty)
reinitialize_more_filter ();
old_chain = make_cleanup (null_cleanup, 0);
-#if defined(TUI)
- insert_mode = 0;
-#endif
/* If readline returned a NULL command, it means that the
connection with the terminal is gone. This happens at the
end of a testsuite run, after Expect has hung up
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.43
diff -u -p -r1.43 infrun.c
--- infrun.c 2001/07/11 16:46:57 1.43
+++ infrun.c 2001/07/14 14:21:45
@@ -3590,9 +3590,6 @@ and/or watchpoints.\n");
select_frame (get_current_frame (), 0);
}
-
- TUIDO (((TuiOpaqueFuncPtr) tui_vCheckDataValues, selected_frame));
-
done:
annotate_stopped ();
}
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.11
diff -u -p -r1.11 main.c
--- main.c 2001/06/10 16:25:51 1.11
+++ main.c 2001/07/14 14:21:49
@@ -36,12 +36,6 @@
#include "event-loop.h"
#include "ui-out.h"
-#if defined (TUI)
-/* FIXME: cagney/2000-01-31: This #include is to allow older code such
- as that found in the TUI to continue to build. */
-#include "tui/tui-file.h"
-#endif
-
/* If nonzero, display time usage both at startup and for each command. */
int display_time;
@@ -195,17 +189,10 @@ captured_main (void *data)
getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
current_directory = gdb_dirbuf;
-#if defined (TUI)
- gdb_stdout = tui_fileopen (stdout);
- gdb_stderr = tui_fileopen (stderr);
- gdb_stdlog = gdb_stdout; /* for moment */
- gdb_stdtarg = gdb_stderr; /* for moment */
-#else
gdb_stdout = stdio_fileopen (stdout);
gdb_stderr = stdio_fileopen (stderr);
gdb_stdlog = gdb_stderr; /* for moment */
gdb_stdtarg = gdb_stderr; /* for moment */
-#endif
/* initialize error() */
error_init ();
@@ -481,12 +468,6 @@ extern int gdbtk_test (char *);
if (batch)
quiet = 1;
}
-
-#if defined(TUI)
- /* Should this be moved to tui-top.c:_initialize_tui()? */
- if (tui_version)
- init_ui_hook = tuiInit;
-#endif
/* Initialize all files. Give the interpreter a chance to take
control of the console via the init_ui_hook()) */
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.21
diff -u -p -r1.21 stack.c
--- stack.c 2001/06/26 04:48:47 1.21
+++ stack.c 2001/07/14 14:21:56
@@ -149,11 +149,6 @@ show_and_print_stack_frame_stub (void *a
{
struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
- /* Reversed order of these so tuiDo() doesn't occur
- * in the middle of "Breakpoint 1 ... [location]" printing = RT
- */
- if (tui_version)
- print_frame_info_base (p->fi, p->level, p->source, p->args);
print_frame_info (p->fi, p->level, p->source, p->args);
return 0;
@@ -167,10 +162,7 @@ print_stack_frame_stub (void *args)
{
struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
- if (tui_version)
- print_frame_info (p->fi, p->level, p->source, p->args);
- else
- print_frame_info_base (p->fi, p->level, p->source, p->args);
+ print_frame_info_base (p->fi, p->level, p->source, p->args);
return 0;
}
@@ -408,7 +400,7 @@ print_frame_info_base (struct frame_info
fi->pc);
if (!done)
{
- if (addressprint && mid_statement && !tui_version)
+ if (addressprint && mid_statement)
{
#ifdef UI_OUT
ui_out_field_core_addr (uiout, "addr", fi->pc);
@@ -420,7 +412,7 @@ print_frame_info_base (struct frame_info
}
if (print_frame_info_listing_hook)
print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0);
- else if (!tui_version)
+ else
print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
}
current_source_line = max (sal.line - lines_to_list / 2, 1);
@@ -657,33 +649,13 @@ print_frame (struct frame_info *fi,
}
-#if 0
-void
-stack_publish_stopped_with_no_frame (void)
-{
- TUIDO (((TuiOpaqueFuncPtr) tuiUpdateOnEnd));
-
- return;
-}
-#endif
-
/* Show or print the frame info. If this is the tui, it will be shown in
the source display */
void
print_frame_info (struct frame_info *fi, register int level, int source,
int args)
{
- if (!tui_version)
- print_frame_info_base (fi, level, source, args);
- else
- {
- if (fi && (frame_in_dummy (fi) || fi->signal_handler_caller))
- print_frame_info_base (fi, level, source, args);
- else
- {
- TUIDO (((TuiOpaqueFuncPtr) tui_vShowFrameInfo, fi));
- }
- }
+ print_frame_info_base (fi, level, source, args);
}
/* Show the frame info. If this is the tui, it will be shown in
@@ -691,7 +663,6 @@ print_frame_info (struct frame_info *fi,
void
show_stack_frame (struct frame_info *fi)
{
- TUIDO (((TuiOpaqueFuncPtr) tui_vShowFrameInfo, fi));
}
@@ -1561,14 +1532,6 @@ select_frame (struct frame_info *fi, int
{
set_language (s->language);
}
- /* elz: this if here fixes the problem with the pc not being displayed
- in the tui asm layout, with no debug symbols. The value of s
- would be 0 here, and select_source_symtab would abort the
- command by calling the 'error' function */
- if (s)
- {
- TUIDO (((TuiOpaqueFuncPtr) tui_vSelectSourceSymtab, s));
- }
}
}
@@ -1582,25 +1545,10 @@ select_and_print_frame (struct frame_inf
if (fi)
{
print_stack_frame (fi, level, 1);
- TUIDO (((TuiOpaqueFuncPtr) tui_vCheckDataValues, fi));
}
}
-/* Select frame FI, noting that its stack level is LEVEL. Be silent if
- not the TUI */
-#if 0
-void
-select_and_maybe_print_frame (struct frame_info *fi, int level)
-{
- if (!tui_version)
- select_frame (fi, level);
- else
- select_and_print_frame (fi, level);
-}
-#endif
-
-
/* Store the selected frame and its level into *FRAMEP and *LEVELP.
If there is no selected frame, *FRAMEP is set to NULL. */
@@ -1755,8 +1703,6 @@ static void
up_silently_command (char *count_exp, int from_tty)
{
up_silently_base (count_exp);
- if (tui_version)
- print_stack_frame (selected_frame, selected_frame_level, 1);
}
static void
@@ -1802,8 +1748,6 @@ static void
down_silently_command (char *count_exp, int from_tty)
{
down_silently_base (count_exp);
- if (tui_version)
- print_stack_frame (selected_frame, selected_frame_level, 1);
}
static void
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.34
diff -u -p -r1.34 symfile.c
--- symfile.c 2001/06/06 17:12:30 1.34
+++ symfile.c 2001/07/14 14:22:09
@@ -1008,7 +1008,6 @@ symbol_file_command (char *args, int fro
{
error ("no symbol file name was specified");
}
- TUIDO (((TuiOpaqueFuncPtr) tuiDisplayMainFunction));
do_cleanups (cleanups);
}
}
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.35
diff -u -p -r1.35 top.c
--- top.c 2001/05/17 15:05:32 1.35
+++ top.c 2001/07/14 14:22:16
@@ -845,9 +845,6 @@ command_loop (void)
while (instream && !feof (instream))
{
-#if defined(TUI)
- extern int insert_mode;
-#endif
if (window_hook && instream == stdin)
(*window_hook) (instream, get_prompt ());
@@ -856,22 +853,10 @@ command_loop (void)
reinitialize_more_filter ();
old_chain = make_cleanup (null_cleanup, 0);
-#if defined(TUI)
- /* A bit of paranoia: I want to make sure the "insert_mode" global
- * is clear except when it is being used for command-line editing
- * (see tuiIO.c, utils.c); otherwise normal output will
- * get messed up in the TUI. So clear it before/after
- * the command-line-input call. - RT
- */
- insert_mode = 0;
-#endif
/* Get a command-line. This calls the readline package. */
command = command_line_input (instream == stdin ?
get_prompt () : (char *) NULL,
instream == stdin, "prompt");
-#if defined(TUI)
- insert_mode = 0;
-#endif
if (command == 0)
return;
@@ -1748,16 +1733,6 @@ quit_force (char *args, int from_tty)
write_history (history_filename);
do_final_cleanups (ALL_CLEANUPS); /* Do any final cleanups before exiting */
-
-#if defined(TUI)
- /* tuiDo((TuiOpaqueFuncPtr)tuiCleanUp); */
- /* The above does not need to be inside a tuiDo(), since
- * it is not manipulating the curses screen, but rather,
- * it is tearing it down.
- */
- if (tui_version)
- tuiCleanUp ();
-#endif
exit (exit_code);
}
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.43
diff -u -p -r1.43 utils.c
--- utils.c 2001/07/11 17:52:32 1.43
+++ utils.c 2001/07/14 14:22:25
@@ -1263,15 +1263,7 @@ query (char *ctlstr,...)
wrap_here ("");
gdb_flush (gdb_stdout);
-#if defined(TUI)
- if (!tui_version || cmdWin == tuiWinWithFocus ())
-#endif
- answer = fgetc (stdin);
-#if defined(TUI)
- else
- answer = (unsigned char) tuiBufferGetc ();
-
-#endif
+ answer = fgetc (stdin);
clearerr (stdin); /* in case of C-d */
if (answer == EOF) /* C-d */
{
@@ -1279,21 +1271,13 @@ query (char *ctlstr,...)
break;
}
/* Eat rest of input line, to EOF or newline */
- if ((answer != '\n') || (tui_version && answer != '\r'))
+ if (answer != '\n')
do
{
-#if defined(TUI)
- if (!tui_version || cmdWin == tuiWinWithFocus ())
-#endif
- ans2 = fgetc (stdin);
-#if defined(TUI)
- else
- ans2 = (unsigned char) tuiBufferGetc ();
-#endif
+ ans2 = fgetc (stdin);
clearerr (stdin);
}
while (ans2 != EOF && ans2 != '\n' && ans2 != '\r');
- TUIDO (((TuiOpaqueFuncPtr) tui_vStartNewLines, 1));
if (answer >= 'a')
answer -= 040;