[PATCH] Clarify when dont_repeat should be called
Christian Biesinger
cbiesinger@google.com
Thu Mar 12 20:44:19 GMT 2020
It is not immediately obvious that Command.dont_repeat should be called
in invoke(), not in __init__. Make this obvious in the documentation.
gdb/doc/ChangeLog:
2020-03-12 Christian Biesinger <cbiesinger@google.com>
* python.texi (Commands In Python): Clarify when Command.dont_repeat
should be called.
---
gdb/doc/python.texi | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 76cdf7f541..e2bc824357 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -3655,8 +3655,11 @@ not documented.'' is used.
@defun Command.dont_repeat ()
By default, a @value{GDBN} command is repeated when the user enters a
blank line at the command prompt. A command can suppress this
-behavior by invoking the @code{dont_repeat} method. This is similar
-to the user command @code{dont-repeat}, see @ref{Define, dont-repeat}.
+behavior by invoking the @code{dont_repeat} method. Because a command
+can dynamically determine whether it wants to be repeatable, this needs
+to be called inside the command's @code{invoke} method, not in
+@code{__init__}. This is similar to the user command @code{dont-repeat},
+see @ref{Define, dont-repeat}.
@end defun
@defun Command.invoke (argument, from_tty)
--
2.25.1.481.gfbce0eb801-goog
More information about the Gdb-patches
mailing list