]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2003-06-16 David Carlton <carlton@kealia.com>
authorDavid Carlton <carlton@bactrian.org>
Mon, 16 Jun 2003 20:00:46 +0000 (20:00 +0000)
committerDavid Carlton <carlton@bactrian.org>
Mon, 16 Jun 2003 20:00:46 +0000 (20:00 +0000)
* symfile.h: Change formatting.
* block.c (allocate_block): Rephrase comment.
* block.h (BLOCK_GCC_COMPILED): Move definition.
* cp-namespace.c: Include command.h instead of gdbcmd.h.  Update
comments, reorder functions.
(lookup_symbol_file): Set symtab when looking for namespace
symbols.  Update call to lookup_possible_namespace_symbol.
(initialize_namespace_blocks): Change comment.
(get_namespace_objfile): Change objfile name.
(cp_check_namespace_symbol): Extract body into
check_namespace_symbol_block.
(check_namespace_symbol_block): New.
(lookup_namespace_symbol): Make static, rename from
cp_lookup_symbol.
(check_possible_namespace_symbols_loop): Update comment.
(check_one_possible_namespace_symbol): Call
check_namespace_symbol_block.
(lookup_possible_namespace_symbol): Make static; rename from
cp_lookup_possible_namespace_symbol.
* cp-support.h: Update declarations.
* Makefile.in (c-typeprint.o): Don't depend on gdb_assert_h.
(cp-namespace.o): Depend on command_h, not gdbcmd_h.
* c-typeprint.c: Don't include gdb_assert.h.
(c_type_print_base): Delete assertion.  Use TYPE_TAG_NAME.
* dwarf2read.c: Delete double include of cp-support.h.
(add_partial_symbol): Look at psym for static variables.
(add_partial_namespace): Update call to
cp_check_namespace_symbol.
(locate_pdi_sibling): Update comment.

2003-06-16  David Carlton  <carlton@kealia.com>

* gdb.c++/namespace.exp: Add 'maint cp namespace' test.
* gdb.c++/maint.exp (test_namespace): Change comment.

12 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/block.c
gdb/block.h
gdb/c-typeprint.c
gdb/cp-namespace.c
gdb/cp-support.h
gdb/dwarf2read.c
gdb/symfile.h
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.c++/maint.exp
gdb/testsuite/gdb.c++/namespace.exp

index 040950dbc593f3c7cdaa2117102f650bba707d1e..f25e81b00b3b1e2d5370ec06d1983e59ce6a15e3 100644 (file)
@@ -1,3 +1,35 @@
+2003-06-16  David Carlton  <carlton@kealia.com>
+
+       * symfile.h: Change formatting.
+       * block.c (allocate_block): Rephrase comment.
+       * block.h (BLOCK_GCC_COMPILED): Move definition.
+       * cp-namespace.c: Include command.h instead of gdbcmd.h.  Update
+       comments, reorder functions.
+       (lookup_symbol_file): Set symtab when looking for namespace
+       symbols.  Update call to lookup_possible_namespace_symbol.
+       (initialize_namespace_blocks): Change comment.
+       (get_namespace_objfile): Change objfile name.
+       (cp_check_namespace_symbol): Extract body into
+       check_namespace_symbol_block.
+       (check_namespace_symbol_block): New.
+       (lookup_namespace_symbol): Make static, rename from
+       cp_lookup_symbol.
+       (check_possible_namespace_symbols_loop): Update comment.
+       (check_one_possible_namespace_symbol): Call
+       check_namespace_symbol_block.
+       (lookup_possible_namespace_symbol): Make static; rename from
+       cp_lookup_possible_namespace_symbol.
+       * cp-support.h: Update declarations.
+       * Makefile.in (c-typeprint.o): Don't depend on gdb_assert_h.
+       (cp-namespace.o): Depend on command_h, not gdbcmd_h.
+       * c-typeprint.c: Don't include gdb_assert.h.
+       (c_type_print_base): Delete assertion.  Use TYPE_TAG_NAME.
+       * dwarf2read.c: Delete double include of cp-support.h.
+       (add_partial_symbol): Look at psym for static variables.
+       (add_partial_namespace): Update call to
+       cp_check_namespace_symbol.
+       (locate_pdi_sibling): Update comment.
+
 2003-06-12  David Carlton  <carlton@kealia.com>
 
        * dwarf2read.c (die_specification): New.
index ca721d783b482df75c505e70f1b0952e52aeb73b..efa3a7ba1e53a2bfc5c0f632f6393f3186fa6c35 100644 (file)
@@ -1586,7 +1586,7 @@ c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
 c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \
        $(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \
-       $(gdb_string_h) $(gdb_assert_h)
+       $(gdb_string_h)
 c-valprint.o: c-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \
        $(c_lang_h) $(cp_abi_h)
@@ -1625,7 +1625,7 @@ cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) \
        $(gdbcmd_h) $(ui_out_h) $(gdb_string_h)
 cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \
        $(symtab_h) $(symfile_h) $(gdb_assert_h) $(block_h) $(objfiles_h) \
-       $(gdbtypes_h) $(dictionary_h) $(gdbcmd_h) $(frame_h)
+       $(gdbtypes_h) $(dictionary_h) $(command_h) $(frame_h)
 cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \
        $(demangle_h) $(gdb_assert_h) $(symtab_h) $(gdbcmd_h)
 cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \
index f2166ab10c21fb1386ba90ce81ae6b48c831b41b..c2bae05dbeb0be54257c9abbd98d13f05a04aabb 100644 (file)
@@ -268,13 +268,13 @@ block_global_block (const struct block *block)
   return block;
 }
 
-/* This allocates a block on OBSTACK, and initializes its elements to
+/* Allocate a block on OBSTACK, and initialize its elements to
    zero/NULL.  This is useful for creating "dummy" blocks that don't
    correspond to actual source files.
 
    Warning: it sets the block's BLOCK_DICT to NULL, which isn't a
-   valid value.  If you don't want the block to have a dictiionary,
-   then you should subsequently set its BLOCK_DICT to
+   valid value.  If you really don't want the block to have a
+   dictionary, then you should subsequently set its BLOCK_DICT to
    dict_create_linear (obstack, NULL).  */
 
 struct block *
index 72fa68d588bc944a310e5bdd2fd58f3c8330b72a..38d037e02260184dd41ca7eb9f853f749a3e3cd3 100644 (file)
@@ -115,9 +115,9 @@ struct block
 #define BLOCK_END(bl)          (bl)->endaddr
 #define BLOCK_FUNCTION(bl)     (bl)->function
 #define BLOCK_SUPERBLOCK(bl)   (bl)->superblock
+#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
 #define BLOCK_DICT(bl)         (bl)->dict
 #define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.namespace
-#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
 
 /* Macro to loop through all symbols in a block BL, in no particular
    order.  ITER helps keep track of the iteration, and should be a
index 8642a30f1e02d00832c2abdf1f0cbca8a97ac4b7..cc2e7dae8944d5199076bcbcf76a86e681460a01 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "gdb_string.h"
 #include <errno.h>
-#include "gdb_assert.h"
 
 /* Flag indicating target was compiled by HP compiler */
 extern int hp_som_som_object_present;
@@ -1186,9 +1185,8 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
       break;
 
     case TYPE_CODE_NAMESPACE:
-      gdb_assert (TYPE_NAME (type) != NULL);
       fputs_filtered ("namespace ", stream);
-      fputs_filtered (TYPE_NAME (type), stream);
+      fputs_filtered (TYPE_TAG_NAME (type), stream);
       break;
 
     default:
index 0f04f14d3d7db6b6fa4af14323a681a9b3780a6d..9142e13159c10694935fbc00a14d50516a9f202e 100644 (file)
@@ -30,7 +30,7 @@
 #include "objfiles.h"
 #include "gdbtypes.h"
 #include "dictionary.h"
-#include "gdbcmd.h"
+#include "command.h"
 #include "frame.h"
 
 /* When set, the file that we're processing seems to have debugging
@@ -76,10 +76,10 @@ static struct type *lookup_transparent_type_namespace_loop (const char *name,
                                                            const char *scope,
                                                            int scope_len);
 
-/* This block exists only to store symbols associated to namespaces.
-   Normally, try to avoid accessing it directly: instead, use
-   get_namespace_block if you can.  Similarly with
-   possible_namespace_block and namespace_objfile.  */
+/* The next three variables are used to store symbols associated to
+   namespaces.  Don't refer to them directly: use
+   get_namespace_block(), get_possible_namespace_block(), and
+   get_namespace_objfile() instead.  */
 
 static struct block *namespace_block = NULL;
 
@@ -93,16 +93,23 @@ static struct block *get_namespace_block (void);
 
 static struct block *get_possible_namespace_block (void);
 
+static void free_namespace_blocks (struct symtab *symtab);
+
 static struct objfile *get_namespace_objfile (void);
 
-static void free_namespace_blocks (struct symtab *symtab);
+static int check_namespace_symbol_block (const char *name, int len,
+                                        struct block *block);
 
-static int check_one_possible_namespace_symbol (const char *name,
-                                               int len);
+static struct symbol *lookup_namespace_symbol (const char *name);
 
 static int check_possible_namespace_symbols_loop (const char *name,
                                                  int len);
 
+static int check_one_possible_namespace_symbol (const char *name,
+                                               int len);
+
+static struct symbol *lookup_possible_namespace_symbol (const char *name);
+
 static void maintenance_print_namespace (char *args, int from_tty);
 
 /* Set up support for dealing with C++ namespace info in the current
@@ -485,7 +492,11 @@ lookup_symbol_file (const char *name,
                                       domain, symtab);
 
       if (sym == NULL || global_block == NULL)
-       sym = cp_lookup_namespace_symbol (name);
+       {
+         sym = lookup_namespace_symbol (name);
+         if (sym != NULL && symtab != NULL)
+           *symtab = NULL;
+       }
     }
   else
     {
@@ -495,7 +506,7 @@ lookup_symbol_file (const char *name,
   if (sym != NULL)
     return sym;
 
-  /* Now call "cp_lookup_possible_namespace_symbol".  Symbols in here
+  /* Now call "lookup_possible_namespace_symbol".  Symbols in here
      claim to be associated to namespaces, whereas the names in
      question might actually correspond to either namespaces or to
      classes.  But if they correspond to classes, then we should have
@@ -514,7 +525,7 @@ lookup_symbol_file (const char *name,
 
   if (domain == VAR_DOMAIN)
     {
-      sym = cp_lookup_possible_namespace_symbol (name);
+      sym = lookup_possible_namespace_symbol (name);
       if (sym != NULL)
        {
          if (symtab != NULL)
@@ -578,6 +589,25 @@ lookup_transparent_type_namespace_loop (const char *name, const char *scope,
   return lookup_transparent_type_aux (full_name);
 }
 
+/* Now come functions for dealing with symbols associated to
+   namespaces.  (They're used to store the namespaces themselves, not
+   objects that live in the namespaces.)  Since namespaces span files,
+   we create special blocks to store those symbols in instead of
+   storing them in blocks associated to actual files.  That avoids
+   duplication of symbols, among other issues.
+
+   Unfortunately, versions of GCC through at least 3.3 don't generate
+   debugging information to tell us about the existence of namespaces.
+   Our solution is to try to guess their existence by looking at
+   demangled names.  This might cause us to misidentify classes as
+   namespaces, however.  So we put those symbols in
+   'possible_namespace_block' instead of 'namespace_block', and we
+   only search that block as a last resort.  */
+
+/* FIXME: carlton/2003-06-12: Once versions of GCC that generate
+   DW_TAG_namespace have been out for a year or two, we should get rid
+   of possible_namespace_block and everything associated to it.  */
+
 /* Allocate everything necessary for namespace_block and
    possible_namespace_block.  */
 
@@ -594,9 +624,9 @@ initialize_namespace_blocks (void)
   namespace_symtab->free_code = free_nothing;
   namespace_symtab->dirname = NULL;
 
-  /* 2 = 3 blocks (global = namespace_block, static = NULL,
-     possible_namespace_block) - 1 block that's always part of struct
-     blockvector.  */
+  /* 2 = three blocks (global = namespace_block, static = NULL, third
+     block = possible_namespace_block), minus the one block that's
+     always part of struct blockvector.  */
   bv = obstack_alloc (&objfile->symbol_obstack,
                      sizeof (struct blockvector)
                      + 2 * sizeof (struct block *));
@@ -671,23 +701,37 @@ get_namespace_objfile (void)
     {
       namespace_objfile = allocate_objfile (NULL, 0);
       namespace_objfile->name
-       = mstrsave (namespace_objfile->md, "<C++-namespaces>");
+       = mstrsave (namespace_objfile->md, "<<C++-namespaces>>");
     }
 
   return namespace_objfile;
 }
 
-/* Check to see if there's already a namespace symbol corresponding to
-   the initial substring of NAME whose length is LEN; if there isn't
-   one, allocate one and add it to the namespace symtab.  Return the
-   symbol in question.  */
+/* Check to see if there's already a namespace symbol whose name is
+   NAME.  If there isn't one, allocate one and add it to the namespace
+   symtab.  */
 
-struct symbol *
-cp_check_namespace_symbol (const char *name, int len)
+void
+cp_check_namespace_symbol (const char *name)
+{
+  check_namespace_symbol_block (name, strlen (name),
+                               get_namespace_block ());
+}
+
+/* A helper function used by cp_check_namespace_symbol and
+   check_one_possible_namespace_symbol.  Looks to see if there is a
+   symbol whose name is the initial substring of NAME of length LEN in
+   block BLOCK; if not, adds it.  Return 1 if the symbol was already
+   in there, 0 otherwise.  */
+
+static int
+check_namespace_symbol_block (const char *name, int len,
+                             struct block *block)
 {
   struct objfile *objfile = get_namespace_objfile ();
   char *name_copy = obsavestring (name, len, &objfile->symbol_obstack);
-  struct symbol *sym = cp_lookup_namespace_symbol (name_copy);
+  struct symbol *sym = lookup_block_symbol (block, name_copy, NULL,
+                                           VAR_DOMAIN);
 
   if (sym == NULL)
     {
@@ -698,85 +742,60 @@ cp_check_namespace_symbol (const char *name, int len)
       sym = obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
       SYMBOL_LANGUAGE (sym) = language_cplus;
-      DEPRECATED_SYMBOL_NAME (sym) = name_copy;
+      SYMBOL_SET_NAMES (sym, name_copy, len, objfile);
       SYMBOL_CLASS (sym) = LOC_TYPEDEF;
       SYMBOL_TYPE (sym) = type;
       SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
 
-      dict_add_symbol (BLOCK_DICT (get_namespace_block ()), sym);
+      dict_add_symbol (BLOCK_DICT (block), sym);
+
+      return 0;
     }
   else
     {
       obstack_free (&objfile->symbol_obstack, name_copy);
-    }
 
-  return sym;
+      return 1;
+    }
 }
 
 /* Look for a symbol in namespace_block named NAME.  */
 
-struct symbol *
-cp_lookup_namespace_symbol (const char *name)
+static struct symbol *
+lookup_namespace_symbol (const char *name)
 {
   return lookup_block_symbol (get_namespace_block (), name, NULL,
                              VAR_DOMAIN);
 }
 
-/* The next few functions deal with "possible namespace symbols".
-   These are symbols that claim to be associated to namespaces,
-   whereas in fact we don't know if the object of that name is a
-   namespace or a class.  So don't trust them until you've searched
-   through all the global symbols to see if there's a class of that
-   name or not.  */
-
-/* FIXME: carlton/2002-12-18: This concept is a hack.  But it seems to
-   be the easiest way to deal with our desire for namespace symbols,
-   given the commonness of compilers that don't generate debugging
-   info for them.  Once such compilers are more common, we should
-   delete all the possible namespace stuff.  */
-
-/* Check to see if there's already a possible namespace symbol whose
-   name is the initial substring of NAME of length LEN.  If not,
-   create one and return 0; otherwise, return 1.  */
+/* Ensure that there are symbols in possible_namespace_block for all
+   initial substrings of NAME that look like namespaces or classes.
+   NAME should end in a member variable: it shouldn't consist solely
+   of namespaces.  */
 
-static int
-check_one_possible_namespace_symbol (const char *name, int len)
+void
+cp_check_possible_namespace_symbols (const char *name)
 {
-  struct objfile *objfile = get_namespace_objfile ();
-  char *name_copy = obsavestring (name, len, &objfile->symbol_obstack);
-  const struct block *block = get_possible_namespace_block ();
-  struct symbol *sym = lookup_block_symbol (block, name_copy,
-                                           NULL, VAR_DOMAIN);
-
-  if (sym == NULL)
-    {
-      struct type *type = init_type (TYPE_CODE_NAMESPACE, 0, 0,
-                                    name_copy, objfile);
-      TYPE_TAG_NAME (type) = TYPE_NAME (type);
-
-      sym = obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
-      memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_LANGUAGE (sym) = language_cplus;
-      DEPRECATED_SYMBOL_NAME (sym) = name_copy;
-      SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-      SYMBOL_TYPE (sym) = type;
-      SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
-
-      dict_add_symbol (BLOCK_DICT (block), sym);
-      return 0;
-    }
-  else
-    {
-      obstack_free (&objfile->symbol_obstack, name_copy);
-      return 1;
-    }
+  check_possible_namespace_symbols_loop (name,
+                                        cp_find_first_component (name));
 }
 
 /* This is a helper loop for cp_check_possible_namespace_symbols; it
    ensures that there are namespace symbols for all namespaces that
-   are initial substrings of NAME of length LEN.  It returns 1 if a
-   previous loop had already created the shortest such symbol and 0
-   otherwise.  */
+   are initial substrings of NAME of length at least LEN.  It returns
+   1 if a previous loop had already created the shortest such symbol
+   and 0 otherwise.
+
+   This function assumes that if there is already a symbol associated
+   to a substring of NAME of a given length, then there are already
+   symbols associated to all substrings of NAME whose length is less
+   than that length.  So if cp_check_possible_namespace_symbols has
+   been called once with argument "A::B::C::member", then that will
+   create symbols "A", "A::B", and "A::B::C".  If it is then later
+   called with argument "A::B::D::member", then the new call will
+   generate a new symbol for "A::B::D", but once it sees that "A::B"
+   has already been created, it doesn't bother checking to see if "A"
+   has also been created.  */
 
 static int
 check_possible_namespace_symbols_loop (const char *name, int len)
@@ -800,21 +819,21 @@ check_possible_namespace_symbols_loop (const char *name, int len)
     return 0;
 }
 
-/* Ensure that there are symbols in possible_namespace_block for all
-   initial substrings of NAME that look like namespaces or
-   classes.  */
+/* Check to see if there's already a possible namespace symbol whose
+   name is the initial substring of NAME of length LEN.  If not,
+   create one and return 0; otherwise, return 1.  */
 
-void
-cp_check_possible_namespace_symbols (const char *name)
+static int
+check_one_possible_namespace_symbol (const char *name, int len)
 {
-  check_possible_namespace_symbols_loop (name,
-                                        cp_find_first_component (name));
+  return check_namespace_symbol_block (name, len,
+                                      get_possible_namespace_block ());
 }
 
 /* Look for a symbol in possible_namespace_block named NAME.  */
 
-struct symbol *
-cp_lookup_possible_namespace_symbol (const char *name)
+static struct symbol *
+lookup_possible_namespace_symbol (const char *name)
 {
   return lookup_block_symbol (get_possible_namespace_block (),
                              name, NULL, VAR_DOMAIN);
index 7423872ebfdb0b51fc7b7c8da29ce39c31f9d850..9cfee7cce6b4ede5812c6ddc926eeaeef301410d 100644 (file)
@@ -57,17 +57,8 @@ extern unsigned int cp_find_first_component (const char *name);
 
 extern unsigned int cp_entire_prefix_len (const char *name);
 
-extern struct symbol *cp_check_namespace_symbol (const char *name, int len);
-
-extern struct symbol *cp_lookup_namespace_symbol (const char *name);
-
-extern void cp_check_possible_namespace_symbols (const char *name);
-
-extern struct symbol *cp_lookup_possible_namespace_symbol (const char *name);
-
 extern char *cp_func_name (const char *full_name);
 
-
 /* Functions/variables from cp-namespace.c.  */
 
 extern unsigned char processing_has_namespace_info;
@@ -104,6 +95,10 @@ extern struct symbol *cp_lookup_symbol_namespace (const char *namespace,
                                                  const domain_enum domain,
                                                  struct symtab **symtab);
 
+extern void cp_check_namespace_symbol (const char *name);
+
+extern void cp_check_possible_namespace_symbols (const char *name);
+
 struct type *lookup_transparent_type_namespace (const char *name);
 
 /* The list of "maint cplus" commands.  */
index 17ab37498ebc1d9793db662d14e399c6024b5ac8..f614eb566366f1ed7a9f3fa50ab939219b16c591 100644 (file)
@@ -49,7 +49,6 @@
 #include "gdb_string.h"
 #include "gdb_assert.h"
 #include <sys/types.h>
-#include "cp-support.h"
 
 #ifndef DWARF2_REG_TO_REGNUM
 #define DWARF2_REG_TO_REGNUM(REG) (REG)
@@ -1610,10 +1609,11 @@ add_partial_symbol (struct partial_die_info *pdi, struct objfile *objfile,
          addr = decode_locdesc (pdi->locdesc, objfile, cu_header);
          /*prim_record_minimal_symbol (actual_name, addr + baseaddr,
             mst_file_data, objfile); */
-         add_psymbol_to_list (actual_name, strlen (actual_name),
-                              VAR_DOMAIN, LOC_STATIC,
-                              &objfile->static_psymbols,
-                              0, addr + baseaddr, cu_language, objfile);
+         psym = add_psymbol_to_list (actual_name, strlen (actual_name),
+                                     VAR_DOMAIN, LOC_STATIC,
+                                     &objfile->static_psymbols,
+                                     0, addr + baseaddr,
+                                     cu_language, objfile);
        }
       break;
     case DW_TAG_typedef:
@@ -1720,7 +1720,7 @@ add_partial_namespace (struct partial_die_info *pdi, char *info_ptr,
 
   /* Make sure that there's a symbol associated to that namespace.  */
 
-  cp_check_namespace_symbol (full_name, strlen (full_name));
+  cp_check_namespace_symbol (full_name);
 
   /* Now scan partial symbols in that namespace.  */
 
@@ -1817,8 +1817,8 @@ add_partial_enumeration (struct partial_die_info *enum_pdi, char *info_ptr,
   return info_ptr;
 }
 
-/* Locate ORIG_PDI's sibling; INFO_PTR points to the next PDI after
-   ORIG_PDI.  */
+/* Locate ORIG_PDI's sibling; INFO_PTR should point to the next PDI
+   after ORIG_PDI.  */
 
 static char *
 locate_pdi_sibling (struct partial_die_info *orig_pdi, char *info_ptr,
index 2416ec2001cfb044d90631b4fdfd6175eabb21f8..ca67dda52c33619a5c06b95a73a1969471f45df9 100644 (file)
@@ -148,17 +148,20 @@ extern void extend_psymbol_list (struct psymbol_allocation_list *,
 
 /* #include "demangle.h" */
 
-extern const struct partial_symbol *
-add_psymbol_to_list (char *, int, domain_enum, enum address_class,
-                    struct psymbol_allocation_list *, long, CORE_ADDR,
-                    enum language, struct objfile *);
-
-extern void
-add_psymbol_with_dem_name_to_list (char *, int, char *, int, domain_enum,
-                                  enum address_class,
-                                  struct psymbol_allocation_list *,
-                                  long, CORE_ADDR,
-                                  enum language, struct objfile *);
+extern const
+struct partial_symbol *add_psymbol_to_list (char *, int, domain_enum,
+                                           enum address_class,
+                                           struct psymbol_allocation_list *,
+                                           long, CORE_ADDR,
+                                           enum language, struct objfile *);
+
+extern void add_psymbol_with_dem_name_to_list (char *, int, char *, int,
+                                              domain_enum,
+                                              enum address_class,
+                                              struct psymbol_allocation_list
+                                              *, long, CORE_ADDR,
+                                              enum language,
+                                              struct objfile *);
 
 
 extern void init_psymbol_list (struct objfile *, int);
index 1d74b6f81e654f808ed8824ee72c0b6c02c56cf1..862a9245e44a4341b48c3f5c53dd17f2a90ed865 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-16  David Carlton  <carlton@kealia.com>
+
+       * gdb.c++/namespace.exp: Add 'maint cp namespace' test.
+       * gdb.c++/maint.exp (test_namespace): Change comment.
+
 2003-05-22  Jim Blandy  <jimb@redhat.com>
 
        * gdb.base/corefile.exp: Tolerate stuff after argument parens in
index 4138f8c626231ba727b246203b899922e7e35788..110cfc9250a633d4a3f19a4c0b3aa145f45b8e9e 100644 (file)
@@ -88,9 +88,7 @@ proc test_first_component {} {
 }
 
 proc test_namespace {} {
-    # FIXME: carlton/2003-04-28: I should think of more tests to add
-    # here.  Unfortunately, it's hard to predict exactly what will be
-    # picked up from the library, or what order it will be in.
+    # There are some more tests for this command in namespace.exp.
 
     gdb_test "maint cp namespace" "Definite namespaces:\r\nPossible namespaces:"
 }
index 5bf976b5ff6096b7f0f6b56cc699eb2fd594f5b0..c4fd69c5d9ac47fcca4a3cb29f7bc31a89f8bbbf 100644 (file)
@@ -313,3 +313,18 @@ setup_kfail "c++/831" "*-*-*"
 gdb_test "print r1" "\\$\[0-9\].* = 19"
 setup_kfail "c++/831" "*-*-*"
 gdb_test "print r2" "No symbol \"r2\" in current context."
+
+# Test to make sure that 'maint cplus namespace' is at least picking
+# up one of the namespaces in this file.
+
+# FIXME: carlton/2003-06-16: We should check to make sure it picks up
+# all of the namespaces.  Unfortunately, I can't guarantee what order
+# they'll be listed in when you do 'maint cplus namespace'.  Probably
+# I should stash the output of that command in a variable somewhere
+# and examine that variable for all of the relevant namespaces.
+
+# FIXME: carlton/2003-06-16: This test (like many others in this file,
+# doubtless) will fail in non-DWARF-2 situations; I need to go through
+# and audit the tests accordingly at some point.
+
+gdb_test "maint cplus namespace" ".*C::C.*"