aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2013-11-12 14:51:30 +0400
committerJoel Brobecker <brobecker@adacore.com>2013-12-03 07:57:24 +0400
commit6b7cbff192a5335b96fdcf887b32fc6e0100b6ef (patch)
tree6e8f221ca966fa25c1cdb91156283229bb73268a /gdb/testsuite
parent310bf259c3524c29542f01514bae4be2f21d903e (diff)
downloadgdb-6b7cbff192a5335b96fdcf887b32fc6e0100b6ef.zip
gdb-6b7cbff192a5335b96fdcf887b32fc6e0100b6ef.tar.gz
gdb-6b7cbff192a5335b96fdcf887b32fc6e0100b6ef.tar.bz2
New GDB/MI command "-info-gdb-mi-command"
This patch adds a new GDB/MI command meant for graphical frontends trying to determine whether a given GDB/MI command exists or not. Examples: -info-gdb-mi-command unsupported-command ^done,command={exists="false"} (gdb) -info-gdb-mi-command symbol-list-lines ^done,command={exists="true"} (gdb) At the moment, this is the only piece of information that this command returns. Eventually, and if needed, we can extend it to provide command-specific pieces of information, such as updates to the command's syntax since inception. This could become, for instance: -info-gdb-mi-command symbol-list-lines ^done,command={exists="true",features=[]} (gdb) -info-gdb-mi-command catch-assert ^done,command={exists="true",features=["conditions"]} In the first case, it would mean that no extra features, while in the second, it announces that the -catch-assert command in this version of the debugger supports a feature called "condition" - exact semantics to be documented with combined with the rest of the queried command's documentation. But for now, we start small, and only worry about existance. And to bootstrap the process, I have added an entry in the output of the -list-features command as well ("info-gdb-mi-command"), allowing the graphical frontends to go through the following process: 1. Send -list-features, collect info from there as before; 2. Check if the output contains "info-gdb-mi-command". If it does, then support for various commands can be queried though -info-gdb-mi-command. Newer commands will be expected to always be checked via this new -info-gdb-mi-command. gdb/ChangeLog: * mi/mi-cmds.h (mi_cmd_info_gdb_mi_command): Declare. * mi/mi-cmd-info.c (mi_cmd_info_gdb_mi_command): New function. * mi/mi-cmds.c (mi_cmds): Add -info-gdb-mi-command command. * mi/mi-main.c (mi_cmd_list_features): Add "info-gdb-mi-command" field to output of "-list-features". * NEWS: Add entry for new -info-gdb-mi-command. gdb/doc/ChangeLog: * 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 -list-features. gdb/testsuite/ChangeLog: * gdb.mi/mi-i-cmd.exp: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.mi/mi-i-cmd.exp46
2 files changed, 50 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8be246d..43a7c67 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-03 Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.mi/mi-i-cmd.exp: New file.
+
2013-12-02 Doug Evans <dje@google.com>
* gdb.dwarf/dwp-symlink.c: Fake out gdb to not load debug info
diff --git a/gdb/testsuite/gdb.mi/mi-i-cmd.exp b/gdb/testsuite/gdb.mi/mi-i-cmd.exp
new file mode 100644
index 0000000..802f1ab
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-i-cmd.exp
@@ -0,0 +1,46 @@
+# Copyright 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if [mi_gdb_start] {
+ continue
+}
+
+# First, verify that the debugger correctly advertises support
+# for the -info-gdb-mi-command command.
+mi_gdb_test "-list-features" \
+ "\\^done,features=\\\[.*\"info-gdb-mi-command\".*\\\]" \
+ "-list-features includes \"info-gdb-mi-command\""
+
+mi_gdb_test "-info-gdb-mi-command unsupported-command" \
+ "\\^done,command=\\\{exists=\"false\"\\\}" \
+ "-info-gdb-mi-command unsupported-command"
+
+# Same test as above, but including the leading '-' in the command name.
+mi_gdb_test "-info-gdb-mi-command -unsupported-command" \
+ "\\^done,command=\\\{exists=\"false\"\\\}" \
+ "-info-gdb-mi-command -unsupported-command"
+
+mi_gdb_test "-info-gdb-mi-command symbol-list-lines" \
+ "\\^done,command=\\\{exists=\"true\"\\\}" \
+ "-info-gdb-mi-command symbol-list-lines"
+
+# Same test as above, but including the leading '-' in the command name.
+mi_gdb_test "-info-gdb-mi-command -symbol-list-lines" \
+ "\\^done,command=\\\{exists=\"true\"\\\}" \
+ "-info-gdb-mi-command -symbol-list-lines"