binutils-gdb/gdb/doc
Andrew Burgess ef8bee09ef gdb/python: new gdb.ParameterPrefix class
This commit adds a new gdb.ParameterPrefix class to GDB's Python API.

When creating multiple gdb.Parameters, it is often desirable to group
these together under a sub-command, for example, 'set print' has lots
of parameters nested under it, like 'set print address', and 'set
print symbol'.  In the Python API the 'print' part of these commands
are called prefix commands, and are created using gdb.Command objects.

However, as parameters are set via the 'set ....' command list, and
shown through the 'show ....' command list, creating a prefix for a
parameter usually requires two prefix commands to be created, one for
the 'set' command, and one for the 'show' command.

This often leads to some duplication, or at the very least, each user
will end up creating their own helper class to simplify creation of
the two prefix commands.

This commit adds a new gdb.ParameterPrefix class.  Creating a single
instance of this class will create both the 'set' and 'show' prefix
commands, which can then be used while creating the gdb.Parameter.

Here is an example of it in use:

  gdb.ParameterPrefix('my-prefix', gdb.COMMAND_NONE)

This adds 'set my-prefix' and 'show my-prefix', both of which are
prefix commands.  The user can then add gdb.Parameter objects under
these prefixes.

The gdb.ParameterPrefix initialise method also supports documentation
strings, so we can write:

  gdb.ParameterPrefix('my-prefix', gdb.COMMAND_NONE,
      "Configuration setting relating to my special extension.")

which will set the documentation string for the prefix command.

Also, it is possible to support prefix commands that use the `invoke`
functionality to handle unknown sub-commands.  This is done by
sub-classing gdb.ParameterPrefix and overriding either 'invoke_set' or
'invoke_show' to handle the 'set' or 'show' prefix command
respectively.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2025-05-13 15:35:26 +01:00
..
.gitignore
a4rc.sed
agentexpr.texi Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
all-cfg.texi Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
annotate.texinfo Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
ChangeLog-1991-2021
doxy-index.in Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
Doxyfile-base.in Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
Doxyfile-gdb-api.in Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
Doxyfile-gdb-xref.in Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
Doxyfile-gdbserver.in Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
fdl.texi
filter-for-doxygen
filter-params.pl
gdb.texinfo gdb: add '-stopped' and '-running' options to "info threads" 2025-05-12 09:11:25 +02:00
gpl.texi
guile.texi gdb/guile: generate general description string for parameters 2025-05-13 14:55:56 +01:00
lpsrc.sed
Makefile.in Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
psrc.sed
python.texi gdb/python: new gdb.ParameterPrefix class 2025-05-13 15:35:26 +01:00
refcard.tex Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
stabs.texinfo Update copyright dates to include 2025 2025-04-08 10:54:39 -06:00
stack_frame.eps
stack_frame.pdf
stack_frame.png
stack_frame.svg
stack_frame.txt