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.
This commit is contained in:
Andrew Burgess 2021-07-30 12:56:34 +01:00
parent 3f1a2892e1
commit 540bf37b25
6 changed files with 77 additions and 0 deletions

View file

@ -2076,6 +2076,8 @@ PyMethodDef python_GdbMethods[] =
{
{ "history", gdbpy_history, METH_VARARGS,
"Get a value from history" },
{ "add_history", gdbpy_add_history, METH_VARARGS,
"Add a value to the value history list" },
{ "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS,
"execute (command [, from_tty] [, to_string]) -> [String]\n\
Evaluate command, a string, as a gdb CLI command. Optionally returns\n\