aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-objfile.c8
-rw-r--r--gdb/python/py-prettyprint.c38
-rw-r--r--gdb/python/py-xmethods.c4
3 files changed, 21 insertions, 29 deletions
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 5f61b73..d9cf548 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -501,9 +501,7 @@ objfpy_build_id_matches (const struct bfd_build_id *build_id,
static struct objfile *
objfpy_lookup_objfile_by_name (const char *name)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
const char *filename;
@@ -529,9 +527,7 @@ objfpy_lookup_objfile_by_name (const char *name)
static struct objfile *
objfpy_lookup_objfile_by_build_id (const char *build_id)
{
- struct objfile *objfile;
-
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
const struct bfd_build_id *obfd_build_id;
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;
}
diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c
index a1f7b1d..acf521d 100644
--- a/gdb/python/py-xmethods.c
+++ b/gdb/python/py-xmethods.c
@@ -121,8 +121,6 @@ gdbpy_get_matching_xmethod_workers
struct type *obj_type, const char *method_name,
std::vector<xmethod_worker_up> *dm_vec)
{
- struct objfile *objfile;
-
gdb_assert (obj_type != NULL && method_name != NULL);
gdbpy_enter enter_py (get_current_arch (), current_language);
@@ -145,7 +143,7 @@ gdbpy_get_matching_xmethod_workers
/* Gather debug method matchers registered with the object files.
This could be done differently by iterating over each objfile's matcher
list individually, but there's no data yet to show it's needed. */
- ALL_OBJFILES (objfile)
+ for (objfile *objfile : all_objfiles (current_program_space))
{
gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);