summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.guile
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <gabriel@krisman.be>2014-09-07 20:12:19 -0300
committerGabriel Krisman Bertazi <gabriel@krisman.be>2014-09-07 20:12:19 -0300
commita9f116cbf2fb9892ddbc46478b85ebfa99b0074f (patch)
tree9af6dfb3fe79fea2eef868d09d1538d48eeaa2a9 /gdb/testsuite/gdb.guile
parentc75bd3a23915c3122070a95e1974e323543ffbe4 (diff)
downloadbinutils-gdb-a9f116cbf2fb9892ddbc46478b85ebfa99b0074f.tar.gz
Fix PR gdb/17035: "show user" doesn't list user-defined commands that
have empty bodies. User-defined commands that have empty bodies weren't being shown because the print function returned too soon. Now, it prints the command's name before checking if it has any body at all. This also fixes the same problem on "show user <myemptycommand>", which wasn't being printed due to a similar reason. gdb/Changelog: * cli/cli-cmds.c (show_user): Use cli_user_command_p to decide whether we display the command on "show user". * cli/cli-script.c (show_user_1): Only verify cmdlines after printing command name. * cli/cli-decode.h (cli_user_command_p): Declare new function. * cli/cli-decode.c (cli_user_command_p): Create helper function to verify whether cmd_list_element is a user-defined command. gdb/testsuite/Changelog: * gdb.base/commands.exp: Add tests to verify user-defined commands with empty bodies. * gdb.python/py-cmd.exp: Test that we don't show user-defined python commands in `show user command`. * gdb.python/scm-cmd.exp: Test that we don't show user-defined scheme commands in `show user command`.
Diffstat (limited to 'gdb/testsuite/gdb.guile')
-rw-r--r--gdb/testsuite/gdb.guile/scm-cmd.exp4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.guile/scm-cmd.exp b/gdb/testsuite/gdb.guile/scm-cmd.exp
index a407f63c2cd..13ce9c2644d 100644
--- a/gdb/testsuite/gdb.guile/scm-cmd.exp
+++ b/gdb/testsuite/gdb.guile/scm-cmd.exp
@@ -134,6 +134,10 @@ gdb_test "help user-defined" \
"User-defined commands.\[\r\n\]+The commands in this class are those defined by the user.\[\r\n\]+Use the \"define\" command to define a command.\[\r\n\]+List of commands:\[\r\n\]+test-help -- Docstring\[\r\n\]+Type \"help\" followed by command name for full documentation.\[\r\n\]+Type \"apropos word\" to search for commands related to \"word\".\[\r\n\]+Command name abbreviations are allowed if unambiguous.\[\r\n\]+" \
"see user-defined command in `help user-defined`"
+# Make sure the command does not show up in `show user`.
+gdb_test "show user test-help" "Not a user command\." \
+ "don't show user-defined scheme command in `show user command`"
+
# Test expression completion on fields.
gdb_test_multiline "expression completion command" \