Allow Python commands to be in class_tui
authorTom Tromey <tom@tromey.com>
Tue, 28 Apr 2020 14:54:17 +0000 (08:54 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 28 Apr 2020 14:54:17 +0000 (08:54 -0600)
Now that Python code can create TUI windows, it seemed appropriate to
allow Python commands to appear in the "TUI" help class.  This patch
adds this capability.

gdb/ChangeLog
2020-04-28  Tom Tromey  <tom@tromey.com>

* NEWS: Update.
* python/py-cmd.c (gdbpy_initialize_commands): Add COMMAND_TUI.
(cmdpy_init): Allow class_tui.

gdb/doc/ChangeLog
2020-04-28  Tom Tromey  <tom@tromey.com>

* python.texi (Commands In Python): Document gdb.COMMAND_TUI.

gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/python.texi
gdb/python/py-cmd.c

index 26ebc7373c58524dc206ba87736b026d529074d7..bd2c9b030ab4cecde7cc201b9b5c752db51a5bd0 100644 (file)
@@ -1,3 +1,9 @@
+2020-04-28  Tom Tromey  <tom@tromey.com>
+
+       * NEWS: Update.
+       * python/py-cmd.c (gdbpy_initialize_commands): Add COMMAND_TUI.
+       (cmdpy_init): Allow class_tui.
+
 2020-04-28 Mark Williams <mark@myosotissp.com>
 
        PR gdb/24480
index 01e73c9e5eacf2d6773ea5048803276d636322a6..5b9eabe746c204147677a1bab48b16ad6039837a 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -73,6 +73,9 @@ GNU/Linux/RISC-V (gdbserver)  riscv*-*-linux*
      field of a dynamic type may have None for its "bitpos" attribute
      as well.
 
+  ** Commands written in Python can be in the "TUI" help class by
+     registering with the new constant gdb.COMMAND_TUI.
+
 *** Changes in GDB 9
 
 * 'thread-exited' event is now available in the annotations interface.
index 305f2d5b648227b8ac4197ed0705e82242ce44ec..6af7bce86b1faffbae7c4011e42d86513782e34c 100644 (file)
@@ -1,3 +1,7 @@
+2020-04-28  Tom Tromey  <tom@tromey.com>
+
+       * python.texi (Commands In Python): Document gdb.COMMAND_TUI.
+
 2020-04-27  Tom Tromey  <tromey@adacore.com>
 
        * python.texi (Types In Python): Mention missing fields.  Add
index 3b1ccb41771e1dbc2e98d7bab0004480c256c231..a38f1dab426eb0e1413865e326c6690f16a83c64 100644 (file)
@@ -3829,6 +3829,13 @@ The command has to do with tracepoints.  For example, @code{trace},
 @kbd{help tracepoints} at the @value{GDBN} prompt to see a list of
 commands in this category.
 
+@findex COMMAND_TUI
+@findex gdb.COMMAND_TUI
+@item gdb.COMMAND_TUI
+The command has to do with the text user interface (@pxref{TUI}).
+Type @kbd{help tui} at the @value{GDBN} prompt to see a list of
+commands in this category.
+
 @findex COMMAND_USER
 @findex gdb.COMMAND_USER
 @item gdb.COMMAND_USER
index b822c1400415ebb2e7f460e4f787ad8e2c3d93d9..3c1c566b0a1a999a92434389a79aff35aa75b8d2 100644 (file)
@@ -465,7 +465,8 @@ 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_user)
+      && cmdtype != class_maintenance && cmdtype != class_user
+      && cmdtype != class_tui)
     {
       PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
       return -1;
@@ -593,8 +594,7 @@ gdbpy_initialize_commands (void)
   if (PyType_Ready (&cmdpy_object_type) < 0)
     return -1;
 
-  /* Note: alias and user are special; pseudo appears to be unused,
-     and there is no reason to expose tui, I think.  */
+  /* Note: alias and user are special.  */
   if (PyModule_AddIntConstant (gdb_module, "COMMAND_NONE", no_class) < 0
       || PyModule_AddIntConstant (gdb_module, "COMMAND_RUNNING", class_run) < 0
       || PyModule_AddIntConstant (gdb_module, "COMMAND_DATA", class_vars) < 0
@@ -611,7 +611,8 @@ gdbpy_initialize_commands (void)
                                  class_obscure) < 0
       || PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
                                  class_maintenance) < 0
-      || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
+      || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0
+      || PyModule_AddIntConstant (gdb_module, "COMMAND_TUI", class_tui) < 0)
     return -1;
 
   for (i = 0; i < N_COMPLETERS; ++i)
This page took 0.03764 seconds and 4 git commands to generate.