aboutsummaryrefslogtreecommitdiff
path: root/gdb/buildsym.c
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-04-15 23:07:11 +0000
committerDavid Carlton <carlton@bactrian.org>2003-04-15 23:07:11 +0000
commit9219021cb5bab1206e80f84c2b4b7d8eac7eb4ea (patch)
tree24d969246b096eaff5c7caf64ab2425bcd2dbfbc /gdb/buildsym.c
parentff773b85a456d2a737126fc2d752579091fd2933 (diff)
downloadgdb-9219021cb5bab1206e80f84c2b4b7d8eac7eb4ea.zip
gdb-9219021cb5bab1206e80f84c2b4b7d8eac7eb4ea.tar.gz
gdb-9219021cb5bab1206e80f84c2b4b7d8eac7eb4ea.tar.bz2
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c. (COMMON_OBS): Add cp-namespace.o. (block.o): Depend on gdb_obstack_h and cp_support_h. (buildsym.o): Depend on cp_support_h. (cp-namespace.o): New. (cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h, gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h. (dwarf2read.o): Depend on cp_support_h. * jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE. * dwarf2read.c (process_die): Set processing_has_namespace_info, processing_current_namespace. (read_namespace): Update processing_current_namespace; check for anonymous namespaces. (dwarf2_name): New function. (dwarf2_extension): Ditto. * cp-support.h: Update copyright, contributors. Add inclusion guards. Add opaque declaration for structs obstack, block, symbol. (struct using_direct): New struct. Add declarations for cp_find_first_component, cp_entire_prefix_len, processing_has_namespace_info, processing_current_namespace, cp_is_anonymous, cp_add_using_directive, cp_initialize_namespace, cp_finalize_namespace, cp_set_block_scope, cp_scan_for_anonymous_namespaces. * cp-namespace.c: New file. * cp-support.c: Update copyright. Include ctype.h, gdb_assert.h, gdbcmd.h. New variable maint_cplus_cmd_list. (cp_find_first_component): New function. (cp_entire_prefix_len, maint_cplus_command) (first_component_command, _initialize_cp_support): Ditto. * buildsym.c: Include cp-support.h. New variable using_list. (add_symbol_to_list): Check for anonymous namespaces. (finish_block): Set block's scope. (start_symtab): Initialize C++ namespace support. (end_symtab): Finalize C++ namespace support. * block.h: Add opaque declarations for structs block_namespace_info, using_direct, and obstack. Add declarations for block_set_scope and block_set_using. (struct block): Add 'language_specific' member. (BLOCK_NAMESPACE): New macro. * block.c: Include gdb_obstack.h and cp-support.h. (struct block_namespace_info): New struct. (block_set_scope): New function. (block_set_using, block_initialize_namespace): Ditto. 2003-04-15 David Carlton <carlton@math.stanford.edu> * gdb.c++/maint.exp: New file.
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r--gdb/buildsym.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 4c4ac90..d3c9ddf 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -44,6 +44,8 @@
#include "macrotab.h"
#include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */
#include "block.h"
+#include "cp-support.h"
+
/* Ask buildsym.h to define the vars it normally declares `extern'. */
#define EXTERN
/**/
@@ -91,7 +93,10 @@ add_free_pendings (struct pending *list)
}
}
-/* Add a symbol to one of the lists of symbols. */
+/* Add a symbol to one of the lists of symbols. While we're at it, if
+ we're in the C++ case and don't have full namespace debugging info,
+ check to see if it references an anonymous namespace; if so, add an
+ appropriate using directive. */
void
add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
@@ -122,6 +127,12 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
}
(*listhead)->symbol[(*listhead)->nsyms++] = symbol;
+
+ /* Check to see if we might need to look for a mention of anonymous
+ namespaces. */
+
+ if (SYMBOL_LANGUAGE (symbol) == language_cplus)
+ cp_scan_for_anonymous_namespaces (symbol);
}
/* Find a symbol named NAME on a LIST. NAME need not be
@@ -280,6 +291,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_NAMESPACE (block) = NULL;
BLOCK_GCC_COMPILED (block) = processing_gcc_compilation;
@@ -372,6 +384,12 @@ finish_block (struct symbol *symbol, struct pending **listhead,
}
}
}
+
+ /* If we're in the C++ case, set the block's scope. */
+ if (SYMBOL_LANGUAGE (symbol) == language_cplus)
+ {
+ cp_set_block_scope (symbol, block, &objfile->symbol_obstack);
+ }
}
else
{
@@ -814,6 +832,10 @@ start_symtab (char *name, char *dirname, CORE_ADDR start_addr)
}
context_stack_depth = 0;
+ /* Set up support for C++ namespace support, in case we need it. */
+
+ cp_initialize_namespace ();
+
/* Initialize the list of sub source files with one entry for this
file (the top-level source file). */
@@ -935,6 +957,8 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr,
objfile);
blockvector = make_blockvector (objfile);
+ cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK),
+ &objfile->symbol_obstack);
}
#ifndef PROCESS_LINENUMBER_HOOK