old-cross-binutils/gdb/testsuite/gdb.mi
Joel Brobecker 2ea126fa78 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.
2013-12-03 08:01:01 +04:00
..
array.f Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
basics.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
ChangeLog-1999-2003
dw2-ref-missing-frame-func.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
dw2-ref-missing-frame-main.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
dw2-ref-missing-frame.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
dw2-ref-missing-frame.S Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
gdb669.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
gdb680.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
gdb701.c
gdb701.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
gdb792.cc
gdb792.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
gdb2549.exp * gdb.mi/gdb2549.exp (register_tests): Expect any decimal for 2013-07-06 02:32:31 +00:00
Makefile.in 2013-05-21 Hui Zhu <hui@codesourcery.com> 2013-05-21 04:18:55 +00:00
mi-async.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-basics.exp gdb/testsuite/ 2013-07-24 09:17:15 +00:00
mi-break.exp create_breapoint / explicit mode: Error out if there's garbage after the breakpoint location. 2013-04-08 14:09:30 +00:00
mi-breakpoint-changed.exp * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): 2013-10-17 22:02:29 +00:00
mi-catch-load-so.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-catch-load.c gdb/testsuite/ 2013-10-11 07:27:46 +00:00
mi-catch-load.exp gdb/testsuite/ 2013-10-11 07:27:46 +00:00
mi-cli.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-cmd-param-changed.exp fix up gdb.mi 2013-11-04 11:02:06 -07:00
mi-console.c gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables defining change-log-default-name. 2013-10-29 13:48:25 +00:00
mi-console.exp * lib/mi-support.exp (mi_gdb_test): Expect different formats 2013-11-15 19:41:07 -02:00
mi-disassemble.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-dprintf.c 2013-05-21 Hui Zhu <hui@codesourcery.com> 2013-05-21 04:18:55 +00:00
mi-dprintf.exp 2013-07-19 Hui Zhu <hui@codesourcery.com> 2013-07-19 07:26:46 +00:00
mi-eval.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-file-transfer.exp fix up gdb.mi 2013-11-04 11:02:06 -07:00
mi-file.exp Tweak intro comments to some MI test files. 2013-02-12 16:36:07 +00:00
mi-fill-memory.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-fullname-deleted.exp gdb/ 2013-02-03 16:00:36 +00:00
mi-hack-cli.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-i-cmd.exp New GDB/MI command "-info-gdb-mi-command" 2013-12-03 07:57:24 +04:00
mi-info-os.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-inheritance-syntax-error.cc
mi-inheritance-syntax-error.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
mi-language.exp mi-language.exp: Check "langauge-option" in -list-features output. 2013-11-18 15:59:26 +04:00
mi-logging.exp fix up gdb.mi 2013-11-04 11:02:06 -07:00
mi-memory-changed.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-nonstop-exit.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-nonstop.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-ns-stale-regcache.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-nsintrall.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-nsmoribund.exp 2013-01-21 Marc Khouzam <marc.khouzam@ericsson.com> 2013-01-21 23:58:00 +00:00
mi-nsthrexec.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-pending.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-pending.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-pendshr.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-pthreads.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-read-memory.c
mi-read-memory.exp Tweak intro comments to some MI test files. 2013-02-12 16:36:07 +00:00
mi-record-changed.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-reg-undefined.c Resue 'z' formatter from mi register display code. 2013-07-25 10:39:39 +00:00
mi-reg-undefined.exp Print registers not saved in the frame as "<not saved>" instead of "<optimized out>". 2013-10-02 16:15:46 +00:00
mi-reg-undefined.S Resue 'z' formatter from mi register display code. 2013-07-25 10:39:39 +00:00
mi-regs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-return.exp Tweak intro comments to some MI test files. 2013-02-12 16:36:07 +00:00
mi-reverse.exp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
mi-simplerun.exp 2013-01-21 Marc Khouzam <marc.khouzam@ericsson.com> 2013-01-21 23:58:00 +00:00
mi-solib.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-stack.c gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables defining change-log-default-name. 2013-10-29 13:48:25 +00:00
mi-stack.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-start.c Add support for --start option in -exec-run GDB/MI command. 2013-10-04 08:35:31 +00:00
mi-start.exp Add support for --start option in -exec-run GDB/MI command. 2013-10-04 08:35:31 +00:00
mi-stepi.exp Tweak intro comments to some MI test files. 2013-02-12 16:36:07 +00:00
mi-stepn.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
mi-stepn.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-syn-frame.c
mi-syn-frame.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-undefined-cmd.exp Add "undefined-command" error code at end of ^error result... 2013-12-03 08:01:01 +04:00
mi-until.exp Tweak intro comments to some MI test files. 2013-02-12 16:36:07 +00:00
mi-var-block.exp 2013-01-24 Hafiz Abid Qadeer <abidh@codesourcery.com> 2013-01-24 10:29:09 +00:00
mi-var-child-f.exp * gdb.mi/mi-var-child-f.exp: Pass f90 to gdb_compile instead 2013-07-26 18:15:07 +00:00
mi-var-child.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-var-child.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-var-cmd.exp gdb/testsuite/ 2013-07-24 09:17:15 +00:00
mi-var-cp.cc Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
mi-var-cp.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
mi-var-create-rtti.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-var-create-rtti.exp * gdb.mi/mi-var-create-rtti.exp: Create a variable of 2013-04-18 10:08:08 +00:00
mi-var-display.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-var-invalidate.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-var-rtti.cc Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
mi-var-rtti.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
mi-watch-nonstop.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi-watch.exp gdb/testsuite/ 2013-03-15 01:41:29 +00:00
mi2-amd64-entry-value.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi2-amd64-entry-value.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi2-amd64-entry-value.s Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi2-prompt.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
mi2-var-child.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
non-stop-exit.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
non-stop.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
ns-stale-regcache.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
nsintrall.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
nsmoribund.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
nsthrexec.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
pending.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
pendshr1.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
pendshr2.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
pr11022.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
pr11022.exp gdb/testsuite/ 2013-03-15 01:41:29 +00:00
pthreads.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
solib-lib.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
solib-main.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
testcmds
until.c
var-cmd.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
watch-nonstop.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00