]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2002-10-07 David Carlton <carlton@math.stanford.edu>
authorDavid Carlton <carlton@bactrian.org>
Tue, 8 Oct 2002 00:12:23 +0000 (00:12 +0000)
committerDavid Carlton <carlton@bactrian.org>
Tue, 8 Oct 2002 00:12:23 +0000 (00:12 +0000)
* buildsym.c (finish_block): Initialize BLOCK_USING to NULL.
* symtab.h (struct block): Delete last remnants of non-dictionary
symbol lists.
(struct block): Add field 'language_specific' and accessor macro
BLOCK_USING.
* cp-support.h (struct using_data): New struct.
(struct using_data_node): New struct.

gdb/ChangeLog
gdb/buildsym.c
gdb/cp-support.h
gdb/symtab.c
gdb/symtab.h

index fa85187a7136e05a7af7fede8307561235d6b28b..da709ab836a6bd746c7d3f76d6ecc27ebe287f07 100644 (file)
@@ -1,3 +1,13 @@
+2002-10-07  David Carlton  <carlton@math.stanford.edu>
+
+       * buildsym.c (finish_block): Initialize BLOCK_USING to NULL.
+       * symtab.h (struct block): Delete last remnants of non-dictionary
+       symbol lists.
+       (struct block): Add field 'language_specific' and accessor macro
+       BLOCK_USING.
+       * cp-support.h (struct using_data): New struct.
+       (struct using_data_node): New struct.
+
 2002-09-30  David Carlton  <carlton@math.stanford.edu>
 
        * dictionary.h: Augment comment above dict_lookup.
index bbb1cc239567ab836ffc29661269eeb860566a99..3da29f81c201291a1e3037eaffa9e6a3fec39abf 100644 (file)
@@ -257,6 +257,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
   BLOCK_END (block) = end;
   /* Superblock filled in when containing block is made */
   BLOCK_SUPERBLOCK (block) = NULL;
+  BLOCK_USING (block) = NULL;
 
   BLOCK_GCC_COMPILED (block) = processing_gcc_compilation;
 
index a7d333f28b201b531e3e159c4f11c14fcdaf915d..11f7b0a58f2b4dc427fe3967fe463d62b95077c4 100644 (file)
 extern char *class_name_from_physname (const char *physname);
 
 extern char *method_name_from_physname (const char *physname);
+
+/* This is a struct to store data from "using directives" and similar
+   language constructs.  It contains two strings, OLD and NEW; both
+   should be fully-qualified namespace names, NEW should be an initial
+   substring of OLD, and it says that names in the namespace OLD
+   should be imported into namespace NEW.  For example, if it is used
+   to represent the directive "using namespace std;" then OLD should
+   be "std" and new should be "".  For a more complicated example, if
+   there is an anonymous namespace with a named namespace A, then OLD
+   should be "A::(anonymous namespace)" and new should be "A".  */
+
+/* FIXME: carlton/2002-10-07: That anonymous namespace example isn't
+   that great, since it really depends not only on what the
+   demangler's output is but also on the fact that the demangler's
+   output doesn't depend on the name of the file in question.  Which,
+   alas, it doesn't, but should, leaving us with no way to distinguish
+   between anonymous namespaces in different files.  Sigh...  */
+
+struct using_data
+{
+  const char *old;
+  const char *new;
+};
+
+/* This is a struct for a linked list of using_data's.  */
+
+struct using_data_node
+{
+  struct using_data *current;
+  struct using_data_node *next;
+};
index bb6879e6e17d92c569008e03e1d294e2115413d3..c3485b5600172d74607bf5766894073964962216 100644 (file)
@@ -103,18 +103,18 @@ struct symbol *lookup_symbol_aux_symtabs (int block_index,
                                          struct symtab **symtab);
 
 static
+struct symbol *lookup_symbol_aux_psymtabs (int block_index,
+                                          const char *name,
+                                          const char *mangled_name,
+                                          const namespace_enum namespace,
+                                          struct symtab **symtab);
+static
 struct symbol *lookup_symbol_aux_minsyms (const char *name,
                                          const char *mangled_name,
                                          const namespace_enum namespace,
                                          int *is_a_field_of_this,
                                          struct symtab **symtab);
 
-static
-struct symbol *lookup_symbol_aux_psymtabs (int block_index,
-                                          const char *name,
-                                          const char *mangled_name,
-                                          const namespace_enum namespace,
-                                          struct symtab **symtab);
 
 static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
 
@@ -800,8 +800,8 @@ lookup_symbol_aux (const char *name, const char *mangled_name,
      way.  */
 
   sym = lookup_symbol_aux_minsyms (name, mangled_name,
-                                 namespace, is_a_field_of_this,
-                                 symtab);
+                                  namespace, is_a_field_of_this,
+                                  symtab);
   if (sym != NULL)
     return sym;
 
@@ -843,8 +843,8 @@ lookup_symbol_aux (const char *name, const char *mangled_name,
      before the static check in this case?  */
 
   sym = lookup_symbol_aux_minsyms (name, mangled_name,
-                                 namespace, is_a_field_of_this,
-                                 symtab);
+                                  namespace, is_a_field_of_this,
+                                  symtab);
   if (sym != NULL)
     return sym;
 
@@ -903,7 +903,7 @@ lookup_symbol_aux_local (const char *name, const char *mangled_name,
 /* Check to see if the symbol is defined in one of the symtabs.
    BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK,
    depending on whether or not we want to search global symbols or
-   local symbols.  */
+   static symbols.  */
 
 static struct symbol *
 lookup_symbol_aux_symtabs (int block_index,
@@ -937,7 +937,7 @@ lookup_symbol_aux_symtabs (int block_index,
 /* Check to see if the symbol is defined in one of the partial
    symtabs.  BLOCK_INDEX should be either GLOBAL_BLOCK or
    STATIC_BLOCK, depending on whether or not we want to search global
-   symbols or local symbols.  */
+   symbols or static symbols.  */
 
 static struct symbol *
 lookup_symbol_aux_psymtabs (int block_index, const char *name,
@@ -972,7 +972,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name,
            /* FIXME: carlton/2002-09-30: Should we really do that?
               If that happens, isn't it likely to be a GDB error, in
               which case we should fix the GDB error rather than
-              silently dealing with it here.  So I'd vote for
+              silently dealing with it here?  So I'd vote for
               removing the check for the symbol in the other
               block.  */
            block = BLOCKVECTOR_BLOCK (bv,
index 4a5186761d24ecd84884b175c67fb8db9ecb58e7..d73fc2439ec3a79a137e35bfbe633587718bc590 100644 (file)
@@ -26,6 +26,7 @@
 /* Opaque declarations.  */
 struct obstack;
 struct dictionary;
+struct using_data_node;
 
 /* Don't do this; it means that if some .o's are compiled with GNU C
    and some are not (easy to do accidentally the way we configure
@@ -398,6 +399,19 @@ struct block
 
   struct dictionary *dict;
 
+  /* Used for language-specific info.  */
+  union
+  {
+    struct
+    {
+      /* Contains information about what using directives or other
+        similar features are added by this block.  */
+      struct using_data_node *using;
+    }
+    cplus_specific;
+  }
+  language_specific;
+
   /* Version of GCC used to compile the function corresponding
      to this block, or 0 if not compiled with GCC.  When possible,
      GCC should be compatible with the native compiler, or if that
@@ -409,39 +423,6 @@ struct block
      of this flag is undefined.  */
 
   unsigned char gcc_compile_flag;
-
-  /* The symbols for this block are either in a simple linear list or
-     in a simple hashtable.  Blocks which correspond to a function
-     (which have a list of symbols corresponding to arguments) use
-     a linear list, as do some older symbol readers (currently only
-     mdebugread and dstread).  Other blocks are hashed.
-
-     The hashtable uses the same hash function as the minsym hashtables,
-     found in minsyms.c:minsym_hash_iw.  Symbols are hashed based on
-     their demangled name if appropriate, and on their name otherwise.
-     The hash function ignores space, and stops at the beginning of the
-     argument list if any.
-
-     The table is laid out in NSYMS/5 buckets and symbols are chained via
-     their hash_next field.  */
-
-#if 0
-  /* NOTE: carlton/2002-09-24: The rest of the members have been
-     obsoleted by DICT.  */
-  
-  /* If this is really a hashtable of the symbols, this flag is 1.  */
-
-  unsigned char hashtable;
-
-  /* Number of local symbols.  */
-
-  int nsyms;
-
-  /* The symbols.  If some of them are arguments, then they must be
-     in the order in which we would like to print them.  */
-
-  struct symbol *sym[1];
-#endif /* 0 */
 };
 
 #define BLOCK_START(bl)                (bl)->startaddr
@@ -449,35 +430,9 @@ struct block
 #define BLOCK_FUNCTION(bl)     (bl)->function
 #define BLOCK_SUPERBLOCK(bl)   (bl)->superblock
 #define BLOCK_DICT(bl)         (bl)->dict
+#define BLOCK_USING(bl)                (bl)->language_specific.cplus_specific.using
 #define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
 
-#if 0
-
-/* NOTE: carlton/2002-09-24: These have been obsoleted by dictionary
-   stuff.  */
-#define BLOCK_HASHTABLE(bl)    (bl)->hashtable
-
-/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only.  */
-#define BLOCK_NSYMS(bl)                (bl)->nsyms
-#define BLOCK_SYM(bl, n)       (bl)->sym[n]
-
-/* For blocks with a hashtable, but these are valid for non-hashed blocks as
-   well - each symbol will appear to be one bucket by itself.  */
-#define BLOCK_BUCKETS(bl)      (bl)->nsyms
-#define BLOCK_BUCKET(bl, n)    (bl)->sym[n]
-
-/* Macro used to set the size of a hashtable for N symbols.  */
-#define BLOCK_HASHTABLE_SIZE(n)        ((n)/5 + 1)
-
-/* Macro to loop through all symbols in a block BL, in no particular order.
-   i counts which bucket we are in, and sym points to the current symbol.  */
-
-#define ALL_BLOCK_SYMBOLS(bl, i, sym)                          \
-       for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++)        \
-         for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym);         \
-              (sym) = (sym)->hash_next)
-#endif /* 0 */
-
 \f
 
 /* Represent one symbol name; a variable, constant, function or typedef.  */