summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog46
-rw-r--r--gdb/Makefile.in82
-rw-r--r--gdb/ada-exp.y1
-rw-r--r--gdb/ada-lang.c1
-rw-r--r--gdb/ada-lang.h2
-rw-r--r--gdb/alpha-tdep.c1
-rw-r--r--gdb/ax-gdb.c1
-rw-r--r--gdb/block.c141
-rw-r--r--gdb/block.h183
-rw-r--r--gdb/blockframe.c91
-rw-r--r--gdb/breakpoint.c1
-rw-r--r--gdb/breakpoint.h1
-rw-r--r--gdb/buildsym.c1
-rw-r--r--gdb/buildsym.h2
-rw-r--r--gdb/c-exp.y1
-rw-r--r--gdb/coffread.c1
-rw-r--r--gdb/expprint.c1
-rw-r--r--gdb/f-exp.y1
-rw-r--r--gdb/f-valprint.c1
-rw-r--r--gdb/findvar.c1
-rw-r--r--gdb/frame.h5
-rw-r--r--gdb/infcmd.c1
-rw-r--r--gdb/jv-exp.y1
-rw-r--r--gdb/jv-lang.c1
-rw-r--r--gdb/linespec.c1
-rw-r--r--gdb/m2-exp.y1
-rw-r--r--gdb/mdebugread.c1
-rw-r--r--gdb/mi/ChangeLog4
-rw-r--r--gdb/mi/mi-cmd-stack.c1
-rw-r--r--gdb/mips-tdep.c1
-rw-r--r--gdb/nlmread.c1
-rw-r--r--gdb/objc-exp.y1
-rw-r--r--gdb/objc-lang.c1
-rw-r--r--gdb/objc-lang.h1
-rw-r--r--gdb/objfiles.c1
-rw-r--r--gdb/p-exp.y1
-rw-r--r--gdb/parse.c1
-rw-r--r--gdb/parser-defs.h2
-rw-r--r--gdb/printcmd.c1
-rw-r--r--gdb/stack.c1
-rw-r--r--gdb/symfile.c1
-rw-r--r--gdb/symfile.h1
-rw-r--r--gdb/symmisc.c1
-rw-r--r--gdb/symtab.c26
-rw-r--r--gdb/symtab.h157
-rw-r--r--gdb/tracepoint.c1
-rw-r--r--gdb/valops.c1
-rw-r--r--gdb/value.h1
-rw-r--r--gdb/values.c1
-rw-r--r--gdb/x86-64-tdep.c1
50 files changed, 468 insertions, 311 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7ba4ce9c457..e72718d7f03 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,49 @@
+2003-02-19 David Carlton <carlton@math.stanford.edu>
+
+ * Makefile.in (SFILES): Add block.c.
+ (block_h): New.
+ (COMMON_OBS): Add block.o.
+ (block.o): New.
+ (x86-64-tdep.o): Add $(block_h).
+ (values.o, valops.o, tracepoint.o, symtab.o, symmisc.o, symfile.o)
+ (stack.o, printcmd.o, p-exp.tab.o, parse.o, objfiles.o)
+ (objc-exp.tab.o, objc-lang.o, nlmread.o, mips-tdep.o, mdebugread.o)
+ (m2-exp.tab.o, linespec.o, jv-lang.o, jv-exp.tab.o, infcmd.o)
+ (f-valprint.o, findvar.o, f-exp.tab.o, expprint.o, coffread.o)
+ (c-exp.tab.o, buildsym.o, breakpoint.o, blockframe.o, ax-gdb.o)
+ (alpha-tdep.o, ada-lang.o, ada-exp.tab.o, mi-cmd-stack.o): Ditto.
+ * value.h: Add opaque declaration for struct block.
+ * parser-defs.h, objc-lang.h, buildsym.h, breakpoint.h: Ditto.
+ * ada-lang.h: Ditto.
+ * x86-64-tdep.c: #include "block.h"
+ * values.c, valops.c, tracepoint.c, symtab.c, symmisc.c: Ditto.
+ * symfile.c, stack.c, printcmd.c, p-exp.y, parse.c: Ditto.
+ * objfiles.c, objc-exp.y, objc-lang.c, nlmread.c: Ditto.
+ * mips-tdep.c, mdebugread.c, m2-exp.y, linespec.c: Ditto.
+ * jv-lang.c, jv-exp.y, infcmd.c, f-valprint.c: Ditto.
+ * findvar.c, f-exp.y, expprint.c, coffread.c, c-exp.y: Ditto.
+ * buildsym.c, breakpoint.c, blockframe.c, ax-gdb.c: Ditto.
+ * alpha-tdep.c, ada-lang.c, ada-exp.y: Ditto.
+ * blockframe.c (blockvector_for_pc_sect): Move to "block.c".
+ (blockvector_for_pc, block_for_pc_sect, block_for_pc): Ditto.
+ * symtab.c (block_function): Ditto.
+ (contained_in): Ditto.
+ * frame.h: Move block_for_pc and block_for_pc_sect declarations to
+ block.h. Add opaque declaration for struct block.
+ * symtab.h: Move block_function and contained_in declarations to
+ block.h. Add opaque declarations for struct block, struct
+ blockvector.
+ (struct block): Move to block.h.
+ (struct blockvector): Ditto.
+ (BLOCK_START, BLOCK_END, BLOCK_FUNCTION, BLOCK_SUPERBLOCK)
+ (BLOCK_GCC_COMPILED, BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM)
+ (BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE)
+ (ALL_BLOCK_SYMBOLS, BLOCK_SHOULD_SORT, BLOCKVECTOR_NBLOCKS)
+ (BLOCKVECTOR_BLOCK, GLOBAL_BLOCK, STATIC_BLOCK, FIRST_LOCAL_BLOCK):
+ Ditto.
+ * block.c: New file.
+ * block.h: New file.
+
2003-02-19 Theodore A. Roth <troth@openavr.org>
* avr-tdep.c (avr_extract_return_value): Remove function.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index c4199a8b3e7..51b5e9ad02e 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -511,7 +511,7 @@ TARGET_FLAGS_TO_PASS = \
SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
ax-general.c ax-gdb.c \
- bcache.c blockframe.c breakpoint.c buildsym.c builtin-regs.c \
+ bcache.c block.c blockframe.c breakpoint.c buildsym.c builtin-regs.c \
c-exp.y c-lang.c c-typeprint.c c-valprint.c \
charset.c cli-out.c coffread.c complaints.c completer.c corefile.c \
cp-abi.c cp-support.c cp-valprint.c \
@@ -606,6 +606,7 @@ arm_tdep_h = arm-tdep.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
@@ -824,7 +825,7 @@ TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR)
COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \
charset.o disasm.o dummy-frame.o \
source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \
- symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \
+ block.o symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \
expprint.o environ.o stack.o thread.o \
interps.o \
macrotab.o macrocmd.o macroexp.o macroscope.o \
@@ -1431,32 +1432,32 @@ 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)
objc-exp.tab.o: objc-exp.tab.c $(objc_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)
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.
@@ -1467,7 +1468,7 @@ 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) $(ui_out_h)
+ $(breakpoint_h) $(gdbcore_h) $(ada_lang_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)
@@ -1491,7 +1492,7 @@ 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) \
- $(osabi_h)
+ $(osabi_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) \
@@ -1527,24 +1528,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)
+block.o: block.c $(defs_h) $(block_h) $(symtab_h) $(symfile_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) \
- $(dummy_frame_h) $(command_h) $(gdbcmd_h)
+ $(dummy_frame_h) $(command_h) $(gdbcmd_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) $(gdb_assert_h)
+ $(cli_script_h) $(gdb_events_h) $(source_h) $(gdb_assert_h) \
+ $(block_h)
buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
$(complaints_h) $(gdb_string_h) $(expression_h) $(language_h) \
$(bcache_h) $(filenames_h) $(macrotab_h) $(demangle_h) $(buildsym_h) \
- $(stabsread_h)
+ $(stabsread_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) \
@@ -1567,7 +1570,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)
+ $(target_h) $(gdb_assert_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) \
@@ -1654,7 +1657,8 @@ exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
$(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) $(xcoffsolib_h) \
$(readline_h)
expprint.o: expprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
- $(value_h) $(language_h) $(parser_defs_h) $(target_h) $(gdb_string_h)
+ $(value_h) $(language_h) $(parser_defs_h) $(target_h) $(gdb_string_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)
@@ -1663,13 +1667,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)
@@ -1791,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) \
$(inflow_h)
@@ -1816,7 +1820,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)
+ $(jv_lang_h) $(gdbcore_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)
@@ -1833,7 +1837,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) $(parser_defs_h)
+ $(cp_abi_h) $(source_h) $(parser_defs_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)
@@ -1896,6 +1900,7 @@ mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
mdebugread.o: mdebugread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
$(symfile_h) $(objfiles_h) $(gdb_obstack_h) $(buildsym_h) \
$(stabsread_h) $(complaints_h) $(demangle_h) $(gdb_assert_h) \
+ $(block_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)
@@ -1914,7 +1919,7 @@ mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h)
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) $(mips_tdep_h) $(opcode_mips_h) \
+ $(regcache_h) $(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \
$(elf_mips_h) $(elf_bfd_h) $(symcat_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) \
@@ -1939,7 +1944,7 @@ monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \
$(gdb_regex_h) $(srec_h) $(regcache_h)
nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_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) $(osabi_h)
@@ -1951,10 +1956,11 @@ objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(c_lang_h) $(objc_lang_h) \
$(complaints_h) $(value_h) $(symfile_h) $(objfiles_h) \
$(gdb_string_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(frame_h) \
- $(gdb_regex_h) $(regcache_h)
+ $(gdb_regex_h) $(regcache_h) $(block_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)
+ $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_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)
@@ -1979,7 +1985,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) \
@@ -2004,7 +2010,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)
+ $(gdb_assert_h) $(block_h)
proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) $(completer_h) $(gdb_wait_h) \
$(proc_utils_h)
proc-events.o: proc-events.c $(defs_h)
@@ -2191,7 +2197,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)
+ $(annotate_h) $(ui_out_h) $(source_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) \
@@ -2203,7 +2209,7 @@ symfile.o: symfile.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_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) \
- $(gdb_assert_h) $(readline_h) $(filenames_h)
+ $(gdb_assert_h) $(readline_h) $(filenames_h) $(block_h)
symm-nat.o: symm-nat.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
$(target_h) $(regcache_h) $(gdb_wait_h) $(gdb_stat_h) $(gdbcore_h) \
$(gdbcore_h)
@@ -2212,13 +2218,13 @@ 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) $(gdb_string_h) \
- $(readline_h)
+ $(readline_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) $(gdb_obstack_h) $(gdb_string_h) $(gdb_stat_h) \
- $(cp_abi_h) $(source_h)
+ $(cp_abi_h) $(source_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)
@@ -2238,8 +2244,8 @@ top.o: top.c $(defs_h) $(gdbcmd_h) $(call_cmds_h) $(cli_cmds_h) \
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) $(readline_h)
+ $(linespec_h) $(regcache_h) $(completer_h) $(gdb_events_h) \
+ $(block_h) $(ax_h) $(ax_gdb_h) $(readline_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)
@@ -2264,14 +2270,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)
+ $(gdb_assert_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) \
@@ -2296,7 +2302,7 @@ x86-64-linux-tdep.o: x86-64-linux-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(osabi_h)
x86-64-tdep.o: x86-64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(gdbcmd_h) $(arch_utils_h) $(regcache_h) $(symfile_h) $(objfiles_h) \
- $(x86_64_tdep_h) $(dwarf2cfi_h) $(gdb_assert_h)
+ $(x86_64_tdep_h) $(dwarf2cfi_h) $(gdb_assert_h) $(block_h)
xcoffread.o: xcoffread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(gdb_stat_h) \
$(coff_internal_h) $(libcoff_h) $(coff_xcoff_h) $(libxcoff_h) \
$(coff_rs6000_h) $(symtab_h) $(gdbtypes_h) $(symfile_h) \
@@ -2512,7 +2518,7 @@ mi-cmd-env.o: $(srcdir)/mi/mi-cmd-env.c $(defs_h) $(inferior_h) $(value_h) \
$(environ_h) $(command_h) $(ui_out_h) $(top_h) $(gdb_string_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-env.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)
+ $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_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)
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 70a4b584f1c..6651dfd4661 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -49,6 +49,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "frame.h"
+#include "block.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 5d5aaf8ab56..eb4ccbec9b1 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -37,6 +37,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "ada-lang.h"
#include "ui-out.h"
+#include "block.h"
struct cleanup *unresolved_names;
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index d2b426c8ceb..45c156a1210 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -23,6 +23,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h"
#include "gdbtypes.h"
+struct block;
+
/* A macro to reorder the bytes of an address depending on the endiannes
of the target */
#define EXTRACT_ADDRESS(x) ((void *) extract_address (&(x), sizeof (x)))
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index cf5abc84372..208c7f2fb69 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -35,6 +35,7 @@
#include "doublest.h"
#include "arch-utils.h"
#include "osabi.h"
+#include "block.h"
#include "elf-bfd.h"
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index e38e67560f5..319cf99a647 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -33,6 +33,7 @@
#include "ax.h"
#include "ax-gdb.h"
#include "gdb_string.h"
+#include "block.h"
/* To make sense of this file, you should read doc/agentexpr.texi.
Then look at the types and enums in ax-gdb.h. For the code itself,
diff --git a/gdb/block.c b/gdb/block.c
new file mode 100644
index 00000000000..8aa08fb175d
--- /dev/null
+++ b/gdb/block.c
@@ -0,0 +1,141 @@
+/* Block-related functions for the GNU debugger, GDB.
+
+ Copyright 2003 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. */
+
+#include "defs.h"
+#include "block.h"
+#include "symtab.h"
+#include "symfile.h"
+
+/* Return Nonzero if block a is lexically nested within block b,
+ or if a and b have the same pc range.
+ Return zero otherwise. */
+
+int
+contained_in (struct block *a, struct block *b)
+{
+ if (!a || !b)
+ return 0;
+ return BLOCK_START (a) >= BLOCK_START (b)
+ && BLOCK_END (a) <= BLOCK_END (b);
+}
+
+
+/* Return the symbol for the function which contains a specified
+ lexical block, described by a struct block BL. */
+
+struct symbol *
+block_function (struct block *bl)
+{
+ while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
+ bl = BLOCK_SUPERBLOCK (bl);
+
+ return BLOCK_FUNCTION (bl);
+}
+
+/* Return the blockvector immediately containing the innermost lexical block
+ containing the specified pc value and section, or 0 if there is none.
+ PINDEX is a pointer to the index value of the block. If PINDEX
+ is NULL, we don't pass this information back to the caller. */
+
+struct blockvector *
+blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section,
+ int *pindex, struct symtab *symtab)
+{
+ register struct block *b;
+ register int bot, top, half;
+ struct blockvector *bl;
+
+ if (symtab == 0) /* if no symtab specified by caller */
+ {
+ /* First search all symtabs for one whose file contains our pc */
+ if ((symtab = find_pc_sect_symtab (pc, section)) == 0)
+ return 0;
+ }
+
+ bl = BLOCKVECTOR (symtab);
+ b = BLOCKVECTOR_BLOCK (bl, 0);
+
+ /* Then search that symtab for the smallest block that wins. */
+ /* Use binary search to find the last block that starts before PC. */
+
+ bot = 0;
+ top = BLOCKVECTOR_NBLOCKS (bl);
+
+ while (top - bot > 1)
+ {
+ half = (top - bot + 1) >> 1;
+ b = BLOCKVECTOR_BLOCK (bl, bot + half);
+ if (BLOCK_START (b) <= pc)
+ bot += half;
+ else
+ top = bot + half;
+ }
+
+ /* Now search backward for a block that ends after PC. */
+
+ while (bot >= 0)
+ {
+ b = BLOCKVECTOR_BLOCK (bl, bot);
+ if (BLOCK_END (b) > pc)
+ {
+ if (pindex)
+ *pindex = bot;
+ return bl;
+ }
+ bot--;
+ }
+ return 0;
+}
+
+/* Return the blockvector immediately containing the innermost lexical block
+ containing the specified pc value, or 0 if there is none.
+ Backward compatibility, no section. */
+
+struct blockvector *
+blockvector_for_pc (register CORE_ADDR pc, int *pindex)
+{
+ return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
+ pindex, NULL);
+}
+
+/* Return the innermost lexical block containing the specified pc value
+ in the specified section, or 0 if there is none. */
+
+struct block *
+block_for_pc_sect (register CORE_ADDR pc, struct sec *section)
+{
+ register struct blockvector *bl;
+ int index;
+
+ bl = blockvector_for_pc_sect (pc, section, &index, NULL);
+ if (bl)
+ return BLOCKVECTOR_BLOCK (bl, index);
+ return 0;
+}
+
+/* Return the innermost lexical block containing the specified pc value,
+ or 0 if there is none. Backward compatibility, no section. */
+
+struct block *
+block_for_pc (register CORE_ADDR pc)
+{
+ return block_for_pc_sect (pc, find_pc_mapped_section (pc));
+}
diff --git a/gdb/block.h b/gdb/block.h
new file mode 100644
index 00000000000..d7dbf315324
--- /dev/null
+++ b/gdb/block.h
@@ -0,0 +1,183 @@
+/* Code dealing with blocks for GDB.
+
+ Copyright 2003 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. */
+
+#ifndef BLOCK_H
+#define BLOCK_H
+
+/* Opaque declarations. */
+
+struct symbol;
+struct symtab;
+
+/* 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 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;
+
+ /* 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;
+
+ /* The symbols for this block are either in a simple linear list or
+ in a simple hashtable. Blocks which correspond to a function
+ (which have a list of symbols corresponding to arguments) use
+ a linear list, as do some older symbol readers (currently only
+ mdebugread and dstread). Other blocks are hashed.
+
+ The hashtable uses the same hash function as the minsym hashtables,
+ found in minsyms.c:minsym_hash_iw. Symbols are hashed based on
+ their demangled name if appropriate, and on their name otherwise.
+ The hash function ignores space, and stops at the beginning of the
+ argument list if any.
+
+ The table is laid out in NSYMS/5 buckets and symbols are chained via
+ their hash_next field. */
+
+ /* If this is really a hashtable of the symbols, this flag is 1. */
+
+ unsigned char hashtable;
+
+ /* Number of local symbols. */
+
+ int nsyms;
+
+ /* The symbols. If some of them are arguments, then they must be
+ in the order in which we would like to print them. */
+
+ struct symbol *sym[1];
+};
+
+#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_GCC_COMPILED(bl) (bl)->gcc_compile_flag
+#define BLOCK_HASHTABLE(bl) (bl)->hashtable
+
+/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only. */
+#define BLOCK_NSYMS(bl) (bl)->nsyms
+#define BLOCK_SYM(bl, n) (bl)->sym[n]
+
+/* For blocks with a hashtable, but these are valid for non-hashed blocks as
+ well - each symbol will appear to be one bucket by itself. */
+#define BLOCK_BUCKETS(bl) (bl)->nsyms
+#define BLOCK_BUCKET(bl, n) (bl)->sym[n]
+
+/* Macro used to set the size of a hashtable for N symbols. */
+#define BLOCK_HASHTABLE_SIZE(n) ((n)/5 + 1)
+
+/* Macro to loop through all symbols in a block BL, in no particular order.
+ i counts which bucket we are in, and sym points to the current symbol. */
+
+#define ALL_BLOCK_SYMBOLS(bl, i, sym) \
+ for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++) \
+ for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym); \
+ (sym) = (sym)->hash_next)
+
+/* Nonzero if symbols of block BL should be sorted alphabetically.
+ Don't sort a block which corresponds to a function. If we did the
+ sorting would have to preserve the order of the symbols for the
+ arguments. Also don't sort any block that we chose to hash. */
+
+#define BLOCK_SHOULD_SORT(bl) (! BLOCK_HASHTABLE (bl) \
+ && BLOCK_FUNCTION (bl) == NULL)
+
+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 *);
+
+extern struct blockvector *blockvector_for_pc (CORE_ADDR, int *);
+
+extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR, asection *,
+ int *, struct symtab *);
+
+extern struct block *block_for_pc (CORE_ADDR);
+
+extern struct block *block_for_pc_sect (CORE_ADDR, asection *);
+
+#endif /* BLOCK_H */
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index d5ed0025932..1f1659f89a6 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -38,6 +38,7 @@
#include "dummy-frame.h"
#include "command.h"
#include "gdbcmd.h"
+#include "block.h"
/* Prototypes for exported functions. */
@@ -257,96 +258,6 @@ get_frame_function (struct frame_info *frame)
}
-/* Return the blockvector immediately containing the innermost lexical block
- containing the specified pc value and section, or 0 if there is none.
- PINDEX is a pointer to the index value of the block. If PINDEX
- is NULL, we don't pass this information back to the caller. */
-
-struct blockvector *
-blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section,
- int *pindex, struct symtab *symtab)
-{
- register struct block *b;
- register int bot, top, half;
- struct blockvector *bl;
-
- if (symtab == 0) /* if no symtab specified by caller */
- {
- /* First search all symtabs for one whose file contains our pc */
- if ((symtab = find_pc_sect_symtab (pc, section)) == 0)
- return 0;
- }
-
- bl = BLOCKVECTOR (symtab);
- b = BLOCKVECTOR_BLOCK (bl, 0);
-
- /* Then search that symtab for the smallest block that wins. */
- /* Use binary search to find the last block that starts before PC. */
-
- bot = 0;
- top = BLOCKVECTOR_NBLOCKS (bl);
-
- while (top - bot > 1)
- {
- half = (top - bot + 1) >> 1;
- b = BLOCKVECTOR_BLOCK (bl, bot + half);
- if (BLOCK_START (b) <= pc)
- bot += half;
- else
- top = bot + half;
- }
-
- /* Now search backward for a block that ends after PC. */
-
- while (bot >= 0)
- {
- b = BLOCKVECTOR_BLOCK (bl, bot);
- if (BLOCK_END (b) > pc)
- {
- if (pindex)
- *pindex = bot;
- return bl;
- }
- bot--;
- }
- return 0;
-}
-
-/* Return the blockvector immediately containing the innermost lexical block
- containing the specified pc value, or 0 if there is none.
- Backward compatibility, no section. */
-
-struct blockvector *
-blockvector_for_pc (register CORE_ADDR pc, int *pindex)
-{
- return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
- pindex, NULL);
-}
-
-/* Return the innermost lexical block containing the specified pc value
- in the specified section, or 0 if there is none. */
-
-struct block *
-block_for_pc_sect (register CORE_ADDR pc, struct sec *section)
-{
- register struct blockvector *bl;
- int index;
-
- bl = blockvector_for_pc_sect (pc, section, &index, NULL);
- if (bl)
- return BLOCKVECTOR_BLOCK (bl, index);
- return 0;
-}
-
-/* Return the innermost lexical block containing the specified pc value,
- or 0 if there is none. Backward compatibility, no section. */
-
-struct block *
-block_for_pc (register CORE_ADDR pc)
-{
- return block_for_pc_sect (pc, find_pc_mapped_section (pc));
-}
-
/* Return the function containing pc value PC in section SECTION.
Returns 0 if function is not known. */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5327d7a9d42..6a6eba307ab 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -48,6 +48,7 @@
#include "ui-out.h"
#include "cli/cli-script.h"
#include "gdb_assert.h"
+#include "block.h"
#include "gdb-events.h"
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index d5d6171a0a6..e8c8750eef4 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -28,6 +28,7 @@
#include "gdb-events.h"
struct value;
+struct block;
/* This is the maximum number of bytes a breakpoint instruction can take.
Feel free to increase it. It's just used in a few places to size
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 5e9ac84b4e3..3fbc8d1af1a 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -43,6 +43,7 @@
#include "filenames.h" /* For DOSish file names */
#include "macrotab.h"
#include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */
+#include "block.h"
/* Ask buildsym.h to define the vars it normally declares `extern'. */
#define EXTERN
/**/
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index b2a249c5574..6987742b031 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -34,6 +34,8 @@
normally extern, but which get defined in a single module using
this technique. */
+struct block;
+
#ifndef EXTERN
#define EXTERN extern
#endif
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index d47588ec59e..cd4e8d0ae8d 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "charset.h"
+#include "block.h"
/* Flag indicating we're dealing with HP-compiled objects */
extern int hp_som_som_object_present;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index adbca1c16ca..c2f140ba7b4 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -44,6 +44,7 @@
#include "complaints.h"
#include "target.h"
#include "gdb_assert.h"
+#include "block.h"
extern void _initialize_coffread (void);
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 69d45594068..b64c3c5f4bf 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -30,6 +30,7 @@
#include "frame.h" /* For frame_map_regnum_to_name. */
#include "target.h"
#include "gdb_string.h"
+#include "block.h"
#ifdef HAVE_CTYPE_H
#include <ctype.h>
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 69662310e1d..a9504c18418 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -53,6 +53,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
#include <ctype.h>
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 6b4b36dae90..7f178a4b604 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -33,6 +33,7 @@
#include "frame.h"
#include "gdbcore.h"
#include "command.h"
+#include "block.h"
#if 0
static int there_is_a_visible_common_named (char *);
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 4e8a42dc218..577b8afa083 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -35,6 +35,7 @@
#include "symfile.h" /* for overlay functions */
#include "regcache.h"
#include "builtin-regs.h"
+#include "block.h"
/* Basic byte-swapping routines. GDB has needed these for a long time...
All extract a target-format integer at ADDR which is LEN bytes long. */
diff --git a/gdb/frame.h b/gdb/frame.h
index 81691732430..abaf9234e54 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -25,6 +25,7 @@
struct symtab_and_line;
struct frame_unwind;
+struct block;
/* The traditional frame unwinder. */
extern const struct frame_unwind *trad_frame_unwind;
@@ -506,10 +507,6 @@ extern CORE_ADDR frame_address_in_block (struct frame_info *);
extern CORE_ADDR get_pc_function_start (CORE_ADDR);
-extern struct block *block_for_pc (CORE_ADDR);
-
-extern struct block *block_for_pc_sect (CORE_ADDR, asection *);
-
extern int frameless_look_for_prologue (struct frame_info *);
extern void print_frame_args (struct symbol *, struct frame_info *,
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 7a96900a24e..0f88d637d45 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -42,6 +42,7 @@
#include "parser-defs.h"
#include "regcache.h"
#include "reggroups.h"
+#include "block.h"
#include <ctype.h>
/* Functions exported for general use, in inferior.h: */
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index b4ae3401ea4..565881d9142 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -48,6 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index b283f36cbc8..be82fe9a24b 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -33,6 +33,7 @@
#include "c-lang.h"
#include "jv-lang.h"
#include "gdbcore.h"
+#include "block.h"
#include <ctype.h>
struct type *java_int_type;
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 4c0e3c12753..a4d4ab1bab4 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -32,6 +32,7 @@
#include "completer.h"
#include "cp-abi.h"
#include "parser-defs.h"
+#include "block.h"
/* We share this one with symtab.c, but it is not exported widely. */
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 3fb46851c84..cf0846c667d 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ad87f464563..ac49ca0fafd 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -53,6 +53,7 @@
#include "complaints.h"
#include "demangle.h"
#include "gdb_assert.h"
+#include "block.h"
/* These are needed if the tm.h file does not contain the necessary
mips specific definitions. */
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index fdc6b4d1418..948748907ab 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-19 David Carlton <carlton@math.stanford.edu>
+
+ * mi-cmd-stack.c: #include "block.h"
+
2003-02-09 Andrew Cagney <ac131313@redhat.com>
* mi-interp.c (mi_remove_notify_hooks): Convert function
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 34fb3082189..7f32ef1e80c 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -26,6 +26,7 @@
#include "mi-cmds.h"
#include "ui-out.h"
#include "symtab.h"
+#include "block.h"
/* FIXME: these should go in some .h file but stack.c doesn't have a
corresponding .h file. These wrappers will be obsolete anyway, once
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 5898e579f1c..3c7c2ca43e0 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -40,6 +40,7 @@
#include "regcache.h"
#include "osabi.h"
#include "mips-tdep.h"
+#include "block.h"
#include "opcode/mips.h"
#include "elf/mips.h"
diff --git a/gdb/nlmread.c b/gdb/nlmread.c
index eaa9ddeb2f3..089c0f7dfb5 100644
--- a/gdb/nlmread.c
+++ b/gdb/nlmread.c
@@ -27,6 +27,7 @@
#include "objfiles.h"
#include "buildsym.h"
#include "stabsread.h"
+#include "block.h"
extern void _initialize_nlmread (void);
diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y
index 1a7c5f002a8..8e52fc0f124 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -52,6 +52,7 @@
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */
#include "top.h"
#include "completer.h" /* For skip_quoted(). */
+#include "block.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
etc), as well as gratuitiously global symbol names, so we can have
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 00a57dddae0..e447b912574 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -41,6 +41,7 @@
#include "frame.h"
#include "gdb_regex.h"
#include "regcache.h"
+#include "block.h"
#include <ctype.h>
diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h
index 58f1884c602..4156dd7d954 100644
--- a/gdb/objc-lang.h
+++ b/gdb/objc-lang.h
@@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */
struct value;
+struct block;
extern int objc_parse (void); /* Defined in c-exp.y */
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index dd4ef62b268..8f141b315be 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -42,6 +42,7 @@
#include "hashtab.h"
#include "breakpoint.h"
+#include "block.h"
/* Prototypes for local functions */
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index b4d4739d69c..896a06b539f 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h" /* Required by objfiles.h. */
#include "symfile.h" /* Required by objfiles.h. */
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
diff --git a/gdb/parse.c b/gdb/parse.c
index 45a95975fe1..d4a6a051937 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -48,6 +48,7 @@
with "gdbarch.h" when appropriate. */
#include "doublest.h"
#include "gdb_assert.h"
+#include "block.h"
/* Symbols which architectures can redefine. */
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index e6753848bc9..f03f5370096 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -28,6 +28,8 @@
#include "doublest.h"
+struct block;
+
extern struct expression *expout;
extern int expout_size;
extern int expout_ptr;
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index e2406c7b104..99a822dbac0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -41,6 +41,7 @@
#include "completer.h" /* for completion functions */
#include "ui-out.h"
#include "gdb_assert.h"
+#include "block.h"
extern int asm_demangle; /* Whether to demangle syms in asm printouts */
extern int addressprint; /* Whether to print hex addresses in HLL " */
diff --git a/gdb/stack.c b/gdb/stack.c
index 6b242b2ab8a..d689f9c3486 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -39,6 +39,7 @@
#include "inferior.h"
#include "annotate.h"
#include "ui-out.h"
+#include "block.h"
/* Prototypes for exported functions. */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 23ca1d24bb5..62f96798b6e 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -47,6 +47,7 @@
#include "hashtab.h"
#include <readline/readline.h>
#include "gdb_assert.h"
+#include "block.h"
#include <sys/types.h>
#include <fcntl.h>
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 267146375c6..17bcb4cddae 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -28,6 +28,7 @@
/* Opaque declarations. */
struct obstack;
+struct block;
/* Partial symbols are stored in the psymbol_cache and pointers to them
are kept in a dynamically grown array that is obtained from malloc and
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 3011335230a..f6a86741c23 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -32,6 +32,7 @@
#include "gdb_obstack.h"
#include "language.h"
#include "bcache.h"
+#include "block.h"
#include "gdb_string.h"
#include <readline/readline.h>
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 606a5387592..e77cd21c6cf 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -44,6 +44,7 @@
#include "hashtab.h"
#include "gdb_obstack.h"
+#include "block.h"
#include <sys/types.h>
#include <fcntl.h>
@@ -1786,18 +1787,6 @@ find_active_alias (struct symbol *sym, CORE_ADDR addr)
}
-/* Return the symbol for the function which contains a specified
- lexical block, described by a struct block BL. */
-
-struct symbol *
-block_function (struct block *bl)
-{
- while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
- bl = BLOCK_SUPERBLOCK (bl);
-
- return BLOCK_FUNCTION (bl);
-}
-
/* Find the symtab associated with PC and SECTION. Look through the
psymtabs and read in another symtab if necessary. */
@@ -3283,19 +3272,6 @@ rbreak_command (char *regexp, int from_tty)
}
-/* Return Nonzero if block a is lexically nested within block b,
- or if a and b have the same pc range.
- Return zero otherwise. */
-int
-contained_in (struct block *a, struct block *b)
-{
- if (!a || !b)
- return 0;
- return BLOCK_START (a) >= BLOCK_START (b)
- && BLOCK_END (a) <= BLOCK_END (b);
-}
-
-
/* Helper routine for make_symbol_completion_list. */
static int return_val_size;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 42a144b30b7..2b5a17ba8bc 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -25,8 +25,11 @@
#define SYMTAB_H 1
/* Opaque declarations. */
+
struct obstack;
struct objfile;
+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
@@ -287,148 +290,7 @@ struct minimal_symbol
#define MSYMBOL_INFO(msymbol) (msymbol)->info
#define MSYMBOL_TYPE(msymbol) (msymbol)->type
-
-
-
-/* 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;
-
- /* 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;
-
- /* The symbols for this block are either in a simple linear list or
- in a simple hashtable. Blocks which correspond to a function
- (which have a list of symbols corresponding to arguments) use
- a linear list, as do some older symbol readers (currently only
- mdebugread and dstread). Other blocks are hashed.
-
- The hashtable uses the same hash function as the minsym hashtables,
- found in minsyms.c:minsym_hash_iw. Symbols are hashed based on
- their demangled name if appropriate, and on their name otherwise.
- The hash function ignores space, and stops at the beginning of the
- argument list if any.
-
- The table is laid out in NSYMS/5 buckets and symbols are chained via
- their hash_next field. */
-
- /* If this is really a hashtable of the symbols, this flag is 1. */
-
- unsigned char hashtable;
-
- /* Number of local symbols. */
-
- int nsyms;
-
- /* The symbols. If some of them are arguments, then they must be
- in the order in which we would like to print them. */
-
- struct symbol *sym[1];
-};
-
-#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_GCC_COMPILED(bl) (bl)->gcc_compile_flag
-#define BLOCK_HASHTABLE(bl) (bl)->hashtable
-
-/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only. */
-#define BLOCK_NSYMS(bl) (bl)->nsyms
-#define BLOCK_SYM(bl, n) (bl)->sym[n]
-
-/* For blocks with a hashtable, but these are valid for non-hashed blocks as
- well - each symbol will appear to be one bucket by itself. */
-#define BLOCK_BUCKETS(bl) (bl)->nsyms
-#define BLOCK_BUCKET(bl, n) (bl)->sym[n]
-
-/* Macro used to set the size of a hashtable for N symbols. */
-#define BLOCK_HASHTABLE_SIZE(n) ((n)/5 + 1)
-
-/* Macro to loop through all symbols in a block BL, in no particular order.
- i counts which bucket we are in, and sym points to the current symbol. */
-
-#define ALL_BLOCK_SYMBOLS(bl, i, sym) \
- for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++) \
- for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym); \
- (sym) = (sym)->hash_next)
-
-/* Nonzero if symbols of block BL should be sorted alphabetically.
- Don't sort a block which corresponds to a function. If we did the
- sorting would have to preserve the order of the symbols for the
- arguments. Also don't sort any block that we chose to hash. */
-
-#define BLOCK_SHOULD_SORT(bl) (! BLOCK_HASHTABLE (bl) \
- && BLOCK_FUNCTION (bl) == NULL)
/* Represent one symbol name; a variable, constant, function or typedef. */
@@ -1054,10 +916,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 */
@@ -1112,8 +970,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 *);
@@ -1317,13 +1173,6 @@ extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
extern struct symtab_and_line find_function_start_sal (struct symbol *sym,
int);
-/* blockframe.c */
-
-extern struct blockvector *blockvector_for_pc (CORE_ADDR, int *);
-
-extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR, asection *,
- int *, struct symtab *);
-
/* symfile.c */
extern void clear_symtab_users (void);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index cd1c752c25d..58ca98fbb30 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -37,6 +37,7 @@
#include "regcache.h"
#include "completer.h"
#include "gdb-events.h"
+#include "block.h"
#include "ax.h"
#include "ax-gdb.h"
diff --git a/gdb/valops.c b/gdb/valops.c
index 2304274c2bb..f904f8cc234 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -33,6 +33,7 @@
#include "gdbcmd.h"
#include "regcache.h"
#include "cp-abi.h"
+#include "block.h"
#include <errno.h>
#include "gdb_string.h"
diff --git a/gdb/value.h b/gdb/value.h
index 8f222fcdfec..04be76ad7fb 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -24,6 +24,7 @@
#define VALUE_H 1
struct regcache;
+struct block;
#include "doublest.h"
diff --git a/gdb/values.c b/gdb/values.c
index 2dfaee9aad6..8b1d013a0e1 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -36,6 +36,7 @@
#include "doublest.h"
#include "gdb_assert.h"
#include "regcache.h"
+#include "block.h"
/* Prototypes for exported functions. */
diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c
index af8fbd537e0..fb67d75a23f 100644
--- a/gdb/x86-64-tdep.c
+++ b/gdb/x86-64-tdep.c
@@ -31,6 +31,7 @@
#include "x86-64-tdep.h"
#include "dwarf2cfi.h"
#include "gdb_assert.h"
+#include "block.h"
/* Register numbers of various important registers. */
#define RAX_REGNUM 0