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]
Other format: [Raw text]

[commit] Cleanup cli/cli-script.c's use of error/quit pre print


It's no longer doing anything.

committed,
Andrew
2005-01-17  Andrew Cagney  <cagney@gnu.org>

	* top.h (source_error, source_pre_error): Delete declaration.
	* cli/cli-script.c (source_error_allocated, source_error): Delete.
	(script_from_file, source_cleanup_lines): Do not manipulate
	source_error_allocated, error_pre_print and source_error.
	(struct source_cleanup_lines_args): Delete fields old_pre_error,
	and old_error_pre_print.
	* top.c (source_error_allocated, source_error)
	(source_pre_error): Delete.
	(command_line_input): Do not set error_pre_print.
	* event-top.c (command_line_handler): Do not set error_pre_print.

Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.36
diff -p -u -r1.36 event-top.c
--- event-top.c	12 Jan 2005 18:31:31 -0000	1.36
+++ event-top.c	17 Jan 2005 16:15:13 -0000
@@ -1,5 +1,8 @@
 /* Top level stuff for GDB, the GNU debugger.
-   Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+
+   Copyright 1999, 2000, 2001, 2002, 2004, 2005 Free Software
+   Foundation, Inc.
+
    Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
 
    This file is part of GDB.
@@ -646,15 +649,7 @@ command_line_handler (char *rl)
   gdb_flush (gdb_stderr);
 
   if (source_file_name != NULL)
-    {
-      ++source_line_number;
-      sprintf (source_error,
-	       "%s%s:%d: Error in sourced command file:\n",
-	       source_pre_error,
-	       source_file_name,
-	       source_line_number);
-      error_pre_print = source_error;
-    }
+    ++source_line_number;
 
   /* If we are in this case, then command_handler will call quit 
      and exit from gdb. */
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.95
diff -p -u -r1.95 top.c
--- top.c	12 Jan 2005 18:31:33 -0000	1.95
+++ top.c	17 Jan 2005 16:15:13 -0000
@@ -1,7 +1,7 @@
 /* Top level stuff for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -319,21 +319,6 @@ quit_cover (void *s)
    event-top.c into this file, top.c */
 /* static */ char *source_file_name;
 
-/* Buffer containing the error_pre_print used by the source stuff.
-   Malloc'd.  */
-/* NOTE 1999-04-29: This variable will be static again, once we modify
-   gdb to use the event loop as the default command loop and we merge
-   event-top.c into this file, top.c */
-/* static */ char *source_error;
-static int source_error_allocated;
-
-/* Something to glom on to the start of error_pre_print if source_file_name
-   is set.  */
-/* NOTE 1999-04-29: This variable will be static again, once we modify
-   gdb to use the event loop as the default command loop and we merge
-   event-top.c into this file, top.c */
-/* static */ char *source_pre_error;
-
 /* Clean up on error during a "source" command (or execution of a
    user-defined command).  */
 
@@ -873,15 +858,7 @@ command_line_input (char *prompt_arg, in
       gdb_flush (gdb_stderr);
 
       if (source_file_name != NULL)
-	{
-	  ++source_line_number;
-	  sprintf (source_error,
-		   "%s%s:%d: Error in sourced command file:\n",
-		   source_pre_error,
-		   source_file_name,
-		   source_line_number);
-	  error_pre_print = source_error;
-	}
+	++source_line_number;
 
       if (annotation_level > 1 && instream == stdin)
 	{
Index: top.h
===================================================================
RCS file: /cvs/src/src/gdb/top.h,v
retrieving revision 1.10
diff -p -u -r1.10 top.h
--- top.h	19 Jan 2004 19:56:02 -0000	1.10
+++ top.h	17 Jan 2005 16:15:13 -0000
@@ -1,6 +1,7 @@
 /* Top level stuff for GDB, the GNU debugger.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996,
-   1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+   1996, 1997, 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -65,8 +66,6 @@ extern void gdb_init (char *);
 /* Variables from top.c. */
 extern int source_line_number;
 extern char *source_file_name;
-extern char *source_error;
-extern char *source_pre_error;
 extern int history_expansion_p;
 extern int server_command;
 extern char *lim_at_start;
Index: cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.25
diff -p -u -r1.25 cli-script.c
--- cli/cli-script.c	16 Jan 2005 21:20:05 -0000	1.25
+++ cli/cli-script.c	17 Jan 2005 16:15:14 -0000
@@ -48,9 +48,6 @@ static void validate_comname (char *);
 /* Level of control structure.  */
 static int control_level;
 
-/* Source command state variable. */
-static int source_error_allocated;
-
 /* Structure for arguments to user defined functions.  */
 #define MAXUSERARGS 10
 struct user_args
@@ -1230,8 +1227,6 @@ struct source_cleanup_lines_args
 {
   int old_line;
   char *old_file;
-  char *old_pre_error;
-  char *old_error_pre_print;
 };
 
 static void
@@ -1241,8 +1236,6 @@ source_cleanup_lines (void *args)
   (struct source_cleanup_lines_args *) args;
   source_line_number = p->old_line;
   source_file_name = p->old_file;
-  source_pre_error = p->old_pre_error;
-  error_pre_print = p->old_error_pre_print;
 }
 
 static void
@@ -1281,30 +1274,13 @@ script_from_file (FILE *stream, char *fi
 
   old_lines.old_line = source_line_number;
   old_lines.old_file = source_file_name;
-  old_lines.old_pre_error = source_pre_error;
-  old_lines.old_error_pre_print = error_pre_print;
   make_cleanup (source_cleanup_lines, &old_lines);
   source_line_number = 0;
   source_file_name = file;
-  source_pre_error = error_pre_print == NULL ? "" : error_pre_print;
-  source_pre_error = savestring (source_pre_error, strlen (source_pre_error));
-  make_cleanup (xfree, source_pre_error);
   /* This will get set every time we read a line.  So it won't stay "" for
      long.  */
   error_pre_print = "";
 
-  needed_length = strlen (source_file_name) + strlen (source_pre_error) + 80;
-  if (source_error_allocated < needed_length)
-    {
-      source_error_allocated *= 2;
-      if (source_error_allocated < needed_length)
-	source_error_allocated = needed_length;
-      if (source_error == NULL)
-	source_error = xmalloc (source_error_allocated);
-      else
-	source_error = xrealloc (source_error, source_error_allocated);
-    }
-
   {
     struct exception e;
     struct wrapped_read_command_file_args args;
@@ -1318,10 +1294,8 @@ script_from_file (FILE *stream, char *fi
       case RETURN_ERROR:
 	/* Re-throw the error, but with the file name information
 	   prepended.  */
-	throw_error (e.error, "%s%s:%d: Error in sourced command file:\n%s",
-		     source_pre_error, source_file_name,
-		     source_line_number,
-		     e.message);
+	throw_error (e.error, "%s:%d: Error in sourced command file:\n%s",
+		     source_file_name, source_line_number, e.message);
       default:
 	internal_error (__FILE__, __LINE__, "bad reason");
       }

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