diff options
author | Joel Brobecker <brobecker@adacore.com> | 2013-11-18 16:55:16 +0400 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2013-12-03 08:01:01 +0400 |
commit | 2ea126fa785cf0d2b26cdba5c6ad8b8548b7ef15 (patch) | |
tree | c09c4483a252c3d6d98906d5167702028eacff2c /gdb/doc | |
parent | 6b7cbff192a5335b96fdcf887b32fc6e0100b6ef (diff) | |
download | gdb-2ea126fa785cf0d2b26cdba5c6ad8b8548b7ef15.zip gdb-2ea126fa785cf0d2b26cdba5c6ad8b8548b7ef15.tar.gz gdb-2ea126fa785cf0d2b26cdba5c6ad8b8548b7ef15.tar.bz2 |
Add "undefined-command" error code at end of ^error result...
... when trying to execute an undefined GDB/MI command. When trying
to execute a GDB/MI command which does not exist, the current error
result record looks like this:
-unsupported
^error,msg="Undefined MI command: unsupported"
The only indication that the command does not exist is the error
message. It would be a little fragile for a consumer to rely solely
on the contents of the error message in order to determine whether
a command exists or not.
This patch improves the situation by adding concept of error
code, starting with one well-defined error code ("undefined-command")
identifying errors due to a non-existant command. Here is the new
output:
-unsupported
^error,msg="Undefined MI command: unsupported",code="undefined-command"
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."
For frontends to be able to know whether they can rely on this
variable, a new entry "undefined-command-error-code" has been
added to the "-list-features" command. Another option would be
to always generate an error="..." variable (for the default case,
we could decide for instance that the error code is the empty string).
But it seems more efficient to provide that info in "-list-features"
and then only add the error code when meaningful.
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): Throw 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 is 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.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 19 |
2 files changed, 25 insertions, 3 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 329c293..fdb05c5 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,5 +1,14 @@ 2013-12-03 Joel Brobecker <brobecker@adacore.com> + * 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. + +2013-12-03 Joel Brobecker <brobecker@adacore.com> + * gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new -info-gdb-mi-command GDB/MI command. Document the meaning of "-info-gdb-mi-command" in the output of diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 5b1021b..75633c9 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -29333,10 +29333,19 @@ which threads are resumed. @findex ^connected @value{GDBN} has connected to a remote target. -@item "^error" "," @var{c-string} +@item "^error" "," "msg=" @var{c-string} [ "," "code=" @var{c-string} ] @findex ^error -The operation failed. The @code{@var{c-string}} contains the corresponding -error message. +The operation failed. The @code{msg=@var{c-string}} variable contains +the corresponding error message. + +If present, the @code{code=@var{c-string}} variable provides an error +code on which consumers can rely on to detect the corresponding +error condition. At present, only one error code is defined: + +@table @samp +@item "undefined-command" +Indicates that the command causing the error does not exist. +@end table @item "^exit" @findex ^exit @@ -35204,6 +35213,10 @@ Indicates that all @sc{gdb/mi} commands accept the @option{--language} option (@pxref{Context management}). @item info-gdb-mi-command Indicates support for the @code{-info-gdb-mi-command} command. +@item undefined-command-error-code +Indicates support for the "undefined-command" error code in error result +records, produced when trying to execute an undefined @sc{gdb/mi} command +(@pxref{GDB/MI Result Records}). @end table @subheading The @code{-list-target-features} Command |