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;
}