* NEWS: Mention new python command class gdb.COMMAND_USER.
* cli/cli-cmds.c (show_user): Print error when used on a python command. (init_cli_cmds): Update documentation strings for "show user" and "set/show max-user-call-depth" to clarify that it does not apply to python commands. * python/py-cmd.c (cmdpy_init): Treat class_user as a valid class in error check. (gdbpy_initialize_commands): Add COMMAND_USER as a constant in gdb python api. * top.c (execute_command): Only execute a user-defined command as a legacy macro if c->user_commands is set. doc/ * gdb.texinfo (Commands In Python): Put example python macro in COMMAND_USER category rather than COMMAND_OBSCURE. Document gdb.COMMAND_USER. (User-defined Commands): Update documentation to clarify "set/show max-user-call-depth" and "show user" don't apply to python commands. Update documentation to clarify "help user-defined" may also include python commands defined as COMMAND_USER. testsuite/ * gdb.python/py-cmd.exp: Add test to verify that python commands can be put in the user-defined category and that the commands appear in "help user-defined".
This commit is contained in:
parent
e88acd9618
commit
7d74f2446c
9 changed files with 77 additions and 11 deletions
|
@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
|
|||
&& cmdtype != class_files && cmdtype != class_support
|
||||
&& cmdtype != class_info && cmdtype != class_breakpoint
|
||||
&& cmdtype != class_trace && cmdtype != class_obscure
|
||||
&& cmdtype != class_maintenance)
|
||||
&& cmdtype != class_maintenance && cmdtype != class_user)
|
||||
{
|
||||
PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
|
||||
return -1;
|
||||
|
@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
|
|||
|| PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
|
||||
class_obscure) < 0
|
||||
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
|
||||
class_maintenance) < 0)
|
||||
class_maintenance) < 0
|
||||
|| PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < N_COMPLETERS; ++i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue