aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-05-03 17:03:40 -0600
committerTom Tromey <tromey@adacore.com>2019-05-10 09:57:42 -0600
commit71bed2dba6c0706633ead4994cc89e063abf28ea (patch)
tree12f71d62fde277264cba623d07ca398ff241b236 /gdb/ada-lang.c
parentb8e07335d04f8c8e611a65905598915f68b0b707 (diff)
downloadgdb-71bed2dba6c0706633ead4994cc89e063abf28ea.zip
gdb-71bed2dba6c0706633ead4994cc89e063abf28ea.tar.gz
gdb-71bed2dba6c0706633ead4994cc89e063abf28ea.tar.bz2
Add completion for Ada catch commands
This patch adds a completion function to the "catch exception" and "catch handlers" commands. Tested on x86-64 Fedora 29; reviewed off-list by Joel. gdb/ChangeLog 2019-05-10 Tom Tromey <tromey@adacore.com> * ada-lang.c (catch_ada_completer): New function. (_initialize_ada_language): Use it. gdb/testsuite/ChangeLog 2019-05-10 Tom Tromey <tromey@adacore.com> * gdb.ada/info_exc.exp: Add "complete" test.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index e513280..dee3a83 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13342,6 +13342,22 @@ catch_ada_handlers_command (const char *arg_entry, int from_tty,
from_tty);
}
+/* Completion function for the Ada "catch" commands. */
+
+static void
+catch_ada_completer (struct cmd_list_element *cmd, completion_tracker &tracker,
+ const char *text, const char *word)
+{
+ std::vector<ada_exc_info> exceptions = ada_exceptions_list (NULL);
+
+ for (const ada_exc_info &info : exceptions)
+ {
+ if (startswith (info.name, word))
+ tracker.add_completion
+ (gdb::unique_xmalloc_ptr<char> (xstrdup (info.name)));
+ }
+}
+
/* Split the arguments specified in a "catch assert" command.
ARGS contains the command's arguments (or the empty string if
@@ -14562,7 +14578,7 @@ termination).\n\
Otherwise, the catchpoint only stops when the name of the exception being\n\
raised is the same as ARG."),
catch_ada_exception_command,
- NULL,
+ catch_ada_completer,
CATCH_PERMANENT,
CATCH_TEMPORARY);
@@ -14570,7 +14586,7 @@ raised is the same as ARG."),
Catch Ada exceptions, when handled.\n\
With an argument, catch only exceptions with the given name."),
catch_ada_handlers_command,
- NULL,
+ catch_ada_completer,
CATCH_PERMANENT,
CATCH_TEMPORARY);
add_catch_command ("assert", _("\