forked from Imagelibrary/binutils-gdb
* buildsym.c (add_symbol_to_list): Do not call
cp_scan_for_anonymous_namespaces here. (finish_block): Do not call cp_set_block_scope here. * cp-namespace.c (processing_has_namespace_info) (processing_current_prefix): Delete. (cp_initialize_namespace): Do not initialize processing_has_namespace_info. (cp_scan_for_anonymous_namespaces): Use SYMBOL_DEMANGLED_NAME. Do not check processing_has_namespace_info. (cp_set_block_scope): Take prefix and namespace info flag as arguments. Honor namespaces regardless of a demangled name. * cp-support.h (processing_has_namespace_info) (processing_current_prefix): Delete declarations. (cp_set_block_scope): Update prototype. * dwarf2read.c (processing_has_namespace_info) (processing_current_prefix): New static variables. (read_file_scope): Initialize processing_has_namespace_info. (read_func_scope): Call cp_set_block_scope for C++. (new_symbol): Call cp_scan_for_anonymous_namespaces for C++. * symtab.c (symbol_demangled_name): Accept a const argument. * symtab.h (symbol_demangled_name): Update prototype.
This commit is contained in:
@@ -141,6 +141,29 @@ typedef struct statement_prologue
|
||||
}
|
||||
_STATEMENT_PROLOGUE;
|
||||
|
||||
/* When set, the file that we're processing is known to have debugging
|
||||
info for C++ namespaces. GCC 3.3.x did not produce this information,
|
||||
but later versions do. */
|
||||
|
||||
static int processing_has_namespace_info;
|
||||
|
||||
/* This contains our best guess as to the name of the current
|
||||
enclosing namespace(s)/class(es), if any. For example, if we're
|
||||
within the method foo() in the following code:
|
||||
|
||||
namespace N {
|
||||
class C {
|
||||
void foo () {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
then processing_current_prefix should be set to "N::C". If
|
||||
processing_has_namespace_info is false, then this variable might
|
||||
not be reliable. */
|
||||
|
||||
static const char *processing_current_prefix;
|
||||
|
||||
static const struct objfile_data *dwarf2_objfile_data_key;
|
||||
|
||||
struct dwarf2_per_objfile
|
||||
@@ -2850,6 +2873,8 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
/* We assume that we're processing GCC output. */
|
||||
processing_gcc_compilation = 2;
|
||||
|
||||
processing_has_namespace_info = 0;
|
||||
|
||||
start_symtab (name, comp_dir, lowpc);
|
||||
record_debugformat ("DWARF 2");
|
||||
record_producer (cu->producer);
|
||||
@@ -3020,6 +3045,12 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
block = finish_block (new->name, &local_symbols, new->old_blocks,
|
||||
lowpc, highpc, objfile);
|
||||
|
||||
/* For C++, set the block's scope. */
|
||||
if (cu->language == language_cplus)
|
||||
cp_set_block_scope (new->name, block, &objfile->objfile_obstack,
|
||||
processing_current_prefix,
|
||||
processing_has_namespace_info);
|
||||
|
||||
/* If we have address ranges, record them. */
|
||||
dwarf2_record_block_ranges (die, block, baseaddr, cu);
|
||||
|
||||
@@ -7606,6 +7637,13 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||
dwarf_tag_name (die->tag));
|
||||
break;
|
||||
}
|
||||
|
||||
/* For the benefit of old versions of GCC, check for anonymous
|
||||
namespaces based on the demangled name. */
|
||||
if (!processing_has_namespace_info
|
||||
&& cu->language == language_cplus
|
||||
&& dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu) != NULL)
|
||||
cp_scan_for_anonymous_namespaces (sym);
|
||||
}
|
||||
return (sym);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user