This is the mail archive of the gdb@sourceware.org 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]

Re: MI error msgs and localization


 > > You wouldn't have to remember them, thay're for use by the front-end, not
 > > the user.  In any case the console log stream gets printed alongside,
 > > which should be self-explanatory.  How would you arrange for the type
 > > message to be printed?  Would you give error a second string argument?
 > > It has over 1200 calls.
 > > 
 > >  > We have to be careful what error messages get identifiers, though.
 > >  > Please don't anybody go through the source indiscriminately adding
 > >  > them.  Many errors will still be subject to change even if you tack
 > >  > permanent identifiers on them.
 > > 
 > > All calls to error could be given a dummy argument (0, if numbers are
 > > used), and replaced with a real one only in thoses cases when a need
 > > arises.
 > 
 > You've answered your own question.  The calls which need to be changed
 > could be changed to call something other than error() itself.

That's not quite what I said but it's a better idea as fewer changes need be
made.  Better still might be to use a global variable, perhaps
mi_error_message in mi-main.c could be used.  How about something like the
patch below (in mi_execute_command) to be used like this:

  mi_error_message = xstrprintf ("no-debugging-symbols");
  error(_("No debugging symbols found");

to give:

  &"No debugging symbols found\n"
  ^error,msg="no-debugging-symbols"

I've not used the previous example ("Unrecognized option"), as it comes from
getopt_long_only and not error (however, I think all of Bjarke's other
examples were from error).

WDYT?

Nick


*** mi-main.c	30 Jan 2006 09:17:56 +1300	1.83
--- mi-main.c	15 Feb 2006 14:31:38 +1300	
***************
*** 1171,1177 ****
  	     somewhere.  */
  	  fputs_unfiltered (command->token, raw_stdout);
  	  fputs_unfiltered ("^error,msg=\"", raw_stdout);
! 	  fputstr_unfiltered (result.message, '"', raw_stdout);
  	  fputs_unfiltered ("\"\n", raw_stdout);
  	  mi_out_rewind (uiout);
  	}
--- 1171,1183 ----
  	     somewhere.  */
  	  fputs_unfiltered (command->token, raw_stdout);
  	  fputs_unfiltered ("^error,msg=\"", raw_stdout);
! 	  if (mi_error_message)
! 	    {
! 	      fputstr_unfiltered (mi_error_message, '"', raw_stdout);
! 	      xfree (mi_error_message);
! 	    }
! 	  else
! 	    fputstr_unfiltered (result.message, '"', raw_stdout);
  	  fputs_unfiltered ("\"\n", raw_stdout);
  	  mi_out_rewind (uiout);
  	}


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