diff mbox

[03/21] struct symtab split part 2: ada-lang.c cp-support.c jv-lang.c

Message ID 5464aa32.0a66460a.6014.ffff9d6f@mx.google.com
State New
Headers show

Commit Message

Doug Evans Nov. 13, 2014, 12:54 p.m. UTC
This patch contains the changes to ada-lang.c, cp-support.c, jv-lang.c.

Full ChangeLog: https://sourceware.org/ml/gdb-patches/2014-11/msg00233.html

2014-11-12  Doug Evans  <xdje42@gmail.com>

	* jv-lang.c (get_java_class_symtab): Change result to
	"struct compunit_symtab *".  All callers updated.
diff mbox

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index e226edb..443d8f1 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6135,7 +6135,7 @@  ada_make_symbol_completion_list (const char *text0, const char *word,
   int encoded_p;
   VEC(char_ptr) *completions = VEC_alloc (char_ptr, 128);
   struct symbol *sym;
-  struct symtab *s;
+  struct compunit_symtab *s;
   struct minimal_symbol *msymbol;
   struct objfile *objfile;
   const struct block *b, *surrounding_static_block = 0;
@@ -6214,14 +6214,12 @@  ada_make_symbol_completion_list (const char *text0, const char *word,
     }
 
   /* Go through the symtabs and check the externs and statics for
-     symbols which match.
-     Non-primary symtabs share the block vector with their primary symtabs
-     so we use ALL_PRIMARY_SYMTABS here instead of ALL_SYMTABS.  */
+     symbols which match.  */
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, s)
   {
     QUIT;
-    b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), GLOBAL_BLOCK);
+    b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), GLOBAL_BLOCK);
     ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
       symbol_completion_add (&completions, SYMBOL_LINKAGE_NAME (sym),
@@ -6230,10 +6228,10 @@  ada_make_symbol_completion_list (const char *text0, const char *word,
     }
   }
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, s)
   {
     QUIT;
-    b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK);
+    b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (s), STATIC_BLOCK);
     /* Don't do this block twice.  */
     if (b == surrounding_static_block)
       continue;
@@ -12841,14 +12839,14 @@  static void
 ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
 {
   struct objfile *objfile;
-  struct symtab *s;
+  struct compunit_symtab *s;
 
   expand_symtabs_matching (NULL, ada_exc_search_name_matches,
 			   VARIABLES_DOMAIN, preg);
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, s)
     {
-      const struct blockvector *bv = SYMTAB_BLOCKVECTOR (s);
+      const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (s);
       int i;
 
       for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 264bcc4..8bfaed0 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1393,7 +1393,7 @@  make_symbol_overload_list_using (const char *func_name,
 static void
 make_symbol_overload_list_qualified (const char *func_name)
 {
-  struct symtab *s;
+  struct compunit_symtab *cust;
   struct objfile *objfile;
   const struct block *b, *surrounding_static_block = 0;
 
@@ -1417,17 +1417,17 @@  make_symbol_overload_list_qualified (const char *func_name)
   /* Go through the symtabs and check the externs and statics for
      symbols which match.  */
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, cust)
   {
     QUIT;
-    b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), GLOBAL_BLOCK);
+    b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), GLOBAL_BLOCK);
     make_symbol_overload_list_block (func_name, b);
   }
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, cust)
   {
     QUIT;
-    b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK);
+    b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), STATIC_BLOCK);
     /* Don't do this block twice.  */
     if (b == surrounding_static_block)
       continue;
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 76a2124..acc191a 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -45,7 +45,7 @@  extern void _initialize_java_language (void);
 static int java_demangled_signature_length (const char *);
 static void java_demangled_signature_copy (char *, const char *);
 
-static struct symtab *get_java_class_symtab (struct gdbarch *gdbarch);
+static struct compunit_symtab *get_java_class_symtab (struct gdbarch *gdbarch);
 static char *get_java_utf8_name (struct obstack *obstack, struct value *name);
 static int java_class_is_primitive (struct value *clas);
 static struct value *java_value_string (char *ptr, int len);
@@ -129,11 +129,11 @@  get_dynamics_objfile (struct gdbarch *gdbarch)
   return dynamics_objfile;
 }
 
-static struct symtab *
+static struct compunit_symtab *
 get_java_class_symtab (struct gdbarch *gdbarch)
 {
   struct objfile *objfile = get_dynamics_objfile (gdbarch);
-  struct symtab *class_symtab = objfile->symtabs;
+  struct compunit_symtab *class_symtab = objfile->compunit_symtabs;
 
   if (class_symtab == NULL)
     {
@@ -141,13 +141,16 @@  get_java_class_symtab (struct gdbarch *gdbarch)
       struct block *bl;
       struct jv_per_objfile_data *jv_data;
 
-      class_symtab = allocate_symtab ("<java-classes>", objfile);
-      class_symtab->language = language_java;
+      class_symtab = allocate_compunit_symtab (objfile, "<java-classes>");
+      add_compunit_symtab_to_objfile (class_symtab);
+      allocate_symtab (class_symtab, "<java-classes>");
+
+      COMPUNIT_FILETABS (class_symtab)->language = language_java;
       bv = (struct blockvector *)
 	obstack_alloc (&objfile->objfile_obstack,
 		       sizeof (struct blockvector) + sizeof (struct block *));
       BLOCKVECTOR_NBLOCKS (bv) = 1;
-      SYMTAB_BLOCKVECTOR (class_symtab) = bv;
+      COMPUNIT_BLOCKVECTOR (class_symtab) = bv;
 
       /* Allocate dummy STATIC_BLOCK.  */
       bl = allocate_block (&objfile->objfile_obstack);
@@ -158,7 +161,7 @@  get_java_class_symtab (struct gdbarch *gdbarch)
       /* Allocate GLOBAL_BLOCK.  */
       bl = allocate_global_block (&objfile->objfile_obstack);
       BLOCK_DICT (bl) = dict_create_hashed_expandable ();
-      set_block_symtab (bl, class_symtab);
+      set_block_compunit_symtab (bl, class_symtab);
       BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl;
 
       /* Arrange to free the dict.  */
@@ -171,9 +174,9 @@  get_java_class_symtab (struct gdbarch *gdbarch)
 static void
 add_class_symtab_symbol (struct symbol *sym)
 {
-  struct symtab *symtab
+  struct compunit_symtab *cust
     = get_java_class_symtab (get_objfile_arch (SYMBOL_OBJFILE (sym)));
-  const struct blockvector *bv = SYMTAB_BLOCKVECTOR (symtab);
+  const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
 
   dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
 }