* symfile.c (copy_section_addr_info): New function.
(symbol_file_add_with_addrs_or_offsets): Use it to save the
original set of address arguments, instead of handwritten code
that uses one length to allocate and a different length to
initialize. Use make_cleanup_free_section_addr_info.
* symfile.h (copy_section_addr_info): New declaration.
* utils.c: #include "symfile.h".
(do_free_section_addr_info, make_cleanup_free_section_addr_info):
New functions.
* defs.h (make_cleanup_free_section_addr_info): New declaration.
* Makefile.in (utils.o): Update dependencies.
* symfile.h (symbol_file_add_from_memory): Delete declaration.
* symfile-mem.h: Delete file.
* symfile-mem.c: Do not include "symfile-mem.h".
(symbol_file_add_from_memory): Make static. Use "struct bfd" and
"struct bfd_section". When an error do not bother returning NULL.
(add_symbol_file_from_memory_command): Use "struct bfd" and
"struct bfd_section".
* Makefile.in (symfile_mem_h): Delete.
(symfile-mem.o): Update dependencies.
* symfile.c (symbol_file_add_with_addrs_or_offsets): Take ABFD as
argument instead of NAME.
(symbol_file_add, reread_separate_symbols): Call symfile_bfd_open
in call to symbol_file_add_with_addrs_or_offsets.
(build_addr_info): New function, helper for ...
(symbol_file_add_from_memory): New function.
(add_symbol_file_from_memory_command): New function using that.
(_initialize_symfile): Register it for add-symbol-file-from-memory.
(pre_add_symbol_hook): Add const to argument type.
* symfile.h (symbol_file_add_from_memory): Declare it.
(fill_symbuf): Support an in-memory buffer for stabs data.
(stabs_seek): New function.
(dbx_psymtab_to_symtab): Relocate the stabs data if necessary.
(read_ofile_symtab): Use stabs_seek.
(elfstab_build_psymtabs): Take an asection* instead of
an offset and size. Relocate the stabs data if necessary.
Save the section* for dbx_psymtab_to_symtab.
* dwarf2read.c: Add section variables for each debug section.
(dwarf2_locate_sections): Fill them in.
(dwarf2_read_section): Take an asection* argument.
Relocate the section contents if necessary.
(dwarf2_build_psymtabs, dwarf2_build_psymtabs_easy): Update callers.
* dwarf2cfi.c (parse_frame_info): Take a section argument and pass
it to dwarf2_read_section.
(dwarf2_build_frame_info): Update callers.
* elfread.c (elf_symfile_read): Update call to
elfstab_build_psymtabs.
* gdb-stabs.h (struct dbx_symfile_info): Add stab_section.
(DBX_STAB_SECTION): New macro.
* stabsread.h (elfstab_build_psymtabs): Update prototype.
* symfile.c (symfile_dummy_outputs): New function.
(symfile_relocate_debug_section): New function.
* symfile.h (symfile_relocate_debug_section): Add prototype.
(syms_from_objfile): Add the ability to pass in a section offset
table directly, as an alternative to the section_addr_info table.
Document arguments better.
(symbol_file_add): Pass extra arguments to syms_from_objfile.
* symfile.h (syms_from_objfile): Update declaration.
* rs6000-nat.c (objfile_symbol_add): Pass new arguments to
syms_from_objfile.
* Makefile.in (symfile.o): List dependency on $(gdb_assert_h).
* symfile.h: Add opaque declaration for struct obstack.
Declare obsavestring to take a const char *.
* symfile.c (obsavestring): Make first argument a const char *.
* symfile.c (get_section_index): New function.
* mdebugread.c (SC_IS_SBSS): New macro.
(SC_IS_BSS): Return true for the scBss storage class only, as
the scSBss storage class refers to the .sbss section.
(parse_partial_symbols): Discard the symbols which associated
section does not exist.
Make sure to use the .sbss section index for symbols which
storage class is scBss, rather than using the .bss section index.
Changelog:
2001-10-27 Fred Fish <fnf@redhat.com>
* symfile.c (auto_solib_add): Update comment to note that
this variable is now just used as a boolean to control shlib
autoloading, and clarify when it is used.
* symfile.h (auto_solib_add): Ditto.
* symfile.c (auto_solib_limit): New variable that holds the
autoloading threshold instead of overloading auto_solib_add.
* symfile.h (auto_solib_limit): Ditto.
* irix5-nat.c (_initialize_solib): Change auto-solib-add
variable from var_zinteger to var_boolean and update help.
* osfsolib.c (_initialize_solib): Ditto.
* pa64solib.c (_initialize_pa64_solib): Ditto.
* solib.c (_initialize_solib): Ditto.
* somsolib.c (_initialize_som_solib): Ditto.
* xcoffsolib.c (_initialize_solib): Ditto.
* pa64solib.c (pa64_solib_total_st_size): Update comment to
note that the new auto_solib_limit variable is used instead
of overloading auto_solib_add variable.
(_initialize_pa64_solib): Ditto.
* somsolib.c (som_solib_total_st_size): Ditto.
(_initialize_som_solib): Ditto.
* pa64solib.c (_initialize_pa64_solib): Add new set/show
commands for auto-solib-limit variable.
* somsolib.c (_initialize_som_solib): Ditto
* pa64solib.c (add_to_solist): Check that auto_solib_add is
set and use auto_solib_limit as the threshold size instead
of auto_solib_add.
* somsolib.c (som_solib_add): Ditto, and also change warning
text about size threshold exceeded.
doc/ChangeLog:
2001-10-28 Fred Fish <fnf@redhat.com>
* gdb.texinfo (auto-solib-add): Change docs to match
implementation change.
(auto-solib-limit): Add docs for new variable.
Fix double parsing of filenames passed as command line arguments
to GDB (causes weird handling of escape characters).
Also, remove dependencies on the CLI from libgdb.
* call-cmds.h: Remove declaration of exec_file_command().
* gdbcore.h: Remove declaration of exec_file_command().
Add declarations for exec_open() and exec_file_clear().
* symfile.h: Add declarations for symbol_file_add_main() and
symbol_file_clear().
* exec.c (exec_open): New function. Implements to_open for exec
targets.
(exec_file_clear): New function. Makes GDB forget about a previously
specified executable file.
(exec_file_attach): Move parsing of arguments from here ...
(exec_file_command): ... to here.
(init_exec_ops): Use exec_open(), not exec_file_command() to
implement to_open for exec targets.
* symfile.c (symbol_file_add_main): New function. Call symbol_file_add() with default values. Used when the file name has already been parsed.
(symbol_file_clear): New function. Makes GDB forget about previously
read symbols.
(symbol_file_command): Call the above function instead of inline code.
* main.c: Include "symfile.h" and "gdbcore.h" instead of the deprecated
"call-cmds.h".
(captured_main): Call exec_file_attach() and symbol_file_add_main()
instead of exec_file_command() and symbol_file_command().
(captured_main): Add comment.
* corefile.c: Include "symfile.h".
(core_file_command): Call symbol_file_add_main() instead of
symbol_file_command().
(reopen_exec_file): Call exec_open() instead of exec_file_command().
* infcmd.c: Include "symfile.h".
(attach_command): Call symbol_file_add_main() instead of
symbol_file_command().
* infrun.c: Remove comment about the inclusion of "symfile.h",
not any longer appropriate.
(follow_exec): Call symbol_file_add_main() instead of
symbol_file_command().
* remote-es.c: Include "symfile.h".
(es1800_load): Call symbol_file_add_main() instead of
symbol_file_command().
* remote-vx.c: Remove comment about the inclusion of "symfile.h",
not any longer appropriate.
(vx-wait): Call symbol_file_add_main() instead of
symbol_file_command().
* solib-svr4.c (open_symbol_file_object): Call symbol_file_add_main()
instead of symbol_file_command().
* v850ice.c (ice_file): Call exec_open(), exec_file_attach() and
symbol_file_add_main() instead of exec_file_command() and
symbol_file_command().
* Makefile.in: Update dependencies.
* symfile.h (struct section_addr_info ): Remove fields for special
treatment of .text, .data and .bss sections.
* solib.c (symbol_add_stub): The special field text_addr is not
available anymore. Search for the .text field the hard way.
* symfile.c (build_section_addr_info_from_section_table): Don't
fill in {text, data, bss}_addr any more.
(default_symfile_offsets): Don't use {text, data, bss}_addr fields
to fill in section_offsets for objfile.
(syms_from_objfile): Don't deal with {text, data, bss}_addr as a
special case anymore.
(add_symbol_file_command): Ditto.
* Makefile.in (SFILES): Add bcache.c.
(symtab_h): Add bcache.h.
(HFILES_NO_SRCDIR): add bcache.h
(COMMON_OBJS): Add bcache.o
(bcache.o): New target.
* dbxread.c (start_psymtab): Make global_syms & static_syms
type "partial_symbol **".
* hpread.c (hpread_start_symtab): Ditto.
* os9kread.c (os9k_start_psymtab): Ditto.
* stabsread.h (start_psymtab): Ditto.
* {symfile.c, symfile.h} (start_psymtab_common): Ditto.
* maint.c (maintenance_print_statistics): Call
print_symbol_bcache_statistics.
* objfiles.c (allocate_objfile): Initialize psymbol bcache malloc
and free pointers.
* solib.c (allocate_rt_common_objfile): Ditto.
* symfile.c (reread_symbols): Ditto.
(free_objfile): Free psymbol bcache when objfile is freed.
(objfile_relocate): Use new indirect psymbol pointers.
* objfiles.h (struct objfile): Add psymbol cache.
* symfile.c (compare_psymbols): Now passed pointers to pointers to
psymbols.
(reread_symbols): Free psymbol bcache when freeing other objfile
resources.
(add_psymbol_to_list, add_psymbol_addr_to_list): Initialize new
psymbol using the psymbol bcache.
(init_psymbol_list): Psymbol lists now contain pointers rather than
the actual psymbols.
* symfile.h (psymbol_allocation_list): Psymbol lists now dynamically
grown arrays of pointers.
(ADD_PSYMBOL_VT_TO_LIST): Initialize new symbol using the psymbol
bcache.
* symmisc.c (print_partial_symbols): Now takes pointer to pointer
to partial symbol.
(print_symbol_bcache_statistics): New function to print per objfile
bcache statistics.
(print_partial_symbol, print_partial_symbols,
maintenance_check_symtabs, extend_psymbol_list):
Account for change to pointer to pointer to partial symbol.
* symtab.c (find_pc_psymbol, lookup_partial_symbol, decode_line_2,
make_symbol_completion_list):
Account for change to pointer to pointer to partial symbol.
* symtab.h (bcache.h): Include.
* xcoffread.c (xcoff_start_psymtab): Make global_syms & static_syms
type "partial_symbol **".
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
elfread.c (coff_symfile_finish): Add function, prototype, and
add to the xxxx_sym_fns struct for each file type. Also reformat
the xxxx_sym_fns vector to a standard format and add comments.
* coffread.c, mipsread.c, xcoffread.c, coffread.c, dbxread.c,
elfread.c (xxx_symfile_new_init, xxx_symfile_init, xxx_symfile_read):
Pass pointer to struct objfile rather than pointer to sym_fns.
Change references inside each function accordingly. Allocate any
symbol file specific info in the per-objfile memory region.
* dbxread.c (free_and_init_header_files): Break function into
free_header_files(), called from dbx_symfile_finish(), and
init_header_files(), called from dbx_new_init().
* dbxread.c (dbx_new_init): Move deallocation things to new
dbx_symfile_finish function.
* elfread.c (elf_new_init): Call buildsym_new_init().
* objfiles.c (free_objfile): Call the appropriate symfile_finish()
routine for the objfile before deallocating other stuff.
* sparc-tdep.c (get_longjmp_target): Cast target_read_memory arg.
* symfile.h: Move struct sym_fns to before struct objfile def.
Add sym_finish function pointer and change prototypes of other
function pointers to reflect passing struct objfile pointer rather
than struct sym_fns pointer.
* symfile.c: Remove now obsolete symtab_fns pointer.
* symfile.c (symfile_init): Renamed to find_sym_fns, and now only
locates the correct sym_fns struct for the given objfile.
* symfile.c (syms_from_objfile, symbol_file_add): Restructured
for better support of mapped symbol tables.
* symfile.c (symbol_file_command): Remove obsolete code using
symfile_fns.
* symfile.h: Remove duplicate declarations for symfile_objfile,
entry_point, and object_files.
* target.c (target_info): Compare symfile_objfile to NULL.
* xcoffread.c (aixcoff_new_init): Move deallocation stuff to
aixcoff_symfile_finish().