]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.base/commands.exp
Fix PR gdb/17035: "show user" doesn't list user-defined commands that
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / commands.exp
index 7363420af47a642102798b1e018023e160e6d51b..74eb3063e8595f59acca8d7a9296fa5aff61235b 100644 (file)
@@ -243,6 +243,28 @@ proc user_defined_command_test {} {
    gdb_test "show user mycommand" \
        "  while \\\$arg0.*set.*    if \\\(\\\$arg0.*p/x.*    else\[^\n\].*p/x.*    end\[^\n\].*  end\[^\n\].*" \
           "display user command in user_defined_command_test"
+
+    # Create and test a user-defined command with an empty body.
+    gdb_test_multiple "define myemptycommand" \
+       "define myemptycommand in user_defined_command_test" {
+           -re "End with"  {
+               pass "define myemptycommand in user_defined_command_test"
+           }
+       }
+    gdb_test "end" \
+       "" \
+       "end definition of user-defined command with empty body"
+
+    gdb_test_no_output "myemptycommand" \
+       "execute user-defined empty command in user_defined_command_test"
+
+    gdb_test "show user" \
+       "User command \"myemptycommand.*" \
+       "display empty command in command list in user_defined_command_test"
+
+    gdb_test "show user myemptycommand" \
+       "User command \"myemptycommand.*" \
+       "display user-defined empty command in user_defined_command_test"
 }
 
 proc watchpoint_command_test {} {