This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA]: Remove tui hacks from gdb source.c


Hi!

The tui hacks in gdb/source.c can all be removed, if in the tui we do
the following:

  - use `identify_source_line' each time the curses source window
    is scrolled.  This is necessary to update the static variable
    `last_line_listed'.

  - have a specific cli that clears the ui_source_list and does some
    filtering on the ui_out fields (which is not easy but works).

The patch below cleans up source.c to remove the tui hacks.

Is it ok?

	Stephane

2001-07-16  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* source.c (find_source_lines): Remove tui test, must be replaced
	by appropriate warning hook.
	(print_source_lines): Remove tui hacks, must be replaced by cli.
	(forward_search_command): Remove tui hacks, can be replaced by
	appropriate calls to identify_source_line when tui scrolls.
	(reverse_search_command): Likewise.
Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.18
diff -u -p -r1.18 source.c
--- source.c	2001/07/07 17:19:50	1.18
+++ source.c	2001/07/16 21:53:40
@@ -797,8 +797,6 @@ find_source_lines (struct symtab *s, int
 
   if (mtime && mtime < st.st_mtime)
     {
-      if (tui_version)
-	printf_filtered ("\n");
       warning ("Source file is more recent than executable.\n");
     }
 
@@ -1134,31 +1132,7 @@ print_source_lines_base (struct symtab *
 void
 print_source_lines (struct symtab *s, int line, int stopline, int noerror)
 {
-#if defined(TUI)
-  if (!tui_version ||
-      m_winPtrIsNull (srcWin) || !srcWin->generic.isVisible)
-    print_source_lines_base (s, line, stopline, noerror);
-  else
-    {
-      TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
-extern void tui_vAddWinToLayout (va_list);
-extern void tui_vUpdateSourceWindowsWithLine (va_list);
-
-      /* Regardless of whether we can open the file,
-         set current_source_symtab. */
-      current_source_symtab = s;
-      current_source_line = line;
-      first_line_listed = line;
-
-      /* make sure that the source window is displayed */
-      tuiDo ((TuiOpaqueFuncPtr) tui_vAddWinToLayout, SRC_WIN);
-
-      tuiDo ((TuiOpaqueFuncPtr) tui_vUpdateSourceWindowsWithLine, s, line);
-      tuiDo ((TuiOpaqueFuncPtr) tui_vUpdateLocatorFilename, s->filename);
-    }
-#else
   print_source_lines_base (s, line, stopline, noerror);
-#endif
 }
 
 
@@ -1463,29 +1437,7 @@ forward_search_command (char *regex, int
   int line;
   char *msg;
 
-#if defined(TUI)
-  /* 
-     ** If this is the TUI, search from the first line displayed in 
-     ** the source window, otherwise, search from last_line_listed+1 
-     ** in current_source_symtab 
-   */
-  if (!tui_version)
-    line = last_line_listed;
-  else
-    {
-      if (srcWin->generic.isVisible && srcWin->generic.contentSize > 0)
-	line = ((TuiWinContent)
-	 srcWin->generic.content)[0]->whichElement.source.lineOrAddr.lineNo;
-      else
-	{
-	  printf_filtered ("No source displayed.\nExpression not found.\n");
-	  return;
-	}
-    }
-  line++;
-#else
   line = last_line_listed + 1;
-#endif
 
   msg = (char *) re_comp (regex);
   if (msg)
@@ -1557,8 +1509,6 @@ forward_search_command (char *regex, int
 	{
 	  /* Match! */
 	  fclose (stream);
-	  if (tui_version)
-	    print_source_lines_base (current_source_symtab, line, line + 1, 0);
 	  print_source_lines (current_source_symtab, line, line + 1, 0);
 	  set_internalvar (lookup_internalvar ("_"),
 			   value_from_longest (builtin_type_int,
@@ -1582,29 +1532,8 @@ reverse_search_command (char *regex, int
   register FILE *stream;
   int line;
   char *msg;
-#if defined(TUI)
-  /*
-     ** If this is the TUI, search from the first line displayed in
-     ** the source window, otherwise, search from last_line_listed-1
-     ** in current_source_symtab
-   */
-  if (!tui_version)
-    line = last_line_listed;
-  else
-    {
-      if (srcWin->generic.isVisible && srcWin->generic.contentSize > 0)
-	line = ((TuiWinContent)
-	 srcWin->generic.content)[0]->whichElement.source.lineOrAddr.lineNo;
-      else
-	{
-	  printf_filtered ("No source displayed.\nExpression not found.\n");
-	  return;
-	}
-    }
-  line--;
-#else
+
   line = last_line_listed - 1;
-#endif
 
   msg = (char *) re_comp (regex);
   if (msg)
@@ -1665,8 +1594,6 @@ reverse_search_command (char *regex, int
 	{
 	  /* Match! */
 	  fclose (stream);
-	  if (tui_version)
-	    print_source_lines_base (current_source_symtab, line, line + 1, 0);
 	  print_source_lines (current_source_symtab, line, line + 1, 0);
 	  set_internalvar (lookup_internalvar ("_"),
 			   value_from_longest (builtin_type_int,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]