Based on patch from Daniel Berlin <dberlin@dberlin.org>.
* buildsym.c: Include "demangle.h" for SYMBOL_INIT_DEMANGLED_NAME.
(finish_block) For non-function blocks, hash the symbol table. For
function blocks, mark the symbol table as unhashed.
* minsyms.c (msymbol_hash): Return hash value without taking modulus.
(msymbol_hash_iw): Likewise.
(add_minsym_to_hash_table): Take modulus of msymbol_hash's return
value.
(add_minsym_to_demangled_hash_table): Likewise for msymbol_hash_iw.
(lookup_minimal_symbol): Likewise for both.
* symtab.h (struct block): Add `hashtable' flag. Comment the
hashtable.
(BLOCK_HASHTABLE, BLOCK_BUCKETS, BLOCK_BUCKET): New macro.
(ALL_BLOCK_SYMBOLS): Update.
(BLOCK_SHOULD_SORT): Do not sort hashed blocks.
(struct symbol): Add `hash_next' pointer.
* symtab.c (lookup_block_symbol): Search using the hash table when
possible.
(find_pc_sect_symtab): Use ALL_BLOCK_SYMBOLS.
(search_symbols, find_addr_symbol): Likewise.
* dstread.c (process_dst_block): Clear hashtable bit for new block.
(read_dst_symtab): Likewise.
* jv-lang.c (get_java_class_symtab): Likewise.
* mdebugread.c: Include "gdb_assert.h".
(shrink_block): Assert that the block being modified is not hashed.
* coffread.c (patch_opaque_types): Use ALL_BLOCK_SYMBOLS.
* symmisc.c (free_symtab_block): Walk the hash table when freeing
symbols.
(dump_symtab): Recognize hashed blocks.
* printcmd.c (print_frame_args): Assert that function blocks do not
have hashed symbol tables.
* ada-lang.c (symtab_for_sym): Use ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Likewise.
(ada_add_block_symbols): Use ALL_BLOCK_SYMBOLS. Handle hash tables.
(record_debugformat): Declare global function.
* buildsym.c (start_subfile): Initialize debugformat member
to NULL.
(record_debugformat): New function to record the format.
(end_symtab): Copy format into symtab debugformat member.
(end_symtab): Free subfile debugformat member.
* symmisc.c (free_symtab): Free debugformat when freeing
symtab.
* symfile.c (allocate_symtab): Initialize the new debugformat
member for new symtabs.
* symtab.h (struct symtab): Add debugformat member.
* source.c (source_info): Print the debug format.
* os9kread.c (os9k_process_one_symbol): Call record_debugformat
with "OS9".
* hpread.c (hpread_expand_symtab): Call record_debugformat
with "HP".
(hpread_process_one_debug_symbol): Ditto.
* dbxread.c (process_one_symbol): Call record_debugformat
with "stabs".
* coffread.c (coff_start_symtab): Call record_debugformat
with "COFF".
* xcoffread.c (read_xcoff_symtab): Call record_debugformat
with "XCOFF".
* dwarfread.c (read_file_scope): Call record_debugformat
with "DWARF 1".
* dwarf2read.c (read_file_scope): Call record_debugformat
with "DWARF 2".
* dstread.c (dst_end_symtab): Set debugformat to be
"Apollo DST".
* mdebugread.c (new_symtab): Set debugformat to be "ECOFF".
* dbxread.c (dbx_symfile_read): Call free_pending_blocks rather
than poking global variable (which is now static).
* hpread.c (hpread_build_psymtabs): Ditto.
* os9kread.c (os9k_symfile_read): Ditto.
* xcoffread.c (xcoff_initial_scan): Ditto.
* buildsym.h (free_pending_blocks): Declare here.
(pending_blocks): Remove declaration of global symbol.
(free_pendings): Remove declaration of global symbol.
(make_blockvector): Declare here.
(record_pending_block): Declare here.
* dstread.c (make_blockvector): Remove static copy that was old
clone of version in buildsym.c.
(process_dst_block): Call record_pending_block rather than doing
it by hand.
(read_dst_symtab): Ditto.
* buildsym.c (make_blockvector): Make global rather than static,
(record_pending_block): New function, code moved from finish_block.
(finish_block): Use record_pending_block.
(free_pending_blocks): New function.
(really_free_pendings): Call free_pending_blocks.
(pending_blocks): Make static instead of global.
(free_pendings): Make static instead of global.
* coffread.c (record_minimal_symbol): Don't presave name string
on symbol_obstack before passing to prim_record_minimal_symbol.
It now handles saving the string itself.
* dbxread.c (read_dbx_dynamic_symtab): Ditto.
* mipsread.c (read_alphacoff_dynamic_symtab): Ditto.
* os9kread.c (record_minimal_symbol): Ditto.
* solib.c (solib_add_common_symbols): Ditto.
* coffread.c (coff_symtab_read): Don't presave name string on
symbol_obstack before passing to prim_record_minimal_symbol_and_info.
It now handles saving the string itself.
* dbxread.c (record_minimal_symbol): Ditto.
* elfread.c (record_minimal_symbol_and_info): Ditto.
* dstread.c (record_minimal_symbol): Remove static function that just
called prim_record_minimal_symbol with the same args (after change to
prim_record_minimal_symbol to do it's own name string saves).
* nlmread.c (record_minimal_symbol): Ditto.
* somread.c (record_minimal_symbol): Ditto.
* hpread.c (hpread_read_enum_type): Save symbol name on symbol obstack.
(hpread_read_function_type): Ditto.
(hpread_process_one_debug_symbol): Ditto.
* mdebugread.c (parse_symbol): Ditto.
(new_symbol): Ditto.
* minsyms.c (prim_record_minimal_symbol_and_info): Ditto.
* coffread.c (process_coff_symbol): Use obsavestring to save
SYMBOL_NAME, rather than obstack_copy0.
* dstread.c (create_new_symbol): Ditto
* symfile.c (obconcat): Ditto.
* stabsread.c (patch_block_stabs): Ditto.
* xcoffread.c (SYMNAME_ALLOC): Ditto.
* symfile.c (obsavestring): Update comments
* solib.c (solib_add_common_symbols): Remove local var origname.
Change all references to stdout/stderr to gdb_stdout/gdb_stderr.
Replace all calls to stdio output functions with calls to
corresponding _unfiltered functions (`fprintf_unfiltered')
Replaced calls to fopen for output to gdb_fopen.
Added sufficient goo to utils.c and defs.h to make the above work.
The net effect is that stdio output functions are only directly used
in utils.c. Elsewhere, the _unfiltered and _filtered functions and
GDB_FILE type are used.
In the near future, GDB_FILE will stop being equivalant to FILE.
The semantics of some commands has changed in a very subtle way:
called in the right context, they may cause new occurences of
prompt_for_continue() behavior. The testsuite doesn't notice anything
like this, though.
Please respect this change by not reintroducing stdio output
dependencies in the main body of gdb code. All output from commands
should go to a GDB_FILE.
Target-specific code can still use stdio directly to communicate with
targets.
* dst.h, dstread.c, config/m68k/{apollo68b.mt,tm-apollo68b.h}:
New files.
* config/m68k/nm-apollo68b.h: Add more defines.
* configure.in: Recognize apollo target, not just host.