diff options
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r-- | gdb/python/python.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c index 6f798a0..371f4a5 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1437,10 +1437,10 @@ gdbpy_get_current_objfile (PyObject *unused1, PyObject *unused2) return result; } -/* Return a sequence holding all the Objfiles. */ +/* See python-internal.h. */ -static PyObject * -gdbpy_objfiles (PyObject *unused1, PyObject *unused2) +gdbpy_ref<> +build_objfiles_list (program_space *pspace) { struct objfile *objf; @@ -1448,15 +1448,23 @@ gdbpy_objfiles (PyObject *unused1, PyObject *unused2) if (list == NULL) return NULL; - ALL_OBJFILES (objf) - { - PyObject *item = objfile_to_objfile_object (objf); + ALL_PSPACE_OBJFILES (pspace, objf) + { + PyObject *item = objfile_to_objfile_object (objf); - if (!item || PyList_Append (list.get (), item) == -1) - return NULL; - } + if (item == nullptr || PyList_Append (list.get (), item) == -1) + return NULL; + } - return list.release (); + return list; +} + +/* Return a sequence holding all the Objfiles. */ + +static PyObject * +gdbpy_objfiles (PyObject *unused1, PyObject *unused2) +{ + return build_objfiles_list (current_program_space).release (); } /* Compute the list of active python type printers and store them in |