aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-07-30 12:56:34 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-09-07 10:54:07 +0100
commit540bf37b2539923dc70b96eea7cb870522ffd7ec (patch)
tree8ae12cd4c68badb1f42eee23980e369ef68ed473 /gdb/doc
parent3f1a2892e1fea343880b276474cb44db3abcaa9a (diff)
downloadgdb-540bf37b2539923dc70b96eea7cb870522ffd7ec.zip
gdb-540bf37b2539923dc70b96eea7cb870522ffd7ec.tar.gz
gdb-540bf37b2539923dc70b96eea7cb870522ffd7ec.tar.bz2
gdb/python: new function to add values into GDB's history
The guile API has (history-append! <value>) to add values into GDB's history list. There is currently no equivalent in the Python API. This commit adds gdb.add_history(<value>) to the Python API, this function takes <value> a gdb.Value (or anything that can be passed to the constructor of gdb.Value), and adds the value it represents to GDB's history list. The index of the newly added value is returned.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/python.texi14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index f4865b3..d8f682a 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -346,6 +346,20 @@ If no exception is raised, the return value is always an instance of
@code{gdb.Value} (@pxref{Values From Inferior}).
@end defun
+@defun gdb.add_history (value)
+Takes @var{value}, an instance of @code{gdb.Value} (@pxref{Values From
+Inferior}), and appends the value this object represents to
+@value{GDBN}'s value history (@pxref{Value History}), and return an
+integer, its history number. If @var{value} is not a
+@code{gdb.Value}, it is is converted using the @code{gdb.Value}
+constructor. If @var{value} can't be converted to a @code{gdb.Value}
+then a @code{TypeError} is raised.
+
+When a command implemented in Python prints a single @code{gdb.Value}
+as its result, then placing the value into the history will allow the
+user convenient access to those values via CLI history facilities.
+@end defun
+
@findex gdb.convenience_variable
@defun gdb.convenience_variable (name)
Return the value of the convenience variable (@pxref{Convenience