From 30a87e90be195dcce555a0904cc5dbd960349271 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Mon, 24 Jan 2022 15:19:43 +0000 Subject: 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. --- gdb/python/python-internal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'gdb/python/python-internal.h') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index ccea5c4..5e15f62 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -412,6 +412,7 @@ extern enum ext_lang_rc gdbpy_get_matching_xmethod_workers PyObject *gdbpy_history (PyObject *self, PyObject *args); PyObject *gdbpy_add_history (PyObject *self, PyObject *args); +extern PyObject *gdbpy_history_count (PyObject *self, PyObject *args); PyObject *gdbpy_convenience_variable (PyObject *self, PyObject *args); PyObject *gdbpy_set_convenience_variable (PyObject *self, PyObject *args); PyObject *gdbpy_breakpoints (PyObject *, PyObject *); -- cgit v1.1