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 messages


Jim Blandy writes:
 > On 2/10/06, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
 > > The only way we can ever be consistent is by removing them.  Function
 > > names are an implementation detail.  What if we reorganize the code a
 > > bit, changing the function name.  Should we change the error message?
 > > Or leave it as is, such that it no longer refers to the function that
 > > actually prints that message?
 > 
 > I think this is right.  These GDB function names have no place in a protocol.

Last year I suggested changing messages like:

mi_cmd_var_create: Usage: NAME FRAME EXPRESSION.

to

Usage: -var-create NAME FRAME EXPRESSION

I got some agreement but lost my way with other detail.

If the frontend is working properly then the user shouldn't see most of these
messages, but it may help frontend writers who don't want to look at the
internals of GDB.

In practice, I've only found a problem with one error message, which does
get seen by the user and which I described at the time:


              ...For example, if I inadvertantly
  selected the word warranty before clicking on the tool bar to create a watch
  expression.  The frontend would send:

  -var-create - * warranty

  GDB would reply:

  &"mi_cmd_var_create: unable to create variable object\n"
  ^error,msg="mi_cmd_var_create: unable to create variable object"

  which the frontend could parse, but a more helpful message would be:

   &"No symbol warranty in current context.\n"
   ^error,msg="No symbol warranty in current context."

This is orthogonal to the general discussion and, IMHO, a clear improvement.
Shall I commit it?

Nick


2006-02-12  Nick Roberts  <nickrob@snap.net.nz>

	* mi/mi-cmd-var.c (mi_cmd_var_create): Use an error message that
	is meaningful to the user.

*** mi-cmd-var.c	05 Jan 2006 10:56:18 +1300	1.23
--- mi-cmd-var.c	12 Feb 2006 21:55:07 +1300	
***************
*** 96,102 ****
    var = varobj_create (name, expr, frameaddr, var_type);
  
    if (var == NULL)
!     error (_("mi_cmd_var_create: unable to create variable object"));
  
    ui_out_field_string (uiout, "name", name);
    ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
--- 96,102 ----
    var = varobj_create (name, expr, frameaddr, var_type);
  
    if (var == NULL)
!     error (_("No symbol %s in current context."), expr);
  
    ui_out_field_string (uiout, "name", name);
    ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));


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