mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-26 04:08:13 +08:00
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:
@ -2012,6 +2012,14 @@ gdbpy_add_history (PyObject *self, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Return an integer, the number of items in GDB's history. */
|
||||
|
||||
PyObject *
|
||||
gdbpy_history_count (PyObject *self, PyObject *args)
|
||||
{
|
||||
return gdb_py_object_from_ulongest (value_history_count ()).release ();
|
||||
}
|
||||
|
||||
/* Return the value of a convenience variable. */
|
||||
PyObject *
|
||||
gdbpy_convenience_variable (PyObject *self, PyObject *args)
|
||||
|
Reference in New Issue
Block a user