binutils-gdb/gdb/cli
Gabriel Krisman Bertazi a9f116cbf2 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`.
2014-09-07 20:12:19 -03:00
..
cli-cmds.c Fix PR gdb/17035: "show user" doesn't list user-defined commands that 2014-09-07 20:12:19 -03:00
cli-cmds.h Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
cli-decode.c Fix PR gdb/17035: "show user" doesn't list user-defined commands that 2014-09-07 20:12:19 -03:00
cli-decode.h Fix PR gdb/17035: "show user" doesn't list user-defined commands that 2014-09-07 20:12:19 -03:00
cli-dump.c Include string.h in common-defs.h 2014-08-07 09:06:47 +01:00
cli-interp.c Include string.h in common-defs.h 2014-08-07 09:06:47 +01:00
cli-logging.c Include string.h in common-defs.h 2014-08-07 09:06:47 +01:00
cli-script.c Fix PR gdb/17035: "show user" doesn't list user-defined commands that 2014-09-07 20:12:19 -03:00
cli-script.h Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
cli-setshow.c Include string.h in common-defs.h 2014-08-07 09:06:47 +01:00
cli-setshow.h constify command prefix 2014-07-24 11:30:04 -06:00
cli-utils.c Include string.h in common-defs.h 2014-08-07 09:06:47 +01:00
cli-utils.h constify some cli-utils stuff 2014-07-30 08:02:52 -06:00