[dictionary] tweaks to match mainline patch

David Carlton carlton@kealia.com
Mon Jun 16 20:01:00 GMT 2003


This tweaks my branch a bit to match the patch that I'm about to
submit to mainline, since I noticed some minor cleanups while
generating that patch.

David Carlton
carlton@kealia.com

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-16  David Carlton  <carlton@kealia.com>

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

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.3256.2.75
diff -u -p -r1.3256.2.75 ChangeLog
--- ChangeLog	12 Jun 2003 18:45:46 -0000	1.3256.2.75
+++ ChangeLog	16 Jun 2003 19:57:31 -0000
@@ -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: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.262.2.32
diff -u -p -r1.262.2.32 Makefile.in
--- Makefile.in	23 May 2003 22:28:53 -0000	1.262.2.32
+++ Makefile.in	16 Jun 2003 19:57:34 -0000
@@ -1586,7 +1586,7 @@ c-lang.o: c-lang.c $(defs_h) $(symtab_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) 
 	$(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: block.c
===================================================================
RCS file: /cvs/src/src/gdb/block.c,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 block.c
--- block.c	23 May 2003 18:40:35 -0000	1.1.2.11
+++ block.c	16 Jun 2003 19:57:35 -0000
@@ -268,13 +268,13 @@ block_global_block (const struct 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: block.h
===================================================================
RCS file: /cvs/src/src/gdb/block.h,v
retrieving revision 1.1.2.12
diff -u -p -r1.1.2.12 block.h
--- block.h	23 May 2003 18:40:35 -0000	1.1.2.12
+++ block.h	16 Jun 2003 19:57:35 -0000
@@ -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: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.22.8.5
diff -u -p -r1.22.8.5 c-typeprint.c
--- c-typeprint.c	7 Feb 2003 19:17:45 -0000	1.22.8.5
+++ c-typeprint.c	16 Jun 2003 19:57:36 -0000
@@ -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, st
       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: cp-namespace.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-namespace.c,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 cp-namespace.c
--- cp-namespace.c	23 May 2003 22:28:54 -0000	1.1.2.5
+++ cp-namespace.c	16 Jun 2003 19:57:37 -0000
@@ -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_t
 							    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
 
 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 (
   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 *n
       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 (c
     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: cp-support.h
===================================================================
RCS file: /cvs/src/src/gdb/cp-support.h,v
retrieving revision 1.1.2.17
diff -u -p -r1.1.2.17 cp-support.h
--- cp-support.h	23 May 2003 22:28:54 -0000	1.1.2.17
+++ cp-support.h	16 Jun 2003 19:57:37 -0000
@@ -57,17 +57,8 @@ extern unsigned int cp_find_first_compon
 
 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;
@@ -103,6 +94,10 @@ extern struct symbol *cp_lookup_symbol_n
 						  const struct block *block,
 						  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);
 
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.66.4.30
diff -u -p -r1.66.4.30 dwarf2read.c
--- dwarf2read.c	12 Jun 2003 18:45:48 -0000	1.66.4.30
+++ dwarf2read.c	16 Jun 2003 19:57:45 -0000
@@ -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_i
 	  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_di
 
   /* 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_
   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: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.13.14.8
diff -u -p -r1.13.14.8 symfile.h
--- symfile.h	23 May 2003 18:40:45 -0000	1.13.14.8
+++ symfile.h	16 Jun 2003 19:57:47 -0000
@@ -148,17 +148,20 @@ extern void extend_psymbol_list (struct 
 
 /* #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 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 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: testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.402.2.34
diff -u -p -r1.402.2.34 ChangeLog
--- testsuite/ChangeLog	23 May 2003 18:40:51 -0000	1.402.2.34
+++ testsuite/ChangeLog	16 Jun 2003 19:58:01 -0000
@@ -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: testsuite/gdb.c++/maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/maint.exp,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 maint.exp
--- testsuite/gdb.c++/maint.exp	1 May 2003 00:46:56 -0000	1.1.2.4
+++ testsuite/gdb.c++/maint.exp	16 Jun 2003 19:58:02 -0000
@@ -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: testsuite/gdb.c++/namespace.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/namespace.exp,v
retrieving revision 1.12.16.15
diff -u -p -r1.12.16.15 namespace.exp
--- testsuite/gdb.c++/namespace.exp	23 May 2003 18:40:52 -0000	1.12.16.15
+++ testsuite/gdb.c++/namespace.exp	16 Jun 2003 19:58:03 -0000
@@ -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.*"



More information about the Gdb-patches mailing list