aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-decode.c13
-rw-r--r--gdb/cli/cli-script.c2
2 files changed, 12 insertions, 3 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index a69939e..bbabd40 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -2549,7 +2549,8 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
If TEXT is a subcommand (i.e. one that is preceded by a prefix
command) set *PREFIX_CMD.
- Set *CMD to point to the command TEXT indicates.
+ Set *CMD to point to the command TEXT indicates, or to
+ CMD_LIST_AMBIGUOUS if there are multiple possible matches.
If any of *ALIAS, *PREFIX_CMD, or *CMD cannot be determined or do not
exist, they are NULL when we return.
@@ -2589,7 +2590,12 @@ lookup_cmd_composition_1 (const char *text,
*cmd = find_cmd (command.c_str (), len, cur_list, 1, &nfound);
/* We only handle the case where a single command was found. */
- if (*cmd == CMD_LIST_AMBIGUOUS || *cmd == nullptr)
+ if (nfound > 1)
+ {
+ *cmd = CMD_LIST_AMBIGUOUS;
+ return 0;
+ }
+ else if (*cmd == nullptr)
return 0;
else
{
@@ -2623,7 +2629,8 @@ lookup_cmd_composition_1 (const char *text,
If TEXT is a subcommand (i.e. one that is preceded by a prefix
command) set *PREFIX_CMD.
- Set *CMD to point to the command TEXT indicates.
+ Set *CMD to point to the command TEXT indicates, or to
+ CMD_LIST_AMBIGUOUS if there are multiple possible matches.
If any of *ALIAS, *PREFIX_CMD, or *CMD cannot be determined or do not
exist, they are NULL when we return.
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 439ba50..f06724a 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1521,6 +1521,8 @@ do_document_command (const char *comname, int from_tty,
lookup_cmd_composition (comfull, &alias, &prefix_cmd, &c);
if (c == nullptr)
error (_("Undefined command: \"%s\"."), comfull);
+ else if (c == CMD_LIST_AMBIGUOUS)
+ error (_("Ambiguous command: \"%s\"."), comfull);
if (c->theclass != class_user
&& (alias == nullptr || alias->theclass != class_alias))