Remove most uses of ALL_OBJFILES
[deliverable/binutils-gdb.git] / gdb / probe.c
index 1be8faad3539d2a8cf8f501dc397b9916845f4c9..7450e4cede545e72d945a75f6c90a73c7def8a0e 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic static probe support for GDB.
 
-   Copyright (C) 2012-2017 Free Software Foundation, Inc.
+   Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -60,7 +60,7 @@ public:
 
 /* Static operations associated with a generic probe.  */
 
-const any_static_probe_ops any_static_probe_ops;
+const any_static_probe_ops any_static_probe_ops {};
 
 /* A helper for parse_probes that decodes a probe specification in
    SEARCH_PSPACE.  It appends matching SALs to RESULT.  */
@@ -73,9 +73,7 @@ parse_probes_in_pspace (const static_probe_ops *spops,
                        const char *name,
                        std::vector<symtab_and_line> *result)
 {
-  struct objfile *objfile;
-
-  ALL_PSPACE_OBJFILES (search_pspace, objfile)
+  for (objfile *objfile : all_objfiles (search_pspace))
     {
       if (!objfile->sf || !objfile->sf->sym_probe_fns)
        continue;
@@ -246,29 +244,28 @@ find_probes_in_objfile (struct objfile *objfile, const char *provider,
 struct bound_probe
 find_probe_by_pc (CORE_ADDR pc)
 {
-  struct objfile *objfile;
   struct bound_probe result;
 
   result.objfile = NULL;
   result.prob = NULL;
 
-  ALL_OBJFILES (objfile)
-  {
-    if (!objfile->sf || !objfile->sf->sym_probe_fns
-       || objfile->sect_index_text == -1)
-      continue;
-
-    /* If this proves too inefficient, we can replace with a hash.  */
-    const std::vector<probe *> &probes
-      = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
-    for (probe *p : probes)
-      if (p->get_relocated_address (objfile) == pc)
-       {
-         result.objfile = objfile;
-         result.prob = p;
-         return result;
-       }
-  }
+  for (objfile *objfile : all_objfiles (current_program_space))
+    {
+      if (!objfile->sf || !objfile->sf->sym_probe_fns
+         || objfile->sect_index_text == -1)
+       continue;
+
+      /* If this proves too inefficient, we can replace with a hash.  */
+      const std::vector<probe *> &probes
+       = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+      for (probe *p : probes)
+       if (p->get_relocated_address (objfile) == pc)
+         {
+           result.objfile = objfile;
+           result.prob = p;
+           return result;
+         }
+    }
 
   return result;
 }
@@ -284,7 +281,6 @@ static std::vector<bound_probe>
 collect_probes (const std::string &objname, const std::string &provider,
                const std::string &probe_name, const static_probe_ops *spops)
 {
-  struct objfile *objfile;
   std::vector<bound_probe> result;
   gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
 
@@ -298,7 +294,7 @@ collect_probes (const std::string &objname, const std::string &provider,
     obj_pat.emplace (objname.c_str (), REG_NOSUB,
                     _("Invalid object file regexp"));
 
-  ALL_OBJFILES (objfile)
+  for (objfile *objfile : all_objfiles (current_program_space))
     {
       if (! objfile->sf || ! objfile->sf->sym_probe_fns)
        continue;
@@ -367,7 +363,7 @@ gen_ui_out_table_header_info (const std::vector<bound_probe> &probes,
   std::vector<struct info_probe_column> headings
     = spops->gen_info_probes_table_header ();
 
-  for (const struct info_probe_column &column : headings)
+  for (const info_probe_column &column : headings)
     {
       size_t size_max = strlen (column.print_name);
 
@@ -410,7 +406,7 @@ print_ui_out_not_applicables (const static_probe_ops *spops)
    std::vector<struct info_probe_column> headings
      = spops->gen_info_probes_table_header ();
 
-  for (const struct info_probe_column &column : headings)
+  for (const info_probe_column &column : headings)
     current_uiout->field_string (column.field_name, _("n/a"));
 }
 
This page took 0.029525 seconds and 4 git commands to generate.