* objfiles.h (ALL_OBJFILE_PRIMARY_SYMTABS): New macro.
authorDoug Evans <dje@google.com>
Mon, 4 Jun 2012 02:57:28 +0000 (02:57 +0000)
committerDoug Evans <dje@google.com>
Mon, 4 Jun 2012 02:57:28 +0000 (02:57 +0000)
(ALL_PRIMARY_SYMTABS): Use it.
(ALL_PSPACE_PRIMARY_SYMTABS): Ditto.
* dwarf2read.c (dw2_find_symbol_file): Ditto.
* linespec.c (iterate_over_all_matching_symtabs): Ditto.
* symtab.c (lookup_symbol_aux_objfile): Ditto.
(basic_lookup_transparent_type): Ditto.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/linespec.c
gdb/objfiles.h
gdb/symtab.c

index 024a139e966d8cce5459cadf09b715b05e79dc59..7efd70538b7a5fc5d94b4bd8891291c1ff93041d 100644 (file)
@@ -1,3 +1,13 @@
+2012-06-03  Doug Evans  <dje@google.com>
+
+       * objfiles.h (ALL_OBJFILE_PRIMARY_SYMTABS): New macro.
+       (ALL_PRIMARY_SYMTABS): Use it.
+       (ALL_PSPACE_PRIMARY_SYMTABS): Ditto.
+       * dwarf2read.c (dw2_find_symbol_file): Ditto.
+       * linespec.c (iterate_over_all_matching_symtabs): Ditto.
+       * symtab.c (lookup_symbol_aux_objfile): Ditto.
+       (basic_lookup_transparent_type): Ditto.
+
 2012-06-02  Sergio Durigan Junior  <sergiodj@redhat.com>
 
        * symtab.c (symbol_demangled_name): New variable `dem_name'.  Use
index 8dbc53e9111891eaf68f087a46ae18e087ef4a83..23779ac821aca0ce18ece441adf18bf439711eed 100644 (file)
@@ -2842,16 +2842,15 @@ dw2_find_symbol_file (struct objfile *objfile, const char *name)
     {
       struct symtab *s;
 
-      ALL_OBJFILE_SYMTABS (objfile, s)
-       if (s->primary)
-         {
-           struct blockvector *bv = BLOCKVECTOR (s);
-           const struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-           struct symbol *sym = lookup_block_symbol (block, name, VAR_DOMAIN);
+      ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+       {
+         struct blockvector *bv = BLOCKVECTOR (s);
+         const struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+         struct symbol *sym = lookup_block_symbol (block, name, VAR_DOMAIN);
 
-           if (sym)
-             return sym->symtab->filename;
-         }
+         if (sym)
+           return sym->symtab->filename;
+       }
       return NULL;
     }
 
index e678dfa10082840f9e191ea15ac782072f518279..ccafe59c9e90d34b7dc6a60e7a34f97eb24eaaf3 100644 (file)
@@ -987,27 +987,24 @@ iterate_over_all_matching_symtabs (struct linespec_state *state,
                                                  ALL_DOMAIN,
                                                  &matcher_data);
 
-      ALL_OBJFILE_SYMTABS (objfile, symtab)
+      ALL_OBJFILE_PRIMARY_SYMTABS (objfile, symtab)
        {
-         if (symtab->primary)
-           {
-             struct block *block;
+         struct block *block;
 
-             block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
-             LA_ITERATE_OVER_SYMBOLS (block, name, domain, callback, data);
+         block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
+         LA_ITERATE_OVER_SYMBOLS (block, name, domain, callback, data);
 
-             if (include_inline)
-               {
-                 struct symbol_and_data_callback cad = { callback, data };
-                 int i;
+         if (include_inline)
+           {
+             struct symbol_and_data_callback cad = { callback, data };
+             int i;
 
-                 for (i = FIRST_LOCAL_BLOCK;
-                      i < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (symtab)); i++)
-                   {
-                     block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), i);
-                     LA_ITERATE_OVER_SYMBOLS (block, name, domain,
-                                              iterate_inline_only, &cad);
-                   }
+             for (i = FIRST_LOCAL_BLOCK;
+                  i < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (symtab)); i++)
+               {
+                 block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), i);
+                 LA_ITERATE_OVER_SYMBOLS (block, name, domain,
+                                          iterate_inline_only, &cad);
                }
            }
        }
index d5c807f2c38cc9807480f16afe5f124fe4676176..98cc39ee7e70784ad712110a17b17cb01b6fc258 100644 (file)
@@ -556,6 +556,12 @@ extern int gdb_bfd_close_or_warn (struct bfd *abfd);
 #define        ALL_OBJFILE_SYMTABS(objfile, s) \
     for ((s) = (objfile) -> symtabs; (s) != NULL; (s) = (s) -> next)
 
+/* Traverse all primary symtabs in one objfile.  */
+
+#define ALL_OBJFILE_PRIMARY_SYMTABS(objfile, s) \
+  ALL_OBJFILE_SYMTABS ((objfile), (s)) \
+    if ((s)->primary)
+
 /* Traverse all minimal symbols in one objfile.  */
 
 #define        ALL_OBJFILE_MSYMBOLS(objfile, m) \
@@ -578,13 +584,11 @@ extern int gdb_bfd_close_or_warn (struct bfd *abfd);
 
 #define ALL_PRIMARY_SYMTABS(objfile, s) \
   ALL_OBJFILES (objfile)               \
-    ALL_OBJFILE_SYMTABS (objfile, s)   \
-      if ((s)->primary)
+    ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
 
 #define ALL_PSPACE_PRIMARY_SYMTABS(pspace, objfile, s) \
   ALL_PSPACE_OBJFILES (ss, objfile)                    \
-    ALL_OBJFILE_SYMTABS (objfile, s)                   \
-      if ((s)->primary)
+    ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
 
 /* Traverse all minimal symbols in all objfiles in the current symbol
    space.  */
index 5eb7ced18709f732fedbec272bcad3421ea2ab64..5d539595f861ff6692d2a0df77d24810864500a8 100644 (file)
@@ -1517,18 +1517,17 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
     objfile->sf->qf->pre_expand_symtabs_matching (objfile, block_index,
                                                  name, domain);
 
-  ALL_OBJFILE_SYMTABS (objfile, s)
-    if (s->primary)
-      {
-       bv = BLOCKVECTOR (s);
-       block = BLOCKVECTOR_BLOCK (bv, block_index);
-       sym = lookup_block_symbol (block, name, domain);
-       if (sym)
-         {
-           block_found = block;
-           return fixup_symbol_section (sym, objfile);
-         }
-      }
+  ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+    {
+      bv = BLOCKVECTOR (s);
+      block = BLOCKVECTOR_BLOCK (bv, block_index);
+      sym = lookup_block_symbol (block, name, domain);
+      if (sym)
+       {
+         block_found = block;
+         return fixup_symbol_section (sym, objfile);
+       }
+    }
 
   return NULL;
 }
@@ -1829,17 +1828,16 @@ basic_lookup_transparent_type (const char *name)
                                                    GLOBAL_BLOCK,
                                                    name, STRUCT_DOMAIN);
 
-    ALL_OBJFILE_SYMTABS (objfile, s)
-      if (s->primary)
-       {
-         bv = BLOCKVECTOR (s);
-         block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-         sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
-         if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
-           {
-             return SYMBOL_TYPE (sym);
-           }
-       }
+    ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+      {
+       bv = BLOCKVECTOR (s);
+       block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+       sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
+       if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+         {
+           return SYMBOL_TYPE (sym);
+         }
+      }
   }
 
   ALL_OBJFILES (objfile)