gdb/python: add gdb.history_count function
Add a new function gdb.history_count to the Python api, this function returns an integer, the number of items in GDB's value history. This is useful if you want to pull items from the history by their absolute number, for example, if you wanted to show a complete history list. Previously we could figure out how many items are in the history list by trying to fetch the items, and then catching the exception when the item is not available, but having this function seems nicer.
This commit is contained in:
parent
51d185a65f
commit
30a87e90be
8 changed files with 43 additions and 0 deletions
|
@ -2212,6 +2212,8 @@ PyMethodDef python_GdbMethods[] =
|
|||
"Get a value from history" },
|
||||
{ "add_history", gdbpy_add_history, METH_VARARGS,
|
||||
"Add a value to the value history list" },
|
||||
{ "history_count", gdbpy_history_count, METH_NOARGS,
|
||||
"Return an integer, the number of values in GDB's value history" },
|
||||
{ "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\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue