Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Zap remaining calls to error_begin()
@ 2002-01-31 11:05 Andrew Cagney
  2002-02-01 19:43 ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2002-01-31 11:05 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

Hello,

This removes the remaining calls to the function error_begin().  Instead 
it uses error() or error_stream().  The calls in language.c are removed 
in a separate patch.

It also replaces cplusplus_hint() and call code with cplusplus_error(). 
  Any one got a better name?

enjoy,
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 8481 bytes --]

2002-01-31  Andrew Cagney  <ac131313@redhat.com>

	* utils.c (error_begin): Make static.
	* defs.h (error_begin): Delete declaration.

	* linespec.c (cplusplus_error): Replace cplusplus_hint.
	(decode_line_1): Use cplusplus_error instead of error_begin,
	cplusplus_hint and return_to_top_level.
	* coffread.c (coff_symfile_read): Use error instead of error_begin
	and return_to_top_level.
	* infrun.c (default_skip_permanent_breakpoint): Ditto.

Index: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.22
diff -p -r1.22 coffread.c
*** coffread.c	2002/01/05 04:30:15	1.22
--- coffread.c	2002/01/31 18:57:22
*************** coff_symfile_read (struct objfile *objfi
*** 668,680 ****
      {
        if (!info->stabstrsect)
  	{
! 	  error_begin ();
! 	  fprintf_filtered
! 	    (gdb_stderr,
! 	     ("The debugging information in `%s' is corrupted.\n"
! 	   "The file has a `.stabs' section, but no `.stabstr' section.\n"),
! 	     name);
! 	  return_to_top_level (RETURN_ERROR);
  	}
  
        /* FIXME: dubious.  Why can't we use something normal like
--- 668,677 ----
      {
        if (!info->stabstrsect)
  	{
! 	  error (("The debugging information in `%s' is corrupted.\n"
! 		  "The file has a `.stabs' section, but no `.stabstr' "
! 		  "section."),
! 		 name);
  	}
  
        /* FIXME: dubious.  Why can't we use something normal like
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.74
diff -p -r1.74 defs.h
*** defs.h	2002/01/31 04:10:51	1.74
--- defs.h	2002/01/31 18:58:13
*************** extern NORETURN void verror (const char 
*** 1068,1076 ****
  
  extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN;
  
- /* DEPRECATED: Use error(), verror() or error_stream(). */
- extern NORETURN void error_begin (void);
- 
  extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN;
  
  /* Returns a freshly allocate buffer containing the last error
--- 1068,1073 ----
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.50
diff -p -r1.50 infrun.c
*** infrun.c	2002/01/17 22:15:17	1.50
--- infrun.c	2002/01/31 18:59:24
*************** static int may_follow_exec = MAY_FOLLOW_
*** 232,243 ****
  static void
  default_skip_permanent_breakpoint (void)
  {
!   error_begin ();
!   fprintf_filtered (gdb_stderr, "\
  The program is stopped at a permanent breakpoint, but GDB does not know\n\
  how to step past a permanent breakpoint on this architecture.  Try using\n\
! a command like `return' or `jump' to continue execution.\n");
!   return_to_top_level (RETURN_ERROR);
  }
  #endif
     
--- 232,241 ----
  static void
  default_skip_permanent_breakpoint (void)
  {
!   error ("\
  The program is stopped at a permanent breakpoint, but GDB does not know\n\
  how to step past a permanent breakpoint on this architecture.  Try using\n\
! a command like `return' or `jump' to continue execution.");
  }
  #endif
     
Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.13
diff -p -r1.13 linespec.c
*** linespec.c	2001/12/10 22:04:10	1.13
--- linespec.c	2002/01/31 19:00:01
*************** extern char *operator_chars (char *, cha
*** 42,48 ****
  
  /* Prototypes for local functions */
  
! static void cplusplus_hint (char *name);
  
  static int total_number_of_methods (struct type *type);
  
--- 42,48 ----
  
  /* Prototypes for local functions */
  
! static void cplusplus_error (const char *name, const char *fmt, ...) ATTR_FORMAT (printf, 2, 3);
  
  static int total_number_of_methods (struct type *type);
  
*************** static struct symtabs_and_lines decode_l
*** 58,74 ****
  
  /* Helper functions. */
  
! /* While the C++ support is still in flux, issue a possibly helpful hint on
!    using the new command completion feature on single quoted demangled C++
!    symbols.  Remove when loose ends are cleaned up.   FIXME -fnf */
  
  static void
! cplusplus_hint (char *name)
  {
    while (*name == '\'')
      name++;
!   printf_filtered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name);
!   printf_filtered ("(Note leading single quote.)\n");
  }
  
  /* Return the number of methods described for TYPE, including the
--- 58,88 ----
  
  /* Helper functions. */
  
! /* Issue a helpful hint on using the command completion feature on
!    single quoted demangled C++ symbols as part of the completion
!    error.  */
  
  static void
! cplusplus_error (const char *name, const char *fmt, ...)
  {
+   struct ui_file *tmp_stream;
+   tmp_stream = mem_fileopen ();
+   make_cleanup_ui_file_delete (tmp_stream);
+ 
+   {
+     va_list args;
+     va_start (args, fmt);
+     vfprintf_unfiltered (tmp_stream, fmt, args);
+     va_end (args);
+   }
+ 
    while (*name == '\'')
      name++;
!   fprintf_unfiltered (tmp_stream,
! 		      ("Hint: try '%s<TAB> or '%s<ESC-?>\n"
! 		       "(Note leading single quote.)"),
! 		      name, name);
!   error_stream (tmp_stream);
  }
  
  /* Return the number of methods described for TYPE, including the
*************** decode_line_1 (char **argptr, int funfir
*** 722,731 ****
     opname = cplus_mangle_opname (tmp, DMGL_ANSI);
     if (opname == NULL)
     {
!    error_begin ();
!    printf_filtered ("no mangling for \"%s\"\n", tmp);
!    cplusplus_hint (saved_arg);
!    return_to_top_level (RETURN_ERROR);
     }
     copy = (char*) alloca (3 + strlen(opname));
     sprintf (copy, "__%s", opname);
--- 736,742 ----
     opname = cplus_mangle_opname (tmp, DMGL_ANSI);
     if (opname == NULL)
     {
!    cplusplus_error (saved_arg, "no mangling for \"%s\"\n", tmp);
     }
     copy = (char*) alloca (3 + strlen(opname));
     sprintf (copy, "__%s", opname);
*************** decode_line_1 (char **argptr, int funfir
*** 810,826 ****
  			}
  		      else
  			tmp = copy;
- 		      error_begin ();
  		      if (tmp[0] == '~')
! 			printf_filtered
! 			  ("the class `%s' does not have destructor defined\n",
! 			   SYMBOL_SOURCE_NAME (sym_class));
  		      else
! 			printf_filtered
! 			  ("the class %s does not have any method named %s\n",
! 			   SYMBOL_SOURCE_NAME (sym_class), tmp);
! 		      cplusplus_hint (saved_arg);
! 		      return_to_top_level (RETURN_ERROR);
  		    }
  		}
  
--- 821,834 ----
  			}
  		      else
  			tmp = copy;
  		      if (tmp[0] == '~')
! 			cplusplus_error (saved_arg,
! 					 "the class `%s' does not have destructor defined\n",
! 					 SYMBOL_SOURCE_NAME (sym_class));
  		      else
! 			cplusplus_error (saved_arg,
! 					 "the class %s does not have any method named %s\n",
! 					 SYMBOL_SOURCE_NAME (sym_class), tmp);
  		    }
  		}
  
*************** decode_line_1 (char **argptr, int funfir
*** 873,884 ****
  	    goto symbol_found;
  
  	  /* Couldn't find any interpretation as classes/namespaces, so give up */
- 	  error_begin ();
  	  /* The quotes are important if copy is empty.  */
! 	  printf_filtered
! 	    ("Can't find member of namespace, class, struct, or union named \"%s\"\n", copy);
! 	  cplusplus_hint (saved_arg);
! 	  return_to_top_level (RETURN_ERROR);
  	}
        /*  end of C++  */
  
--- 881,890 ----
  	    goto symbol_found;
  
  	  /* Couldn't find any interpretation as classes/namespaces, so give up */
  	  /* The quotes are important if copy is empty.  */
! 	  cplusplus_error (saved_arg,
! 			   "Can't find member of namespace, class, struct, or union named \"%s\"\n",
! 			   copy);
  	}
        /*  end of C++  */
  
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.58
diff -p -r1.58 utils.c
*** utils.c	2002/01/31 04:10:51	1.58
--- utils.c	2002/01/31 19:00:12
*************** warning (const char *string,...)
*** 600,606 ****
     error() provides a convenient way to do this for the special case
     that the error message can be formatted with a single printf call,
     but this is more general.  */
! void
  error_begin (void)
  {
    if (error_begin_hook)
--- 600,606 ----
     error() provides a convenient way to do this for the special case
     that the error message can be formatted with a single printf call,
     but this is more general.  */
! static void
  error_begin (void)
  {
    if (error_begin_hook)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] Zap remaining calls to error_begin()
  2002-01-31 11:05 [patch] Zap remaining calls to error_begin() Andrew Cagney
@ 2002-02-01 19:43 ` Andrew Cagney
  2002-02-04  3:22   ` Richard Earnshaw
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2002-02-01 19:43 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

> 2002-01-31  Andrew Cagney  <ac131313@redhat.com>
> 
> * utils.c (error_begin): Make static.
> 	* defs.h (error_begin): Delete declaration.
> 
> 	* linespec.c (cplusplus_error): Replace cplusplus_hint.
> 	(decode_line_1): Use cplusplus_error instead of error_begin,
> 	cplusplus_hint and return_to_top_level.
> 	* coffread.c (coff_symfile_read): Use error instead of error_begin
> 	and return_to_top_level.
> 	* infrun.c (default_skip_permanent_breakpoint): Ditto.
> 
> 
I've checked this in.


Andrew




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] Zap remaining calls to error_begin()
  2002-02-01 19:43 ` Andrew Cagney
@ 2002-02-04  3:22   ` Richard Earnshaw
  2002-02-04  7:27     ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw @ 2002-02-04  3:22 UTC (permalink / raw)
  To: Andrew Cagney, gdb-patches; +Cc: Richard.Earnshaw

> > 2002-01-31  Andrew Cagney  <ac131313@redhat.com>
> > 
> > * utils.c (error_begin): Make static.
> >       * defs.h (error_begin): Delete declaration.
> > 
> >       * linespec.c (cplusplus_error): Replace cplusplus_hint.
> >       (decode_line_1): Use cplusplus_error instead of error_begin,
> >       cplusplus_hint and return_to_top_level.
> >       * coffread.c (coff_symfile_read): Use error instead of error_begin
> >       and return_to_top_level.
> >       * infrun.c (default_skip_permanent_breakpoint): Ditto.
> > 
> 
> I've checked this in.

I'm not sure if this is related, but I'm now seeing a regression in the 
testsuite for an arm-netbsd target:

FAIL: gdb.c++/annota2.exp: annotate-quit

Since the missing text from the log is:

-   error-begin 
- Quit 
-  
-   quit 
 
I think the smoking gun must be pointing somewhere in this direction.

R.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] Zap remaining calls to error_begin()
  2002-02-04  3:22   ` Richard Earnshaw
@ 2002-02-04  7:27     ` Daniel Jacobowitz
  2002-02-04  8:39       ` Richard Earnshaw
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-02-04  7:27 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: Andrew Cagney, gdb-patches

On Mon, Feb 04, 2002 at 11:21:54AM +0000, Richard Earnshaw wrote:
> > > 2002-01-31  Andrew Cagney  <ac131313@redhat.com>
> > > 
> > > * utils.c (error_begin): Make static.
> > >       * defs.h (error_begin): Delete declaration.
> > > 
> > >       * linespec.c (cplusplus_error): Replace cplusplus_hint.
> > >       (decode_line_1): Use cplusplus_error instead of error_begin,
> > >       cplusplus_hint and return_to_top_level.
> > >       * coffread.c (coff_symfile_read): Use error instead of error_begin
> > >       and return_to_top_level.
> > >       * infrun.c (default_skip_permanent_breakpoint): Ditto.
> > > 
> > 
> > I've checked this in.
> 
> I'm not sure if this is related, but I'm now seeing a regression in the 
> testsuite for an arm-netbsd target:
> 
> FAIL: gdb.c++/annota2.exp: annotate-quit
> 
> Since the missing text from the log is:
> 
> -   error-begin 
> - Quit 
> -  
> -   quit 
>  
> I think the smoking gun must be pointing somewhere in this direction.

Try running the test a couple dozen times, and see what happens,
please?

This test fails spuriously, or perhaps passes spuriously.  I think
there's something actually wrong with GDB's signal handling in relation
to the way expect invokes us.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] Zap remaining calls to error_begin()
  2002-02-04  7:27     ` Daniel Jacobowitz
@ 2002-02-04  8:39       ` Richard Earnshaw
  2002-02-04  9:04         ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Earnshaw @ 2002-02-04  8:39 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Richard.Earnshaw, Andrew Cagney, gdb-patches

> I'm not sure if this is related, but I'm now seeing a regression in the 
> > testsuite for an arm-netbsd target:
> > 
> > FAIL: gdb.c++/annota2.exp: annotate-quit
> 
> Try running the test a couple dozen times, and see what happens,
> please?
> 
> This test fails spuriously, or perhaps passes spuriously.  I think
> there's something actually wrong with GDB's signal handling in relation
> to the way expect invokes us.

Hmm, yes you're right.  I've run it a couple of dozen times with no 
failures, so it looks like the bogon was in the original run.

I'll keep an eye on it, so see if it throws another wobbly at some point.

R.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] Zap remaining calls to error_begin()
  2002-02-04  8:39       ` Richard Earnshaw
@ 2002-02-04  9:04         ` Andrew Cagney
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2002-02-04  9:04 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: Daniel Jacobowitz, gdb-patches

Suggest adding a comment near that test (adding (rather than changing) 
comments are always obvious :-) and the usual bug report.

Andrew

PS: Phew!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-02-04 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31 11:05 [patch] Zap remaining calls to error_begin() Andrew Cagney
2002-02-01 19:43 ` Andrew Cagney
2002-02-04  3:22   ` Richard Earnshaw
2002-02-04  7:27     ` Daniel Jacobowitz
2002-02-04  8:39       ` Richard Earnshaw
2002-02-04  9:04         ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox