aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-prettyprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-prettyprint.c')
-rw-r--r--gdb/python/py-prettyprint.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index ac0506f..4092fdb 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -93,28 +93,26 @@ search_pp_list (PyObject *list, PyObject *value)
static PyObject *
find_pretty_printer_from_objfiles (PyObject *value)
{
- struct objfile *obj;
+ for (objfile *obj : all_objfiles (current_program_space))
+ {
+ gdbpy_ref<> objf = objfile_to_objfile_object (obj);
+ if (objf == NULL)
+ {
+ /* Ignore the error and continue. */
+ PyErr_Clear ();
+ continue;
+ }
- ALL_OBJFILES (obj)
- {
- gdbpy_ref<> objf = objfile_to_objfile_object (obj);
- if (objf == NULL)
- {
- /* Ignore the error and continue. */
- PyErr_Clear ();
- continue;
- }
-
- gdbpy_ref<> pp_list (objfpy_get_printers (objf.get (), NULL));
- gdbpy_ref<> function (search_pp_list (pp_list.get (), value));
-
- /* If there is an error in any objfile list, abort the search and exit. */
- if (function == NULL)
- return NULL;
+ gdbpy_ref<> pp_list (objfpy_get_printers (objf.get (), NULL));
+ gdbpy_ref<> function (search_pp_list (pp_list.get (), value));
- if (function != Py_None)
- return function.release ();
- }
+ /* If there is an error in any objfile list, abort the search and exit. */
+ if (function == NULL)
+ return NULL;
+
+ if (function != Py_None)
+ return function.release ();
+ }
Py_RETURN_NONE;
}