]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2002-10-18 David Carlton <carlton@math.stanford.edu>
authorDavid Carlton <carlton@bactrian.org>
Fri, 18 Oct 2002 23:42:59 +0000 (23:42 +0000)
committerDavid Carlton <carlton@bactrian.org>
Fri, 18 Oct 2002 23:42:59 +0000 (23:42 +0000)
* Makefile.in (block_h): New variable.
Updated dependencies to reflect it.
* parse.c (parse_exp_1): Use BLOCK_START.
#include "block.h"
* p-exp.tab.c: Regenerated.
* m2-exp.tab.c: Ditto.
* jv-exp.tab.c: Ditto.
* f-exp.tab.c: Ditto.
* c-exp.tab.c: Ditto.
* ada-exp.tab.c: Ditto.
* ada-lang.c: #include "block.h"
* p-exp.y: Ditto.
* objc-exp.y: Ditto.
* m2-exp.y: Ditto.
* jv-exp.y: Ditto.
* f-exp.y: Ditto.
* c-exp.y: Ditto.
* ada-exp.y: Ditto.
* values.c: Ditto.
* valops.c: Ditto.
* tracepoint.c: Ditto.
* symtab.c: Ditto.
* symmisc.c: Ditto.
* symfile.c: Ditto.
* stack.c: Ditto.
* printcmd.c: Ditto.
* objfiles.c: Ditto.
* objc-lang.c: Ditto.
* nlmread.c: Ditto.
* mips-tdep.c: Ditto.
* mdebugread.c: Ditto.
* linespec.c: Ditto.
* jv-lang.c: Ditto.
* infcmd.c: Ditto.
* f-valprint.c: Ditto.
* findvar.c: Ditto.
* expprint.c: Ditto.
* coffread.c: Ditto.
* buildsym.c: Ditto.
* breakpoint.c: Ditto.
* blockframe.c: Ditto.
* ax-gdb.c: Ditto.
* alpha-tdep.c: Ditto.
* block.h: New file.
* symtab.h: Moved struct block, struct blockvector, and related
macros and function declarations to block.h.
* dwarf2read.c (process_die): Set processing_has_namespace_info if
we run into DW_TAG_namespace, DW_TAG_imported_declaration, or
DW_TAG_imported_module.
New variable current_namespace.
(psymtab_to_symtab_1): Set current_namespace to "".
(dwarf2_name): New function.
(dwarf2_add_member_fn): Get name via dwarf2_name.
(read_typedef): Ditto.
(read_file_scope): Ditto.
(dwarf2_add_field): Ditto.
(read_structure_scope): Ditto.
(read_enumeration): Ditto.
(dwarf2_extension): New function.
(read_namespace): Set current_namespace correctly; also, if we're
entering an anonymous namespace, add an appropriate using
directive.
* buildsym.c (start_symtab): Reset processing_has_namespace_info
to 0.
(add_symbol_to_list): Only scan for anonymous namespaces if
!processing_has_namespace_info.
* buildsym.h: Add new flag processing_has_namespace_info.

2002-10-18  David Carlton  <carlton@math.stanford.edu>

* mi-cmd-stack.c: #include "block.h"

42 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/ada-exp.y
gdb/ada-lang.c
gdb/alpha-tdep.c
gdb/ax-gdb.c
gdb/block.h [new file with mode: 0644]
gdb/blockframe.c
gdb/breakpoint.c
gdb/buildsym.c
gdb/buildsym.h
gdb/c-exp.y
gdb/coffread.c
gdb/dwarf2read.c
gdb/expprint.c
gdb/f-exp.y
gdb/f-valprint.c
gdb/findvar.c
gdb/infcmd.c
gdb/jv-exp.y
gdb/jv-lang.c
gdb/linespec.c
gdb/m2-exp.y
gdb/mdebugread.c
gdb/mi/ChangeLog
gdb/mi/mi-cmd-stack.c
gdb/mips-tdep.c
gdb/nlmread.c
gdb/objc-exp.y
gdb/objc-lang.c
gdb/objfiles.c
gdb/p-exp.y
gdb/parse.c
gdb/printcmd.c
gdb/stack.c
gdb/symfile.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/tracepoint.c
gdb/valops.c
gdb/values.c

index e0c59bf81a6449b0a742fed319b93b8afda81883..60aad17647eb03becf7b036873a262cfb6b1cfde 100644 (file)
@@ -1,3 +1,73 @@
+2002-10-18  David Carlton  <carlton@math.stanford.edu>
+
+       * Makefile.in (block_h): New variable.
+       Updated dependencies to reflect it.
+       * parse.c (parse_exp_1): Use BLOCK_START.
+       #include "block.h"
+       * p-exp.tab.c: Regenerated.
+       * m2-exp.tab.c: Ditto.
+       * jv-exp.tab.c: Ditto.
+       * f-exp.tab.c: Ditto.
+       * c-exp.tab.c: Ditto.
+       * ada-exp.tab.c: Ditto.
+       * ada-lang.c: #include "block.h"
+       * p-exp.y: Ditto.
+       * objc-exp.y: Ditto.
+       * m2-exp.y: Ditto.
+       * jv-exp.y: Ditto.
+       * f-exp.y: Ditto.
+       * c-exp.y: Ditto.
+       * ada-exp.y: Ditto.
+       * values.c: Ditto.
+       * valops.c: Ditto.
+       * tracepoint.c: Ditto.
+       * symtab.c: Ditto.
+       * symmisc.c: Ditto.
+       * symfile.c: Ditto.
+       * stack.c: Ditto.
+       * printcmd.c: Ditto.
+       * objfiles.c: Ditto.
+       * objc-lang.c: Ditto.
+       * nlmread.c: Ditto.
+       * mips-tdep.c: Ditto.
+       * mdebugread.c: Ditto.
+       * linespec.c: Ditto.
+       * jv-lang.c: Ditto.
+       * infcmd.c: Ditto.
+       * f-valprint.c: Ditto.
+       * findvar.c: Ditto.
+       * expprint.c: Ditto.
+       * coffread.c: Ditto.
+       * buildsym.c: Ditto.
+       * breakpoint.c: Ditto.
+       * blockframe.c: Ditto.
+       * ax-gdb.c: Ditto.
+       * alpha-tdep.c: Ditto.
+       * block.h: New file.
+       * symtab.h: Moved struct block, struct blockvector, and related
+       macros and function declarations to block.h.
+       * dwarf2read.c (process_die): Set processing_has_namespace_info if
+       we run into DW_TAG_namespace, DW_TAG_imported_declaration, or
+       DW_TAG_imported_module.
+       New variable current_namespace.
+       (psymtab_to_symtab_1): Set current_namespace to "".
+       (dwarf2_name): New function.
+       (dwarf2_add_member_fn): Get name via dwarf2_name.
+       (read_typedef): Ditto.
+       (read_file_scope): Ditto.
+       (dwarf2_add_field): Ditto.
+       (read_structure_scope): Ditto.
+       (read_enumeration): Ditto.
+       (dwarf2_extension): New function.
+       (read_namespace): Set current_namespace correctly; also, if we're
+       entering an anonymous namespace, add an appropriate using
+       directive.
+       * buildsym.c (start_symtab): Reset processing_has_namespace_info
+       to 0.
+       (add_symbol_to_list): Only scan for anonymous namespaces if
+       !processing_has_namespace_info.
+       * buildsym.h: Add new flag processing_has_namespace_info.
+
 2002-10-16  David Carlton  <carlton@math.stanford.edu>
 
        * dwarf2read.c (dwarf_tag_name): Add DWARF 3 names.
index ed359957d2d9018be4dc8b36206dccfec4f9cb49..248f38f645322421d640d9f6bb3e7d3335db5c8d 100644 (file)
@@ -621,6 +621,7 @@ arm_tdep_h = arm-tdep.h $(osabi_h)
 ax_gdb_h = ax-gdb.h
 ax_h = ax.h $(doublest_h)
 bcache_h = bcache.h
+block_h = block.h
 breakpoint_h = breakpoint.h $(frame_h) $(value_h) $(gdb_events_h)
 buildsym_h = buildsym.h
 builtin_regs_h = builtin-regs.h
@@ -1437,28 +1438,28 @@ z8k-tdep.o: $(srcdir)/z8k-tdep.c
 c-exp.tab.o: c-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \
        $(value_h) $(parser_defs_h) $(language_h) $(c_lang_h) $(bfd_h) \
        $(charset_h) \
-       $(symfile_h) $(objfiles_h)
+       $(symfile_h) $(objfiles_h) $(block_h)
 
 jv-exp.tab.o: jv-exp.tab.c jv-lang.h $(defs_h) $(expression_h) \
        $(gdbtypes_h) $(language_h) $(parser_defs_h) $(symtab_h) $(value_h) \
-       $(bfd_h) $(objfiles_h) $(symfile_h)
+       $(bfd_h) $(objfiles_h) $(symfile_h) $(block_h)
 
 f-exp.tab.o: f-exp.tab.c f-lang.h $(defs_h) $(expression_h) \
        $(language_h) $(parser_defs_h) $(value_h) $(bfd_h) $(objfiles_h) \
-       $(symfile_h)
+       $(symfile_h) $(block_h)
 
 m2-exp.tab.o: m2-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
        $(language_h) m2-lang.h $(parser_defs_h) $(symtab_h) $(value_h) \
-       $(bfd_h) $(objfiles_h) $(symfile_h)
+       $(bfd_h) $(objfiles_h) $(symfile_h) $(block_h)
 
 p-exp.tab.o: p-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
        $(language_h) p-lang.h $(parser_defs_h) $(symtab_h) $(value_h) \
-       $(bfd_h) $(objfiles_h) $(symfile_h)
+       $(bfd_h) $(objfiles_h) $(symfile_h) $(block_h)
 
 ada-exp.tab.o: ada-exp.tab.c ada-lex.c ada-lang.h \
        $(defs_h) $(expression_h) \
        $(gdbtypes_h) language.h parser-defs.h $(symtab_h) $(value_h) \
-       $(bfd_h) objfiles.h symfile.h
+       $(bfd_h) objfiles.h symfile.h $(block_h)
 
 #
 # The dependencies.  In aphabetic order.
@@ -1470,7 +1471,8 @@ abug-rom.o: abug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 ada-lang.o: ada-lang.c $(gdb_string_h) $(demangle_h) $(defs_h) $(symtab_h) \
        $(gdbtypes_h) $(gdbcmd_h) $(expression_h) $(parser_defs_h) \
        $(language_h) $(c_lang_h) $(inferior_h) $(symfile_h) $(objfiles_h) \
-       $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(dictionary_h) $(ui_out_h)
+       $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(dictionary_h) \
+       $(ui_out_h) $(block_h)
 ada-tasks.o: ada-tasks.c $(defs_h) $(command_h) $(value_h) $(language_h) \
        $(inferior_h) $(symtab_h) $(target_h) $(gdbcore_h) $(gregset_h) \
        $(ada_lang_h)
@@ -1493,7 +1495,7 @@ alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
 alpha-tdep.o: alpha-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
        $(value_h) $(gdbcmd_h) $(gdbcore_h) $(dis_asm_h) $(symfile_h) \
        $(objfiles_h) $(gdb_string_h) $(linespec_h) $(regcache_h) \
-       $(doublest_h) $(arch_utils_h) $(elf_bfd_h) $(alpha_tdep_h)
+       $(doublest_h) $(arch_utils_h) $(elf_bfd_h) $(alpha_tdep_h) $(block_h)
 alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
        $(alpha_tdep_h) $(alphabsd_tdep_h) $(gregset_h)
 alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) $(alpha_tdep_h) \
@@ -1528,23 +1530,26 @@ avr-tdep.o: avr-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \
        $(symfile_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h)
 ax-gdb.o: ax-gdb.c $(defs_h) $(symtab_h) $(symfile_h) $(gdbtypes_h) \
        $(value_h) $(expression_h) $(command_h) $(gdbcmd_h) $(frame_h) \
-       $(target_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h)
+       $(target_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h) $(block_h)
 ax-general.o: ax-general.c $(defs_h) $(ax_h) $(value_h) $(gdb_string_h)
 bcache.o: bcache.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(gdb_string_h)
 blockframe.o: blockframe.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \
        $(objfiles_h) $(frame_h) $(gdbcore_h) $(value_h) $(target_h) \
-       $(inferior_h) $(annotate_h) $(regcache_h) $(gdb_assert_h)
+       $(inferior_h) $(annotate_h) $(regcache_h) $(gdb_assert_h) \
+       $(block_h)
 breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \
        $(gdbtypes_h) $(expression_h) $(gdbcore_h) $(gdbcmd_h) $(value_h) \
        $(command_h) $(inferior_h) $(gdbthread_h) $(target_h) $(language_h) \
        $(gdb_string_h) $(demangle_h) $(annotate_h) $(symfile_h) \
        $(objfiles_h) $(linespec_h) $(completer_h) $(gdb_h) $(ui_out_h) \
-       $(cli_script_h) $(gdb_events_h) $(source_h) $(dictionary_h)
+       $(cli_script_h) $(gdb_events_h) $(source_h) $(dictionary_h) \
+       $(block_h)
 buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
        $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(complaints_h) \
        $(gdb_string_h) $(expression_h) $(language_h) $(bcache_h) \
        $(filenames_h) $(macrotab_h) $(demangle_h) $(buildsym_h) \
-       $(stabsread_h) $(dictionary_h) $(gdb_assert_h) $(cp_support_h)
+       $(stabsread_h) $(dictionary_h) $(gdb_assert_h) $(cp_support_h) \
+       $(block_h)
 builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \
        $(gdb_string_h) $(gdb_assert_h)
 c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
@@ -1570,7 +1575,7 @@ coffread.o: coffread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(demangle_h) \
        $(breakpoint_h) $(bfd_h) $(gdb_obstack_h) $(gdb_string_h) \
        $(coff_internal_h) $(libcoff_h) $(symfile_h) $(objfiles_h) \
        $(buildsym_h) $(gdb_stabs_h) $(stabsread_h) $(complaints_h) \
-       $(target_h) $(gdb_assert_h) $(dictionary_h)
+       $(target_h) $(gdb_assert_h) $(dictionary_h) $(block_h)
 complaints.o: complaints.c $(defs_h) $(complaints_h) $(gdb_assert_h) \
        $(command_h) $(gdbcmd_h)
 completer.o: completer.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
@@ -1659,7 +1664,7 @@ exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
        $(language_h) $(symfile_h) $(objfiles_h) $(completer_h) $(value_h) \
        $(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) $(xcoffsolib_h)
 expprint.o: expprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
-       $(value_h) $(language_h) $(parser_defs_h)
+       $(value_h) $(language_h) $(parser_defs_h) $(block_h)
 f-lang.o: f-lang.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(expression_h) $(parser_defs_h) $(language_h) $(f_lang_h) \
        $(valprint_h)
@@ -1668,13 +1673,13 @@ f-typeprint.o: f-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
        $(f_lang_h) $(gdb_string_h)
 f-valprint.o: f-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \
-       $(f_lang_h) $(frame_h) $(gdbcore_h) $(command_h)
+       $(f_lang_h) $(frame_h) $(gdbcore_h) $(command_h) $(block_h)
 fbsd-proc.o: fbsd-proc.c $(defs_h) $(gdbcore_h) $(inferior_h) \
        $(gdb_string_h) $(elf_bfd_h) $(gregset_h)
 findvar.o: findvar.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(frame_h) \
        $(value_h) $(gdbcore_h) $(inferior_h) $(target_h) $(gdb_string_h) \
        $(gdb_assert_h) $(floatformat_h) $(symfile_h) $(regcache_h) \
-       $(builtin_regs_h)
+       $(builtin_regs_h) $(block_h)
 fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \
        $(inferior_h) $(target_h) $(gdb_wait_h) $(gdb_vfork_h) $(gdbcore_h) \
        $(terminal_h) $(gdbthread_h) $(command_h)
@@ -1790,7 +1795,7 @@ infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(frame_h) $(inferior_h) $(environ_h) $(value_h) $(gdbcmd_h) \
        $(symfile_h) $(gdbcore_h) $(target_h) $(language_h) $(symfile_h) \
        $(objfiles_h) $(completer_h) $(ui_out_h) $(event_top_h) \
-       $(parser_defs_h) $(regcache_h)
+       $(parser_defs_h) $(regcache_h) $(block_h)
 inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
        $(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h)
 infptrace.o: infptrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
@@ -1811,7 +1816,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
 jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
        $(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \
        $(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \
-       $(jv_lang_h) $(gdbcore_h) $(dictionary_h)
+       $(jv_lang_h) $(gdbcore_h) $(dictionary_h) $(block_h)
 jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \
        $(c_lang_h) $(cp_abi_h)
@@ -1828,7 +1833,7 @@ lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
        $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h)
 linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
        $(symfile_h) $(objfiles_h) $(demangle_h) $(value_h) $(completer_h) \
-       $(cp_abi_h) $(source_h)
+       $(cp_abi_h) $(source_h) $(block_h)
 linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(regcache_h) \
        $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \
        $(cli_decode_h) $(gdb_string_h)
@@ -1893,7 +1898,8 @@ mdebugread.o: mdebugread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
        $(stabsread_h) $(complaints_h) $(demangle_h) $(gdb_assert_h) \
        $(coff_sym_h) $(coff_symconst_h) $(gdb_stat_h) $(gdb_string_h) \
        $(bfd_h) $(coff_ecoff_h) $(libaout_h) $(aout_aout64_h) \
-       $(aout_stab_gnu_h) $(expression_h) $(language_h) $(dictionary_h)
+       $(aout_stab_gnu_h) $(expression_h) $(language_h) $(dictionary_h) \
+       $(block_h)
 mem-break.o: mem-break.c $(defs_h) $(symtab_h) $(breakpoint_h) $(inferior_h) \
        $(target_h)
 memattr.o: memattr.c $(defs_h) $(command_h) $(gdbcmd_h) $(memattr_h) \
@@ -1909,7 +1915,7 @@ mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
        $(symtab_h) $(value_h) $(gdbcmd_h) $(language_h) $(gdbcore_h) \
        $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(target_h) $(arch_utils_h) \
        $(regcache_h) $(osabi_h) $(opcode_mips_h) $(elf_mips_h) $(elf_bfd_h) \
-       $(symcat_h)
+       $(symcat_h) $(block_h)
 mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h)
 mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
        $(mipsnbsd_tdep_h)
@@ -1937,7 +1943,7 @@ monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \
 nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_h)
 nindy-tdep.o: nindy-tdep.c $(defs_h) $(symtab_h) $(frame_h) $(gdbcore_h)
 nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
-       $(objfiles_h) $(buildsym_h) $(stabsread_h)
+       $(objfiles_h) $(buildsym_h) $(stabsread_h) $(block_h)
 ns32k-tdep.o: ns32k-tdep.c $(defs_h) $(frame_h) $(gdbtypes_h) $(gdbcore_h) \
        $(inferior_h) $(regcache_h) $(target_h) $(arch_utils_h) \
        $(ns32k_tdep_h) $(gdb_string_h)
@@ -1947,7 +1953,7 @@ ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) $(gdb_string_h)
 objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
        $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_stat_h) \
        $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h) \
-       $(dictionary_h)
+       $(dictionary_h) $(block_h)
 ocd.o: ocd.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
        $(bfd_h) $(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) \
        $(gdb_stabs_h) $(serial_h) $(ocd_h) $(regcache_h)
@@ -1972,7 +1978,7 @@ pa64solib.o: pa64solib.c $(defs_h) $(frame_h) $(bfd_h) $(libhppa_h) \
 parse.o: parse.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(frame_h) $(expression_h) $(value_h) $(command_h) $(language_h) \
        $(parser_defs_h) $(gdbcmd_h) $(symfile_h) $(inferior_h) \
-       $(doublest_h) $(builtin_regs_h) $(gdb_assert_h)
+       $(doublest_h) $(builtin_regs_h) $(gdb_assert_h) $(block_h)
 ppc-bdm.o: ppc-bdm.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) \
        $(inferior_h) $(bfd_h) $(symfile_h) $(target_h) $(gdbcmd_h) \
        $(objfiles_h) $(gdb_stabs_h) $(serial_h) $(ocd_h) $(ppc_tdep_h) \
@@ -1995,7 +2001,7 @@ printcmd.o: printcmd.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \
        $(gdbtypes_h) $(value_h) $(language_h) $(expression_h) $(gdbcore_h) \
        $(gdbcmd_h) $(target_h) $(breakpoint_h) $(demangle_h) $(valprint_h) \
        $(annotate_h) $(symfile_h) $(objfiles_h) $(completer_h) $(ui_out_h) \
-       $(gdb_assert_h) $(dictionary_h)
+       $(gdb_assert_h) $(dictionary_h) $(block_h)
 proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) $(completer_h) $(proc_utils_h)
 proc-events.o: proc-events.c $(defs_h)
 proc-flags.o: proc-flags.c $(defs_h)
@@ -2185,7 +2191,7 @@ stabsread.o: stabsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(gdb_obstack_h) \
 stack.o: stack.c $(defs_h) $(gdb_string_h) $(value_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(language_h) $(frame_h) $(gdbcmd_h) \
        $(gdbcore_h) $(target_h) $(breakpoint_h) $(demangle_h) $(inferior_h) \
-       $(annotate_h) $(ui_out_h) $(source_h) $(dictionary_h)
+       $(annotate_h) $(ui_out_h) $(source_h) $(dictionary_h) $(block_h)
 standalone.o: standalone.c $(gdb_stat_h) $(defs_h) $(symtab_h) $(frame_h) \
        $(inferior_h) $(gdb_wait_h)
 std-regs.o: std-regs.c $(defs_h) $(builtin_regs_h) $(frame_h) $(gdbtypes_h) \
@@ -2196,7 +2202,8 @@ symfile.o: symfile.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
        $(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \
        $(gdbcmd_h) $(breakpoint_h) $(language_h) $(complaints_h) \
        $(demangle_h) $(inferior_h) $(gdb_stabs_h) $(gdb_obstack_h) \
-       $(completer_h) $(bcache_h) $(gdb_string_h) $(gdb_stat_h) $(source_h)
+       $(completer_h) $(bcache_h) $(gdb_string_h) $(gdb_stat_h) $(source_h) \
+       $(block_h)
 symm-nat.o: symm-nat.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
        $(target_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) $(gdbcore_h)
 symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
@@ -2204,13 +2211,14 @@ symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
 symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \
        $(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \
        $(gdb_obstack_h) $(language_h) $(bcache_h) $(dictionary_h) \
-       $(gdb_string_h)
+       $(gdb_string_h) $(block_h)
 symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
        $(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h)      \
        $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
        $(language_h) $(demangle_h) $(inferior_h) $(linespec_h)   \
        $(filenames_h) $(dictionary_h) $(gdb_obstack_h)           \
-       $(gdb_string_h) $(gdb_stat_h) $(cp_abi_h) $(source_h) $(cp_support_h)
+       $(gdb_string_h) $(gdb_stat_h) $(cp_abi_h) $(source_h) $(cp_support_h) \
+       $(block_h)
 target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
        $(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
        $(gdb_wait_h) $(dcache_h) $(regcache_h)
@@ -2231,7 +2239,7 @@ tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(gdbtypes_h) \
        $(expression_h) $(gdbcmd_h) $(value_h) $(target_h) $(language_h) \
        $(gdb_string_h) $(inferior_h) $(tracepoint_h) $(remote_h) \
        $(linespec_h) $(regcache_h) $(completer_h) $(gdb_events_h) $(ax_h) \
-       $(ax_gdb_h) $(dictionary_h)
+       $(ax_gdb_h) $(dictionary_h) $(block_h)
 typeprint.o: typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(command_h) \
        $(gdbcmd_h) $(target_h) $(language_h) $(cp_abi_h) $(gdb_string_h)
@@ -2256,14 +2264,14 @@ valarith.o: valarith.c $(defs_h) $(value_h) $(symtab_h) $(gdbtypes_h) \
 valops.o: valops.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) $(frame_h) \
        $(inferior_h) $(gdbcore_h) $(target_h) $(demangle_h) $(language_h) \
        $(gdbcmd_h) $(regcache_h) $(cp_abi_h) $(gdb_string_h) \
-       $(gdb_assert_h) $(dictionary_h)
+       $(gdb_assert_h) $(dictionary_h) $(block_h)
 valprint.o: valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(language_h) \
        $(annotate_h) $(valprint_h) $(floatformat_h) $(doublest_h)
 values.o: values.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(gdbcore_h) $(command_h) $(gdbcmd_h) $(target_h) \
        $(language_h) $(scm_lang_h) $(demangle_h) $(doublest_h) \
-       $(gdb_assert_h) $(regcache_h)
+       $(gdb_assert_h) $(regcache_h) $(block_h)
 varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \
        $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h)
 vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \
@@ -2483,7 +2491,8 @@ mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \
        $(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c
 mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \
-       $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(dictionary_h)
+       $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(dictionary_h) \
+       $(block_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c
 mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \
        $(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h)
index 70a4b584f1c5c7ee4e2aa6e7a32797c2fa7310d5..aece48a7316ca613e306a8fac267ab47dfd8ed55 100644 (file)
@@ -42,6 +42,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <ctype.h>
 #include "expression.h"
 #include "value.h"
+#include "block.h"
 #include "parser-defs.h"
 #include "language.h"
 #include "ada-lang.h"
index c2d491c246d788a69da10a6de6a5f80d768e212a..70b553d050b14f771fc7dbb0dc3997516e5249f8 100644 (file)
@@ -24,6 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "demangle.h"
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "gdbcmd.h"
 #include "expression.h"
index 7018d39773e4cb522c38304e4c0c5d35497ea525..1003eed7c5cedf2e76910a2a3e7bc720ee597853 100644 (file)
@@ -23,6 +23,7 @@
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
+#include "block.h"
 #include "value.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
index 8f23905a90d9331d6ac9df57af1aac191f56d0b5..fda84362a3ab4668872918995af4fcb39e12ee4e 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "symfile.h"
 #include "gdbtypes.h"
 #include "value.h"
diff --git a/gdb/block.h b/gdb/block.h
new file mode 100644 (file)
index 0000000..b249863
--- /dev/null
@@ -0,0 +1,138 @@
+/* Block definitions for GDB.
+   Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* All of the name-scope contours of the program
+   are represented by `struct block' objects.
+   All of these objects are pointed to by the blockvector.
+
+   Each block represents one name scope.
+   Each lexical context has its own block.
+
+   The blockvector begins with some special blocks.
+   The GLOBAL_BLOCK contains all the symbols defined in this compilation
+   whose scope is the entire program linked together.
+   The STATIC_BLOCK contains all the symbols whose scope is the
+   entire compilation excluding other separate compilations.
+   Blocks starting with the FIRST_LOCAL_BLOCK are not special.
+
+   Each block records a range of core addresses for the code that
+   is in the scope of the block.  The STATIC_BLOCK and GLOBAL_BLOCK
+   give, for the range of code, the entire range of code produced
+   by the compilation that the symbol segment belongs to.
+
+   The blocks appear in the blockvector
+   in order of increasing starting-address,
+   and, within that, in order of decreasing ending-address.
+
+   This implies that within the body of one function
+   the blocks appear in the order of a depth-first tree walk.  */
+
+/* Opaque declarations.  */
+
+struct symbol;
+struct dictionary;
+struct using_direct_node;
+
+struct block
+{
+
+  /* Addresses in the executable code that are in this block.  */
+
+  CORE_ADDR startaddr;
+  CORE_ADDR endaddr;
+
+  /* The symbol that names this block, if the block is the body of a
+     function; otherwise, zero.  */
+
+  struct symbol *function;
+
+  /* The `struct block' for the containing block, or 0 if none.
+
+     The superblock of a top-level local block (i.e. a function in the
+     case of C) is the STATIC_BLOCK.  The superblock of the
+     STATIC_BLOCK is the GLOBAL_BLOCK.  */
+
+  struct block *superblock;
+
+  /* This is used to store the symbols in the 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.  This should always
+        be NULL for global blocks: if there are using directives that
+        affect an entire file, put it in the static block.  */
+      
+      struct using_direct_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
+     is not feasible, the differences should be fixed during symbol
+     reading.  As of 16 Apr 93, this flag is never used to distinguish
+     between gcc2 and the native compiler.
+
+     If there is no function corresponding to this block, this meaning
+     of this flag is undefined.  */
+
+  unsigned char gcc_compile_flag;
+};
+
+#define BLOCK_START(bl)                (bl)->startaddr
+#define BLOCK_END(bl)          (bl)->endaddr
+#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
+
+struct blockvector
+{
+  /* Number of blocks in the list.  */
+  int nblocks;
+  /* The blocks themselves.  */
+  struct block *block[1];
+};
+
+#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
+#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
+
+/* Special block numbers */
+
+#define GLOBAL_BLOCK           0
+#define        STATIC_BLOCK            1
+#define        FIRST_LOCAL_BLOCK       2
+
+extern struct symbol *block_function (struct block *);
+
+extern int contained_in (struct block *, struct block *);
+
index eba45a377d9192e283d50b9d25c779d4d24bc55e..12452c8e74b78274394fb529df67f9f8b7d34c23 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "bfd.h"
 #include "symfile.h"
 #include "objfiles.h"
index d52153f7f400cf78a72091feac6443a92da26d7e..47eac4ecb7c7984ccd3d014638bccf699f6e2962 100644 (file)
@@ -24,6 +24,7 @@
 #include "defs.h"
 #include <ctype.h>
 #include "symtab.h"
+#include "block.h"
 #include "frame.h"
 #include "breakpoint.h"
 #include "gdbtypes.h"
index bca5332171dab559ca284b6fdc35029d58642708..1371f3799cfe75a992f10dcbebbbfed1c7203df6 100644 (file)
@@ -30,6 +30,7 @@
 #include "bfd.h"
 #include "gdb_obstack.h"
 #include "symtab.h"
+#include "block.h"
 #include "symfile.h"           /* Needed for "struct complaint", obsavestring */
 #include "objfiles.h"
 #include "gdbtypes.h"
@@ -159,6 +160,7 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
      namespaces.  */
   
    if (SYMBOL_LANGUAGE (symbol) == language_cplus
+       && !processing_has_namespace_info
        && SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL)
      scan_for_anonymous_namespaces (symbol);
 }
@@ -888,6 +890,7 @@ start_symtab (char *name, char *dirname, CORE_ADDR start_addr)
   global_symbols = NULL;
   within_function = 0;
   have_line_numbers = 0;
+  processing_has_namespace_info = 0;
   using_list = NULL;
 
   /* Context stack is initially empty.  Allocate first one with room
@@ -1185,10 +1188,6 @@ copy_usings_to_obstack (struct using_direct_node *usings,
     }
 }
 
-/* Search the block for global symbols indicating the presence of
-   anonymous namespaces; add using declarations for them, if
-   found.  */
-
 /* Push a context block.  Args are an identifying nesting level
    (checkable when you pop it), and the starting PC address of this
    context.  */
index 28442a7f28f2f2c2f45afad90cc80314d14fd108..3b8c16fa19f22938aeed4266a59d0cd2a11e4597 100644 (file)
@@ -93,6 +93,12 @@ EXTERN unsigned char processing_acc_compilation;
 
 EXTERN unsigned char processing_hp_compilation;
 
+/* When set, the file that we're processing seems to have debugging
+   info for C++ namespaces, so buildsym.c shouldn't try to guess
+   namespace info itself.  */
+
+EXTERN unsigned char processing_has_namespace_info;
+
 /* Count symbols as they are processed, for error messages.  */
 
 EXTERN unsigned int symnum;
index 1f344c47b7bd3913e67fc902b0a85726dad1793a..94d29ba4a74fe0ae20224e2cc2f29db971050f30 100644 (file)
@@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <ctype.h>
 #include "expression.h"
 #include "value.h"
+#include "block.h"
 #include "parser-defs.h"
 #include "language.h"
 #include "c-lang.h"
index fee392f3c4e28e3ebabd586429043a44ad09f2a0..ff0f396b4c814168494897813545acbb2a2df384 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "demangle.h"
 #include "breakpoint.h"
index 9bb2526c291900380c6035215425f860f788269a..1de9e8094b8ad2c1ecd34d794a0f093945662e1c 100644 (file)
@@ -388,6 +388,13 @@ static struct partial_die_info zeroed_partial_die;
    in buildsym.c.  */
 static struct pending **list_in_scope = &file_symbols;
 
+/* If we're debugging C++ code, this string should contain the name of
+   the current namespace.  Other people shouldn't have to copy it when
+   referring to it, so don't free its previous contents when setting
+   this to a new value.  */
+
+static const char *current_namespace;
+
 /* FIXME: decode_locdesc sets these variables to describe the location
    to the caller.  These ought to be a structure or something.   If
    none of the flags are set, the object lives at the address returned
@@ -884,6 +891,10 @@ static void process_die (struct die_info *, struct objfile *,
 
 static char *dwarf2_linkage_name (struct die_info *);
 
+static char *dwarf2_name (struct die_info *);
+
+static struct die_info * dwarf2_extension (struct die_info *die);
+
 static char *dwarf_tag_name (unsigned int);
 
 static char *dwarf_attr_name (unsigned int);
@@ -1599,6 +1610,9 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
   cu_header_offset = offset;
   info_ptr = dwarf_info_buffer + offset;
 
+  /* We're in the global namespace.  */
+  current_namespace = "";
+
   obstack_init (&dwarf2_tmp_obstack);
   back_to = make_cleanup (dwarf2_free_tmp_obstack, NULL);
 
@@ -1724,6 +1738,7 @@ process_die (struct die_info *die, struct objfile *objfile,
     case DW_TAG_common_inclusion:
       break;
     case DW_TAG_namespace:
+      processing_has_namespace_info = 1;
       read_namespace (die, objfile, cu_header);
       break;
     case DW_TAG_imported_declaration:
@@ -1734,6 +1749,7 @@ process_die (struct die_info *die, struct objfile *objfile,
         shouldn't in the C++ case, but conceivably could in the
         Fortran case, so we'll have to replace this gdb_assert if
         Fortran compilers start generating that info.  */
+      processing_has_namespace_info = 1;
       gdb_assert (!die->has_children);
       break;
     default:
@@ -1756,7 +1772,7 @@ read_file_scope (struct die_info *die, struct objfile *objfile,
   CORE_ADDR lowpc = ((CORE_ADDR) -1);
   CORE_ADDR highpc = ((CORE_ADDR) 0);
   struct attribute *attr;
-  char *name = "<unknown>";
+  char *name;
   char *comp_dir = NULL;
   struct die_info *child_die;
   bfd *abfd = objfile->obfd;
@@ -1791,11 +1807,9 @@ read_file_scope (struct die_info *die, struct objfile *objfile,
   lowpc += baseaddr;
   highpc += baseaddr;
 
-  attr = dwarf_attr (die, DW_AT_name);
-  if (attr)
-    {
-      name = DW_STRING (attr);
-    }
+  name = dwarf2_name (die);
+  if (name == NULL)
+    name = "<unknown>";
   attr = dwarf_attr (die, DW_AT_comp_dir);
   if (attr)
     {
@@ -2082,7 +2096,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
   struct nextfield *new_field;
   struct attribute *attr;
   struct field *fp;
-  char *fieldname = "";
+  char *fieldname;
 
   /* Allocate a new field list entry and link it in.  */
   new_field = (struct nextfield *) xmalloc (sizeof (struct nextfield));
@@ -2181,9 +2195,9 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
        }
 
       /* Get name of field.  */
-      attr = dwarf_attr (die, DW_AT_name);
-      if (attr && DW_STRING (attr))
-       fieldname = DW_STRING (attr);
+      fieldname = dwarf2_name (die);
+      if (fieldname == NULL)
+       fieldname = "";
       fp->name = obsavestring (fieldname, strlen (fieldname),
                               &objfile->type_obstack);
 
@@ -2201,10 +2215,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
 
       /* C++ static member.
         Get name of field.  */
-      attr = dwarf_attr (die, DW_AT_name);
-      if (attr && DW_STRING (attr))
-       fieldname = DW_STRING (attr);
-      else
+      fieldname = dwarf2_name (die);
+      if (fieldname == NULL)
        return;
 
       /* Get physical name.  */
@@ -2333,10 +2345,9 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
   struct nextfnfield *new_fnfield;
 
   /* Get name of member function.  */
-  attr = dwarf_attr (die, DW_AT_name);
-  if (attr && DW_STRING (attr))
-    fieldname = DW_STRING (attr);
-  else
+
+  fieldname = dwarf2_name (die);
+  if (fieldname == NULL)
     return;
 
   /* Get the mangled name.  */
@@ -2513,15 +2524,15 @@ read_structure_scope (struct die_info *die, struct objfile *objfile,
 {
   struct type *type;
   struct attribute *attr;
+  char *name;
 
   type = alloc_type (objfile);
 
   INIT_CPLUS_SPECIFIC (type);
-  attr = dwarf_attr (die, DW_AT_name);
-  if (attr && DW_STRING (attr))
+  name = dwarf2_name (die);
+  if (name != NULL)
     {
-      TYPE_TAG_NAME (type) = obsavestring (DW_STRING (attr),
-                                          strlen (DW_STRING (attr)),
+      TYPE_TAG_NAME (type) = obsavestring (name, strlen (name),
                                           &objfile->type_obstack);
     }
 
@@ -2672,17 +2683,17 @@ read_enumeration (struct die_info *die, struct objfile *objfile,
   struct field *fields;
   struct attribute *attr;
   struct symbol *sym;
+  char *name;
   int num_fields;
   int unsigned_enum = 1;
 
   type = alloc_type (objfile);
 
   TYPE_CODE (type) = TYPE_CODE_ENUM;
-  attr = dwarf_attr (die, DW_AT_name);
-  if (attr && DW_STRING (attr))
+  name = dwarf2_name (die);
+  if (name != NULL)
     {
-      TYPE_TAG_NAME (type) = obsavestring (DW_STRING (attr),
-                                          strlen (DW_STRING (attr)),
+      TYPE_TAG_NAME (type) = obsavestring (name, strlen (name),
                                           &objfile->type_obstack);
     }
 
@@ -2960,6 +2971,43 @@ static void
 read_namespace (struct die_info *die, struct objfile *objfile,
                const struct comp_unit_head *cu_header)
 {
+  const char *previous_namespace = current_namespace;
+  const char *name = NULL;
+  int is_anonymous;
+  struct die_info *current_die;
+
+  /* Loop through the extensions until we find a name.  */
+
+  for (current_die = die; current_die != NULL;
+       current_die = dwarf2_extension (die))
+    {
+      name = dwarf2_name (die);
+      if (name != NULL)
+       break;
+    }
+
+  /* Is it an anonymous namespace?  */
+
+  is_anonymous = (name == NULL);
+  if (is_anonymous)
+    name = "(anonymous namespace)";
+
+  /* Now build the name of the current namespace.  */
+
+  current_namespace = obconcat (&objfile->symbol_obstack,
+                               previous_namespace,
+                               previous_namespace[0] == '\0' ? "" : "::",
+                               name);
+
+  /* If it's an anonymous namespace that we're seeing for the first
+     time, add a using directive.  */
+
+  if (is_anonymous && dwarf_attr (die, DW_AT_extension) == NULL)
+    add_using_directive (current_namespace,
+                        strlen (previous_namespace),
+                        strlen (current_namespace));
+  
+  
   if (die->has_children)
     {
       struct die_info *child_die = die->next;
@@ -2970,6 +3018,8 @@ read_namespace (struct die_info *die, struct objfile *objfile,
          child_die = sibling_die (child_die);
        }
     }
+
+  current_namespace = previous_namespace;
 }
 
 /* Extract all information from a DW_TAG_pointer_type DIE and add to
@@ -3225,11 +3275,7 @@ read_typedef (struct die_info *die, struct objfile *objfile,
 
   if (!die->type)
     {
-      attr = dwarf_attr (die, DW_AT_name);
-      if (attr && DW_STRING (attr))
-       {
-         name = DW_STRING (attr);
-       }
+      name = dwarf2_name (die);
       die->type = init_type (TYPE_CODE_TYPEDEF, 0, TYPE_FLAG_TARGET_STUB, name, objfile);
       TYPE_TARGET_TYPE (die->type) = die_type (die, objfile, cu_header);
     }
@@ -5412,6 +5458,43 @@ dwarf2_linkage_name (struct die_info *die)
   return NULL;
 }
 
+/* Get name of a die, return NULL if not found.  */
+
+static char *
+dwarf2_name (struct die_info *die)
+{
+  struct attribute *attr;
+
+  attr = dwarf_attr (die, DW_AT_name);
+  if (attr && DW_STRING (attr))
+    return DW_STRING (attr);
+  return NULL;
+}
+
+/* Return the die that this die in an extension of, or NULL if there
+   is none.  */
+
+static struct die_info *
+dwarf2_extension (struct die_info *die)
+{
+  struct attribute *attr;
+  struct die_info *extension_die;
+  unsigned int ref;
+
+  attr = dwarf_attr (die, DW_AT_extension);
+  if (attr == NULL)
+    return NULL;
+
+  ref = dwarf2_get_ref_die_offset (attr);
+  extension_die = follow_die_ref (ref);
+  if (!extension_die)
+    {
+      error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+    }
+
+  return extension_die;
+}
+
 /* Convert a DIE tag into its string name.  */
 
 static char *
index aa8b87620128b45f5a50d4d4ba204f03dc24bac5..aa5c65853ea4544521fa428a5f1a948ce7d21af6 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "expression.h"
 #include "value.h"
index b9004264eec69d25a9447bab97ebfaa9467ea77d..57db6fa09bc1c4da980c7c9e2cfac7eb83f86f67 100644 (file)
@@ -47,6 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "gdb_string.h"
 #include "expression.h"
 #include "value.h"
+#include "block.h"
 #include "parser-defs.h"
 #include "language.h"
 #include "f-lang.h"
index 48c511377e8ee3a95164f34f2cb79d770ffc87d4..deff31dc3e570bfa3dcf359dba40891e39983b50 100644 (file)
@@ -24,6 +24,7 @@
 #include "defs.h"
 #include "gdb_string.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "expression.h"
 #include "value.h"
index d2591321d75dfb7958d9f29cd27c001c78e91e4c..b14c532a524257e1ec2eb9942fec86743ac4439f 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "frame.h"
 #include "value.h"
index a36258152c71385af0741cc99e1a39dc9634d643..71daee343db3810441d6aad83d0c3797e275c92a 100644 (file)
@@ -24,6 +24,7 @@
 #include <signal.h>
 #include "gdb_string.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "frame.h"
 #include "inferior.h"
index b4ae3401ea4ca0b4a4aea1ec22ea0a0fa6ee73f6..d4c315f477012b3ada873275716e782777d7f77d 100644 (file)
@@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <ctype.h>
 #include "expression.h"
 #include "value.h"
+#include "block.h"
 #include "parser-defs.h"
 #include "language.h"
 #include "jv-lang.h"
index b5d2df995b1790960a1c3894d0db7ae69a19404f..c0daf07286fec17444b9579d4a8e463871a87ae4 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "expression.h"
 #include "parser-defs.h"
index 5631fd31433a6a82c850da184a1bdd98edbfd60f..24dc640a3d3ac9af0e98d3ec9b859b60b79909e9 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "frame.h"
 #include "command.h"
 #include "symfile.h"
index e291d62b1cbc12e2306fa89ba91c325950be6fc6..0957c874ba1316495d24b2c4b494ea653fbf1d50 100644 (file)
@@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "expression.h"
 #include "language.h"
 #include "value.h"
+#include "block.h"
 #include "parser-defs.h"
 #include "m2-lang.h"
 #include "bfd.h" /* Required by objfiles.h.  */
index d817e93e3acc0473a507b8d890836c4f4f3cbbd2..e9c3b8124d778ee984f864afe19226f3eebf0487 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "gdbcore.h"
 #include "symfile.h"
index 3cbd2ec12c93dafc50212705359b4f1484f9662f..78795729b09b85d28c06eba59f2f7be8a30f6e5c 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-18  David Carlton  <carlton@math.stanford.edu>
+
+       * mi-cmd-stack.c: #include "block.h"
+
 2002-10-03  Jeff Johnston  <jjohnstn@redhat.com>
 
        * gdbmi.texinfo: Fix examples that show frames to remove
index f89ff2babb0c512fa8be0108edaa9028e63c51d6..f01601a3e398fad2e1aba42472bb76ed4fc35e33 100644 (file)
@@ -26,6 +26,7 @@
 #include "mi-cmds.h"
 #include "ui-out.h"
 #include "symtab.h"
+#include "block.h"
 #include "dictionary.h"
 
 /* FIXME: these should go in some .h file but stack.c doesn't have a
index 39086066332a7b237ead1952b1384421eb92970e..8aa61c774fa69ecfdea4dd597c78d8cde370b1f5 100644 (file)
@@ -28,6 +28,7 @@
 #include "frame.h"
 #include "inferior.h"
 #include "symtab.h"
+#include "block.h"
 #include "value.h"
 #include "gdbcmd.h"
 #include "language.h"
index eaa9ddeb2f337ad08bd66de67975ec9f2538c19e..9d692ddd906926e89e1c08800b2653717dcf4ae8 100644 (file)
@@ -23,6 +23,7 @@
 #include "defs.h"
 #include "bfd.h"
 #include "symtab.h"
+#include "block.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "buildsym.h"
index 2ccc8824455209cd6b3b2c2aaf6d3bbce1816b65..fbeb3a5771f0918e7ad8f75259b1b051a748abac 100644 (file)
@@ -44,6 +44,7 @@
 #include "objc-lang.h" /* For objc language constructs.  */
 
 #include "value.h"
+#include "block.h"
 #include "parser-defs.h"
 #include "language.h"
 #include "c-lang.h"
index 0c749a2ebe5c370bd510e5cea4a742ca10fc9f06..6f379484ac22085dddf2908c392524d9852fec42 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "expression.h"
 #include "parser-defs.h"
index 88003e62d5940f58d13a2da5867458e0b855a6dc..8f36f8af655f4ab991f70f71f242c84ff411202f 100644 (file)
@@ -28,6 +28,7 @@
 #include "defs.h"
 #include "bfd.h"               /* Binary File Description */
 #include "symtab.h"
+#include "block.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdb-stabs.h"
index 4dc99be8ce451968173cadb846aeb3194c2dc3c8..dfdab74079ab9b83188c5ea6d846521805a41d51 100644 (file)
@@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <ctype.h>
 #include "expression.h"
 #include "value.h"
+#include "block.h"
 #include "parser-defs.h"
 #include "language.h"
 #include "p-lang.h"
index 29b8e3c3709a003299e9d78c3bc0fd00b40a855e..5762d6f4168d7b4ff20ead57c3ab1b274bf925f3 100644 (file)
@@ -48,6 +48,7 @@
                                   with "gdbarch.h" when appropriate.  */
 #include "doublest.h"
 #include "gdb_assert.h"
+#include "block.h"
 
 \f
 /* Symbols which architectures can redefine.  */
@@ -1107,7 +1108,7 @@ parse_exp_1 (char **stringptr, struct block *block, int comma)
   if (block)
     {
       expression_context_block = block;
-      expression_context_pc = block->startaddr;
+      expression_context_pc = BLOCK_START (block);
     }
   else
     expression_context_block = get_selected_block (&expression_context_pc);
index ade4b18e5b2f2e3db2c2a6f20d2e65c80d4eea87..cc9d897e3d743312f188e87da8a330f87b10b60b 100644 (file)
@@ -25,6 +25,7 @@
 #include "gdb_string.h"
 #include "frame.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "value.h"
 #include "language.h"
index 37070b45adeee474aeba0bcd5693c09def5aa529..3ed82e67855a4c77aec46e7b2be9888bae0b63ec 100644 (file)
@@ -26,6 +26,7 @@
 #include "gdb_string.h"
 #include "value.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "expression.h"
 #include "language.h"
index 6d794d57ffce7f95bea449740c2ba1af97cda601..f78aa63e5aa68caa37e808e1a1bcf8ac3494e02d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "gdbcore.h"
 #include "frame.h"
index 6cea2f1aeb089b179304e73c0a41c0d2e78e7790..42b27e347f405e651a1f0566b3beaefd2cc8865c 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "bfd.h"
 #include "symfile.h"
index 390c7643c47cde3125b203de84579279fff69403..b397440eecc012e0aff7b3afba7db85bdb57aba7 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "gdbcore.h"
 #include "frame.h"
index fcfca15820f45bdaeb594d19e45a57e564ee722c..91a2c459c0ba4ccaf76edae91e6bf9d8edb5eeee 100644 (file)
@@ -25,8 +25,8 @@
 
 /* Opaque declarations.  */
 struct obstack;
-struct dictionary;
-struct using_direct_node;
+struct block;
+struct blockvector;
 
 /* 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
@@ -328,114 +328,6 @@ struct minimal_symbol
 
 #define MSYMBOL_INFO(msymbol)          (msymbol)->info
 #define MSYMBOL_TYPE(msymbol)          (msymbol)->type
-\f
-
-
-/* All of the name-scope contours of the program
-   are represented by `struct block' objects.
-   All of these objects are pointed to by the blockvector.
-
-   Each block represents one name scope.
-   Each lexical context has its own block.
-
-   The blockvector begins with some special blocks.
-   The GLOBAL_BLOCK contains all the symbols defined in this compilation
-   whose scope is the entire program linked together.
-   The STATIC_BLOCK contains all the symbols whose scope is the
-   entire compilation excluding other separate compilations.
-   Blocks starting with the FIRST_LOCAL_BLOCK are not special.
-
-   Each block records a range of core addresses for the code that
-   is in the scope of the block.  The STATIC_BLOCK and GLOBAL_BLOCK
-   give, for the range of code, the entire range of code produced
-   by the compilation that the symbol segment belongs to.
-
-   The blocks appear in the blockvector
-   in order of increasing starting-address,
-   and, within that, in order of decreasing ending-address.
-
-   This implies that within the body of one function
-   the blocks appear in the order of a depth-first tree walk.  */
-
-struct blockvector
-{
-  /* Number of blocks in the list.  */
-  int nblocks;
-  /* The blocks themselves.  */
-  struct block *block[1];
-};
-
-#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
-#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
-
-/* Special block numbers */
-
-#define GLOBAL_BLOCK           0
-#define        STATIC_BLOCK            1
-#define        FIRST_LOCAL_BLOCK       2
-
-struct block
-{
-
-  /* Addresses in the executable code that are in this block.  */
-
-  CORE_ADDR startaddr;
-  CORE_ADDR endaddr;
-
-  /* The symbol that names this block, if the block is the body of a
-     function; otherwise, zero.  */
-
-  struct symbol *function;
-
-  /* The `struct block' for the containing block, or 0 if none.
-
-     The superblock of a top-level local block (i.e. a function in the
-     case of C) is the STATIC_BLOCK.  The superblock of the
-     STATIC_BLOCK is the GLOBAL_BLOCK.  */
-
-  struct block *superblock;
-
-  /* This is used to store the symbols in the 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.  This should always
-        be NULL for global blocks: if there are using directives that
-        affect an entire file, put it in the static block.  */
-      
-      struct using_direct_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
-     is not feasible, the differences should be fixed during symbol
-     reading.  As of 16 Apr 93, this flag is never used to distinguish
-     between gcc2 and the native compiler.
-
-     If there is no function corresponding to this block, this meaning
-     of this flag is undefined.  */
-
-  unsigned char gcc_compile_flag;
-};
-
-#define BLOCK_START(bl)                (bl)->startaddr
-#define BLOCK_END(bl)          (bl)->endaddr
-#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
 
 \f
 
@@ -1067,10 +959,6 @@ extern struct type *lookup_union (char *, struct block *);
 
 extern struct type *lookup_enum (char *, struct block *);
 
-/* lookup the function corresponding to the block */
-
-extern struct symbol *block_function (struct block *);
-
 /* from blockframe.c: */
 
 /* lookup the function symbol corresponding to the address */
@@ -1125,8 +1013,6 @@ extern struct partial_symbol *find_pc_sect_psymbol (struct partial_symtab *,
 
 extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
 
-extern int contained_in (struct block *, struct block *);
-
 extern void reread_symbols (void);
 
 extern struct type *lookup_transparent_type (const char *);
index 43559f2edd726f4871131a12fee6ae4ec0d87188..da10242be8c0dedb07e827b2156d0c3b17a147dd 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "frame.h"
 #include "gdbtypes.h"
 #include "expression.h"
index 20866d115e8fc631f809e3f50889dfcfdb296a18..2c051bed3cd22fea17a9bf001367bbf7051a05e6 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "value.h"
 #include "frame.h"
index c943f28fa462f1fcf6501be0869788103e02a528..7286becfb0880284904a210585f6af8d65e858ae 100644 (file)
@@ -23,6 +23,7 @@
 #include "defs.h"
 #include "gdb_string.h"
 #include "symtab.h"
+#include "block.h"
 #include "gdbtypes.h"
 #include "value.h"
 #include "gdbcore.h"