[RFA 2/2] Add "undefined-command" error code at end of ^error result...

Joel Brobecker brobecker@adacore.com
Tue Nov 19 06:02:00 GMT 2013


Note to code reviewers: While working on Eli's comments, I've also
used that opportunity to rename UNKNOWN_COMMAND_ERROR Into
UNDEFINED_COMMAND_ERROR.  Everything should be nicely consistent, now.

> > This error code is only displayed when the corresponding error
> > condition is met. Otherwise, the error record remains unchanged.
> > For instance:
> > 
> >     -symbol-list-lines foo.adb
> >     ^error,msg="-symbol-list-lines: Unknown source file name."
> 
> Doesn't this constitute a reason for bumping the MI revision?

I do not think so, because the change is upward compatible
(consumers are expected to ignore fields they do not handle).

> > +  ** The "^error" result record returned when trying to execute an undefined
> > +     GDB/MI command now provides a variable named "code" whose content is the
> > +     "undefined-command" error code.
> 
> OK, but I would mention the fact that this can be inquired about, as
> you described in your message.

OK. New version attached.

> > +@item "^error" "," "msg=" @var{c-string} [ "," "code=" @var{c-string} ]
> >  @findex ^error
> > -The operation failed.  The @code{@var{c-string}} contains the corresponding
> > +The operation failed.  The @var{msg} variable contains the corresponding
> >  error message.
> >  
> > +If present, the @var{code} variable provides an error code on which
> 
> The markup is wrong here: "code" is not a variable, it is a literal
> symbol.  You probably meant "c-string" instead.

I've updated both "code" and "msg" (just above). Let me know if it reads
better for you. ("code" is the name of a variable in GDB/MI lexicon).

gdb/ChangeLog:

        (from Pedro Alves  <palves@redhat.com>)
        (from Joel Brobecker  <brobecker@adacore.com>)
        * exceptions.h (enum_errors) <UNDEFINED_COMMAND_ERROR>: New enum.
        * mi/mi-parse.c (mi_parse): Thow UNDEFINED_COMMAND_ERROR instead
        of a regular error when the GDB/MI command does not exist.
        * mi/mi-main.c (mi_cmd_list_features): Add
        "undefined-command-error-code".
        (mi_print_exception): Print an "undefined-command"
        error code if EXCEPTION.ERROR in UNDEFINED_COMMAND_ERROR.
        * NEWS: Add entry documenting the new "code" variable in
        "^error" result records.

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Result Records): Fix the syntax of the
        "^error" result record concerning the error message.  Document
        the error code that may also be part of that result record.
        (GDB/MI Miscellaneous Commands): Document the
        "undefined-command-error-code" element in the output of
        the "-list-features" GDB/MI command.

gdb/testsuite/ChangeLog:

        * gdb.mi/mi-undefined-cmd.exp: New testcase.

All retested on x86_64-linux.  OK to check in?

Thank you,
-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-undefined-command-error-code-at-end-of-error-res.patch
Type: text/x-diff
Size: 8880 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20131119/4d01fe2d/attachment.bin>


More information about the Gdb-patches mailing list