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
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))
}
gdb_test_no_output "do-document" "invoke do-document"
gdb_test "help do-document" "usage: do-document" "invoke help do-document"
+
+# Test that document of a non-existing command prints an error. There
+# was a regression at one point causing this to crash.
+gdb_test "document nosuchcommand" "Undefined command: \"nosuchcommand\"\\."