aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-11-18 09:04:39 -0700
committerTom Tromey <tromey@adacore.com>2022-11-28 06:48:43 -0700
commitb70e9270fbafd43a3fece0c7dd52cabd70854dfd (patch)
treec439b062915062261abffad32093e4284e745813 /gdb/cli
parent76cd77dc729b03d6b33c683323594479e33a3f9a (diff)
downloadgdb-b70e9270fbafd43a3fece0c7dd52cabd70854dfd.zip
gdb-b70e9270fbafd43a3fece0c7dd52cabd70854dfd.tar.gz
gdb-b70e9270fbafd43a3fece0c7dd52cabd70854dfd.tar.bz2
Fix crash in "document" command
PR cli/29800 points out that "document" will now crash when the argument is an undefined command. This is a regression due to the "document user-defined aliases" patch. Approved-By: Joel Brobecker <brobecker@adacore.com> Reviewed-By: Philippe Waroquiers <philippe.waroquiers@skynet.be> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29800
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-script.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 2442f7a..2101d6f 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1515,6 +1515,8 @@ do_document_command (const char *comname, int from_tty,
validate_comname (&comname);
lookup_cmd_composition (comfull, &alias, &prefix_cmd, &c);
+ if (c == nullptr)
+ error (_("Undefined command: \"%s\"."), comfull);
if (c->theclass != class_user
&& (alias == nullptr || alias->theclass != class_alias))