Based on work from Daniel Jacobowitz <dan@codesourcery.com>
* c-typeprint.c (cp_type_print_method_args): For non-static methods,
print out const or volatile qualifiers, too.
(c_type_print_args): Add parameters show_artificial and language.
Skip artificial parameters when requested.
Use the appropriate language printer.
(c_type_print_varspec): Tell c_type_print_args to skip artificial
parameters and pass language_c.
* dwarf2read.c (die_list): New file global.
(struct partial_die_info): Update comments for name field.
(pdi_needs_namespace): Renamed to ...
(die_needs_namespace): ... this. Rewrite.
(dwarf2_linkage_name): Remove.
(add_partial_symbol): Do not predicate the call to
partial_die_full_name based on pdi_needs_namespace.
Remove call to cp_check_possible_namespace_symbols and associated
outdated comments.
(guess_structure_name): Do not inspect child subprogram DIEs.
(dwarf2_fullname): Update comments.
Use die_needs_namespace to assist in computing the name.
(read_func_scope): Use dwarf2_name to get the DIE's name.
Use dwarf2_physname to get the "linkage name" of the DIE.
(dwarf2_add_member_field): Use dwarf2_physname instead of
dwarf2_linkage_name.
(read_structure_type): For structs and classes, set TYPE_NAME, too.
(determine_class): Remove.
(read_partial_die): Ignore DW_AT_MIPS_linkage_name for all languages
except Ada.
(new_symbol): Unconditionally call dwarf2_name.
Compute the "linkage name" using dwarf2_physname.
Use dwarf2_name instead of dwarf2_full_name for enumerator DIEs.
When determining to scan for anonymous C++ namespaces, ignore
the linkage name.
(dwarf2_physname): New function.
(dwarf2_full_name): Move content to new function and call
that.
(dwarf2_compute_name): "New" function.
(_initialize_dwarf2_read): Initialize die_list.
* gnu-v3-eabi.c (gnu_v3_find_method_in): Remove unused variable
physname.
(gnu_v3_print_method_ptr): Use the physname for virtual methods
without a demangled name.
Print out type information for non-virtual methods.
* linespec.c (decode_line_1): Force ANY string using "::" (or
"." for java) to use decode_compound, and clean up any stray quoting.
If we found a file symtab, re-evaluate whether the remainder is_quoted.
(decode_compound): Stop consuming at an open parenthesis.
Keep template parameters.
Keep any overload information.
Keep keywords like "const".
Remove paren_pointer.
Move is_quoted check from set_flags to here.
Remove #if 0 code from 2000. Ten years is long enough.
(find_method): Before comparing symbol names, canonicalize the string
from the user.
If a specific overload is requested, find it. Otherwise throw an error.
(find_method_overload_end): New function.
(set_flags): Remove.
(decode_compound): Assume that parentheses are matched.
It's a lot easier.
* symtab.c (symbol_find_demangled_name): Add DMGL_VERBOSE flag
to cplus_demangle.
* linespec.c (decode_line_1): Keep important keywords like
"const" and "volatile".
* symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): Remove.
* typeprint.h (c_type_print_args): Add declaration.
* ui-file.c (do_ui_file_obsavestring): New function.
(ui_file_obsavestring): New function.
* ui-file.h (ui_file_obsavestring): Add declaration.
* valops.c (find_overload_match): Resolve the object to
a non-pointer type.
If the object is a data member, search the object for the member
and return with staticp set.
Use SYMBOL_NATURAL_NAME instead of SYMBOL_CPLUS_DEMANGLED_NAME.
Do not attempt to extract a function name from non-function types.
If the extracted function name and the original name are the same,
we don't have a C++ method.
From Jan Kratochvil <jan.kratochvil@redhat.com>:
* dwarf2read.c (new_symbol <DW_TAG_enumerator>): Call dwarf2_full_name.
* ada-lang.c (ada_lookup_symbol): Remove linkage_name parameters
and arguments from symbol lookups.
* ax-gdb.c (gen_expr): Likewise.
* cp-namespace.c (cp_lookup_symbol_nonlocal, lookup_namespace_scope,
cp_lookup_symbol_namespace, lookup_symbol_file, lookup_nested_type,
lookup_possible_namespace_symbol): Likewise.
* cp-support.c (read_in_psymtabs): Likewise.
* cp-support.h (cp_lookup_symbol_nonlocal): Likewise.
* language.h (la_lookup_symbol_nonlocal): Likewise.
* scm-valprint.c (scm_inferior_print): Likewise.
* solib-darwin.c (darwin_relocate_section_addresses): Likewise.
* solib-svr.c (elf_lookup_lib): Likewise.
* solib.c (show_auto_solib_add): Likewise.
* solist.h (lookup_lib_global, solib_global_lookup): Likewise.
* symmisc.c (maintenance_check_symtabs): Likewise.
* symtab.c (lookup_symbol_in_language, lookup_symbol_aux,
lookup_symbol_aux_local, lookup_symbol_aux_block,
lookup_symbol_from_objfile, lookup_symbol_aux_symtabs,
lookup_symbol_aux_psymtabs,basic_lookup_symbol_nonlocal,
lookup_symbol_static, lookup_symbol_global, symbol_matches_domain,
basic_lookup_transparent_type, find_main_psymtab,
lookup_block_symbol): Likewise.
* symtab.h (basic_lookp_symbol_nonlocal, lookup_symbol_static,
lookup_symbol_global, lookup_symbol_aux_block,
lookup_symbol_partial_symbol, lookup_block_symbol,
lookup_global_symbol, value_maybe_namespace_elt): Likewise.
* symfile.c (allocate_symtab): Don't use obsavestring on a
constant string.
* stabsread.c (define_symbol): Don't use obsavestring on a
constant string.
* mdebugread.c (parse_type): Don't use obsavestring on a constant
string.
(new_symtab): Likewise.
* elfread.c (elf_symtab_read): Don't use obsavestring on a
constant string.
Stan Shebs <stan@codesourcery.com>
Add base multi-executable/process support to GDB.
gdb/
* Makefile.in (SFILES): Add progspace.c.
(COMMON_OBS): Add progspace.o.
* progspace.h: New.
* progspace.c: New.
* breakpoint.h (struct bp_target_info) <placed_address_space>: New
field.
(struct bp_location) <pspace>: New field.
(struct breakpoint) <pspace>: New field.
(bpstat_stop_status, breakpoint_here_p)
(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
(regular_breakpoint_inserted_here_p)
(software_breakpoint_inserted_here_p, breakpoint_thread_match)
(set_default_breakpoint): Adjust prototypes.
(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
Adjust prototypes.
* breakpoint.c (executing_startup): Delete.
(default_breakpoint_sspace): New.
(breakpoint_restore_shadows): Skip if the address space doesn't
match.
(update_watchpoint): Record the frame's program space in the
breakpoint location.
(insert_bp_location): Record the address space in target_info.
Adjust to pass the symbol space to solib_name_from_address.
(breakpoint_program_space_exit): New.
(insert_breakpoint_locations): Switch the symbol space and thread
when inserting breakpoints. Don't insert breakpoints in a vfork
parent waiting for vfork done if we're not attached to the vfork
child.
(remove_breakpoints_pid): New.
(reattach_breakpoints): Switch to a thread of PID. Ignore
breakpoints of other symbol spaces.
(create_internal_breakpoint): Store the symbol space in the sal.
(create_longjmp_master_breakpoint): Iterate over all symbol
spaces.
(update_breakpoints_after_exec): Ignore breakpoints for other
symbol spaces.
(remove_breakpoint): Rename to ...
(remove_breakpoint_1): ... this. Pass the breakpoints symbol
space to solib_name_from_address.
(remove_breakpoint): New.
(mark_breakpoints_out): Ignore breakpoints from other symbol
spaces.
(breakpoint_init_inferior): Ditto.
(breakpoint_here_p): Add an address space argument and adjust to
use breakpoint_address_match.
(moribund_breakpoint_here_p): Ditto.
(regular_breakpoint_inserted_here_p): Ditto.
(breakpoint_inserted_here_p): Ditto.
(software_breakpoint_inserted_here_p): Ditto.
(breakpoint_thread_match): Ditto.
(bpstat_check_location): Ditto.
(bpstat_stop_status): Ditto.
(print_breakpoint_location): If there's a location to print,
switch the current symbol space.
(print_one_breakpoint_location): Add `allflag' argument.
(print_one_breakpoint): Ditto. Adjust.
(do_captured_breakpoint_query): Adjust.
(breakpoint_1): Adjust.
(breakpoint_has_pc): Also match the symbol space.
(describe_other_breakpoints): Add a symbol space argument and
adjust.
(set_default_breakpoint): Add a symbol space argument. Set
default_breakpoint_sspace.
(breakpoint_address_match): New.
(check_duplicates_for): Add an address space argument, and adjust.
(set_raw_breakpoint): Record the symbol space in the location and
in the breakpoint.
(set_longjmp_breakpoint): Skip longjmp master breakpoints from
other symbol spaces.
(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
(disable_breakpoints_in_shlibs): Skip breakpoints from other
symbol spaces.
(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
(create_catchpoint): Set the symbol space in the sal.
(disable_breakpoints_before_startup): Skip breakpoints from other
symbol spaces. Set executing_startup in the current symbol space.
(enable_breakpoints_after_startup): Clear executing_startup in the
current symbol space. Skip breakpoints from other symbol spaces.
(clone_momentary_breakpoint): Also copy the symbol space.
(add_location_to_breakpoint): Set the location's symbol space.
(bp_loc_is_permanent): Switch thread and symbol space.
(create_breakpoint): Adjust.
(expand_line_sal_maybe): Expand comment to mention symbol spaces.
Switch thread and symbol space when reading memory.
(parse_breakpoint_sals): Set the symbol space in the sal.
(break_command_really): Ditto.
(skip_prologue_sal): Switch and space.
(resolve_sal_pc): Ditto.
(watch_command_1): Record the symbol space in the sal.
(create_ada_exception_breakpoint): Adjust.
(clear_command): Adjust. Match symbol spaces.
(update_global_location_list): Use breakpoint_address_match.
(breakpoint_re_set_one): Switch thread and space.
(breakpoint_re_set): Save symbol space.
(breakpoint_re_set_thread): Also reset the symbol space.
(deprecated_insert_raw_breakpoint): Add an address space argument.
Adjust.
(insert_single_step_breakpoint): Ditto.
(single_step_breakpoint_inserted_here_p): Ditto.
(clear_syscall_counts): New.
(_initialize_breakpoint): Install it as inferior_exit observer.
* exec.h: Include "progspace.h".
(exec_bfd, exec_bfd_mtime): New defines.
(exec_close): Declare.
* exec.c: Include "gdbthread.h" and "progspace.h".
(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
(using_exec_ops): New.
(exec_close_1): Rename to exec_close, and make public.
(exec_close): Rename to exec_close_1, and adjust all callers. Add
description. Remove target sections and close executables from
all program spaces.
(exec_file_attach): Add comment.
(add_target_sections): Check on `using_exec_ops' to check if the
target should be pushed.
(remove_target_sections): Only unpush the target if there are no
more target sections in any symbol space.
* gdbcore.h: Include "exec.h".
(exec_bfd, exec_bfd_mtime): Remove declarations.
* frame.h (get_frame_program_space, get_frame_address_space)
(frame_unwind_program_space): Declare.
* frame.c (struct frame_info) <pspace, aspace>: New fields.
(create_sentinel_frame): Add program space argument. Set the
pspace and aspace fields of the frame object.
(get_current_frame, create_new_frame): Adjust.
(get_frame_program_space): New.
(frame_unwind_program_space): New.
(get_frame_address_space): New.
* stack.c (print_frame_info): Adjust.
(print_frame): Use the frame's program space.
* gdbthread.h (any_live_thread_of_process): Declare.
* thread.c (any_live_thread_of_process): New.
(switch_to_thread): Switch the program space as well.
(restore_selected_frame): Don't warn if trying to restore frame
level 0.
* inferior.h: Include "progspace.h".
(detach_fork): Declare.
(struct inferior) <removable, aspace, pspace>
<vfork_parent, vfork_child, pending_detach>
<waiting_for_vfork_done>: New fields.
<terminal_info>: Remove field.
<data, num_data>: New fields.
(register_inferior_data, register_inferior_data_with_cleanup)
(clear_inferior_data, set_inferior_data, inferior_data): Declare.
(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
(inferior_appeared): Declare.
(find_inferior_pid): Typo.
(find_inferior_id, find_inferior_for_program_space): Declare.
(set_current_inferior, save_current_inferior, prune_inferiors)
(number_of_inferiors): Declare.
(inferior_list): Declare.
* inferior.c: Include "gdbcore.h" and "symfile.h".
(inferior_list): Make public.
(delete_inferior_1): Always delete thread silently.
(find_inferior_id): Make public.
(current_inferior_): New.
(current_inferior): Use it.
(set_current_inferior): New.
(restore_inferior): New.
(save_current_inferior): New.
(free_inferior): Free the per-inferior data.
(add_inferior_silent): Allocate per-inferior data.
Call inferior_appeared.
(delete_threads_of_inferior): New.
(delete_inferior_1): Adjust interface to take an inferior pointer.
(delete_inferior): Adjust.
(delete_inferior_silent): Adjust.
(exit_inferior_1): New.
(exit_inferior): New.
(exit_inferior_silent): New.
(exit_inferior_num_silent): New.
(detach_inferior): Adjust.
(inferior_appeared): New.
(discard_all_inferiors): Adjust.
(find_inferior_id): Make public. Assert pid is not zero.
(find_inferior_for_program_space): New.
(have_inferiors): Check if we have any inferior with pid not zero.
(have_live_inferiors): Go over all pushed targets looking for
process_stratum.
(prune_inferiors): New.
(number_of_inferiors): New.
(print_inferior): Add executable column. Print vfork parent/child
relationships.
(inferior_command): Adjust to cope with not running inferiors.
(remove_inferior_command): New.
(add_inferior_command): New.
(clone_inferior_command): New.
(struct inferior_data): New.
(struct inferior_data_registration): New.
(struct inferior_data_registry): New.
(inferior_data_registry): New.
(register_inferior_data_with_cleanup): New.
(register_inferior_data): New.
(inferior_alloc_data): New.
(inferior_free_data): New.
(clear_inferior_data): New.
(set_inferior_data): New.
(inferior_data): New.
(initialize_inferiors): New.
(_initialize_inferiors): Register "add-inferior",
"remove-inferior" and "clone-inferior" commands.
* objfiles.h: Include "progspace.h".
(struct objfile) <pspace>: New field.
(symfile_objfile, object_files): Don't declare.
(ALL_PSPACE_OBJFILES): New.
(ALL_PSPACE_OBJFILES_SAFE): New.
(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
(ALL_PSPACE_SYMTABS): New.
(ALL_PRIMARY_SYMTABS): Adjust.
(ALL_PSPACE_PRIMARY_SYMTABS): New.
(ALL_PSYMTABS): Adjust.
(ALL_PSPACE_PSYMTABS): New.
* objfiles.c (object_files, symfile_objfile): Delete.
(struct objfile_sspace_info): New.
(objfiles_pspace_data): New.
(objfiles_pspace_data_cleanup): New.
(get_objfile_pspace_data): New.
(objfiles_changed_p): Delete.
(allocate_objfile): Set the objfile's program space. Adjust to
reference objfiles_changed_p in pspace data.
(free_objfile): Adjust to reference objfiles_changed_p in pspace
data.
(objfile_relocate): Ditto.
(update_section_map): Add pspace argument. Adjust to iterate over
objfiles in the passed in pspace.
(find_pc_section): Delete sections and num_sections statics.
Adjust to refer to program space's objfiles_changed_p. Adjust to
refer to sections and num_sections store in the objfile's pspace
data.
(objfiles_changed): Adjust to reference objfiles_changed_p in
pspace data.
(_initialize_objfiles): New.
* linespec.c (decode_all_digits, decode_dollar): Set the sal's
program space.
* source.c (current_source_pspace): New.
(get_current_source_symtab_and_line): Set the sal's program space.
(set_current_source_symtab_and_line): Set current_source_pspace.
(select_source_symtab): Ditto. Use ALL_OBJFILES.
(forget_cached_source_info): Iterate over all program spaces.
* symfile.c (clear_symtab_users): Adjust.
* symmisc.c (print_symbol_bcache_statistics): Iterate over all
program spaces.
(print_objfile_statistics): Ditto.
(maintenance_print_msymbols): Ditto.
(maintenance_print_objfiles): Ditto.
(maintenance_info_symtabs): Ditto.
(maintenance_info_psymtabs): Ditto.
* symtab.h (SYMTAB_PSPACE): New.
(struct symtab_and_line) <pspace>: New field.
* symtab.c (init_sal): Clear the sal's program space.
(find_pc_sect_symtab): Set the sal's program space. Switch thread
and space.
(append_expanded_sal): Add program space argument. Iterate over
all program spaces.
(expand_line_sal): Iterate over all program spaces. Switch
program space.
* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
(struct target_ops) <to_thread_address_space>: New field.
(target_thread_address_space): Define.
* target.c (target_detach): Only remove breakpoints from the
inferior we're detaching.
(target_thread_address_space): New.
* defs.h (initialize_progspace): Declare.
* top.c (gdb_init): Call it.
* solist.h (struct so_list) <sspace>: New field.
* solib.h (struct program_space): Forward declare.
(solib_name_from_address): Adjust prototype.
* solib.c (so_list_head): Replace with a macro referencing the
program space.
(update_solib_list): Set the so's program space.
(solib_name_from_address): Add a program space argument and adjust.
* solib-svr4.c (struct svr4_info) <pid>: Delete field.
<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
<interp_plt_sect_high>: New fields.
(svr4_info_p, svr4_info): Delete.
(solib_svr4_sspace_data): New.
(get_svr4_info): Rewrite.
(svr4_sspace_data_cleanup): New.
(open_symbol_file_object): Adjust.
(svr4_default_sos): Adjust.
(svr4_fetch_objfile_link_map): Adjust.
(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
(interp_plt_sect_high): Delete.
(svr4_in_dynsym_resolve_code): Adjust.
(enable_break): Adjust.
(svr4_clear_solib): Revert bit that removed the svr4_info here,
and reinstate clearing debug_base, debug_loader_offset_p,
debug_loader_offset and debug_loader_name.
(_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't
install an inferior_exit observer anymore.
* printcmd.c (struct display) <pspace>: New field.
(display_command): Set the display's sspace.
(do_one_display): Match the display's sspace.
(display_uses_solib_p): Ditto.
* linux-fork.c (detach_fork): Moved to infrun.c.
(_initialize_linux_fork): Moved "detach-on-fork" command to
infrun.c.
* infrun.c (detach_fork): Moved from linux-fork.c.
(proceed_after_vfork_done): New.
(handle_vfork_child_exec_or_exit): New.
(follow_exec_mode_replace, follow_exec_mode_keep)
(follow_exec_mode_names, follow_exec_mode_string)
(show_follow_exec_mode_string): New.
(follow_exec): New. Reinstate the mark_breakpoints_out call.
Remove shared libraries before attaching new executable. If user
wants to keep the inferior, keep it.
(displaced_step_fixup): Adjust to pass an address space to the
breakpoints module.
(resume): Ditto.
(clear_proceed_status): In all-stop mode, always clear the proceed
status of all threads.
(prepare_to_proceed): Adjust to pass an address space to the
breakpoints module.
(proceed): Ditto.
(adjust_pc_after_break): Ditto.
(handle_inferior_event): When handling a process exit, switch the
program space to the inferior's that had exited. Call
handle_vfork_child_exec_or_exit. Adjust to pass an address space
to the breakpoints module. In non-stop mode, when following a
fork and detach-fork is off, also resume the other branch. Handle
TARGET_WAITKIND_VFORK_DONE. Set the program space in sals.
(normal_stop): Prune inferiors.
(_initialize_infrun): Install the new "follow-exec-mode" command.
"detach-on-fork" moved here.
* regcache.h (get_regcache_aspace): Declare.
* regcache.c (struct regcache) <aspace>: New field.
(regcache_xmalloc): Clear the aspace.
(get_regcache_aspace): New.
(regcache_cpy): Copy the aspace field.
(regcache_cpy_no_passthrough): Ditto.
(get_thread_regcache): Fetch the thread's address space from the
target, and store it in the regcache.
* infcall.c (call_function_by_hand): Set the sal's pspace.
* arch-utils.c (default_has_shared_address_space): New.
* arch-utils.h (default_has_shared_address_space): Declare.
* gdbarch.sh (has_shared_address_space): New.
* gdbarch.h, gdbarch.c: Regenerate.
* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
(linux_has_shared_address_space): New.
(_initialize_linux_tdep): Declare.
* arm-tdep.c (arm_software_single_step): Pass the frame's address
space to insert_single_step_breakpoint.
* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
frame's pspace to breakpoint functions.
* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
(cris_software_single_step): Ditto.
* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
Pass the frame's pspace to breakpoint functions.
(mips_software_single_step): Adjust.
(mips_single_step_through_delay): Adjust.
* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
* solib-irix.c (enable_break): Adjust to pass the current frame's
address space to breakpoint functions.
* sparc-tdep.c (sparc_software_single_step): Ditto.
* spu-tdep.c (spu_software_single_step): Ditto.
* alpha-tdep.c (alpha_software_single_step): Ditto.
* record.c (record_wait): Adjust to pass an address space to the
breakpoints module.
* fork-child.c (fork_inferior): Set the new inferior's program and
address spaces.
* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
and address spaces.
(inf_ptrace_attach): Set the inferior's program and address spaces.
* linux-nat.c: Include "solib.h".
(linux_child_follow_fork): Manage parent and child's program and
address spaces. Clone the parent's program space if necessary.
Don't wait for the vfork to be done here. Refuse to resume if
following the vfork parent while leaving the child stopped.
(resume_callback): Don't resume a vfork parent.
(linux_nat_resume): Also check for pending events in the
lp->waitstatus field.
(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
events to the core.
(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
(cancel_breakpoint): Adjust.
* linux-thread-db.c (thread_db_wait): Don't remove thread event
breakpoints here.
(thread_db_mourn_inferior): Don't mark breakpoints out here.
Remove thread event breakpoints after mourning.
* corelow.c: Include progspace.h.
(core_open): Set the inferior's program and address spaces.
* remote.c (remote_add_inferior): Set the new inferior's program
and address spaces.
(remote_start_remote): Update address spaces.
(extended_remote_create_inferior_1): Don't init the thread list if
we already debugging other inferiors.
* darwin-nat.c (darwin_attach): Set the new inferior's program and
address spaces.
* gnu-nat.c (gnu_attach): Ditto.
* go32-nat.c (go32_create_inferior): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
* monitor.c (monitor_open): Ditto.
* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
* procfs.c (do_attach): Ditto.
* windows-nat.c (do_initial_windows_stuff): Ditto.
* inflow.c (inferior_process_group)
(terminal_init_inferior_with_pgrp, terminal_inferior,
(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
to use per-inferior data instead of inferior->terminal_info.
(inflow_inferior_data): New.
(inflow_new_inferior): Delete.
(inflow_inferior_data_cleanup): New.
(get_inflow_inferior_data): New.
* mi/mi-interp.c (mi_new_inferior): Rename to...
(mi_inferior_appeared): ... this.
(mi_interpreter_init): Adjust.
* tui/tui-disasm.c: Include "progspace.h".
(tui_set_disassem_content): Pass an address space to
breakpoint_here_p.
* NEWS: Mention multi-program debugging support. Mention new
commands "add-inferior", "clone-inferior", "remove-inferior",
"maint info program-spaces", and new option "set
follow-exec-mode".
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* observer.texi (new_inferior): Rename to...
(inferior_appeared): ... this.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/testsuite/
* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
* gdb.base/foll-exec.exp: Adjust to expect a process id before
"Executing new program".
* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
* gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being
left listed after having been killed.
* gdb.base/attach.exp: Adjust to spell out "symbol-file".
* gdb.base/maint.exp: Adjust test.
* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
* gdb.multi/Makefile.in: New.
* gdb.multi/base.exp: New.
* gdb.multi/goodbye.c: New.
* gdb.multi/hangout.c: New.
* gdb.multi/hello.c: New.
* gdb.multi/bkpt-multi-exec.c: New.
* gdb.multi/bkpt-multi-exec.exp: New.
* gdb.multi/crashme.c: New.
2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs <stan@codesourcery.com>
gdb/doc/
* gdb.texinfo (Inferiors): Rename node to ...
(Inferiors and Programs): ... this. Mention running multiple
programs in the same debug session.
<info inferiors>: Mention the new 'Executable' column if "info
inferiors". Update examples. Document the "add-inferior",
"clone-inferior", "remove-inferior" and "maint info
program-spaces" commands.
(Process): Rename node to...
(Forks): ... this. Document "set|show follow-exec-mode".
* NEWS: Document inlined function support.
* Makefile.in (SFILES): Add inline-frame.c.
(COMMON_OBS): Add inline-frame.o.
* block.c (contained_in): Rewrite to use lexical nesting.
(block_linkage_function): Skip inlined function blocks.
(block_inlined_p): New.
* block.h (struct block): Update comment.
(block_inlined_p): New prototype.
* blockframe.c (get_frame_block): Handle inlined functions.
(get_frame_function): Do not use block_linkage_function.
(block_innermost_frame): Use get_frame_block and contained_in.
* breakpoint.c (watchpoint_check): Remove extra reinit_frame_cache.
Skip over inlined functions. Simplify epilogue check.
(bpstat_check_breakpoint_conditions): Use get_stack_frame_id.
Update comments.
(set_momentary_breakpoint): Only accept non-inlined frames.
(watch_command_1): Use frame_unwind_caller_pc and
frame_unwind_caller_id instead of get_prev_frame.
(until_break_command): Likewise. Use get_stack_frame_id.
* buildsym.c (end_symtab): Set SYMBOL_SYMTAB for block functions.
* dwarf2loc.c (dwarf_expr_frame_base): Use block_linkage_function.
* dwarf2read.c (process_die): Handle DW_TAG_inlined_subroutine.
(read_func_scope, new_symbol): Likewise. Handle arguments specially
for inlined functions without call site information.
(inherit_abstract_dies): Allow tag mismatch for inlined subroutines.
(die_specification): Treat DW_AT_abstract_origin as a specification.
(read_type_die): Handle DW_TAG_inlined_subroutine.
* frame-unwind.c (frame_unwind_init): Add inline_frame_unwind.
* frame.c (fprint_frame_id): Print inline depth.
(fprint_frame_type): Handle INLINE_FRAME and SENTINEL_FRAME.
(skip_inlined_frames, get_stack_frame_id): New.
(frame_unwind_caller_id): Use skip_inlined_frames.
(frame_id_inlined_p): New.
(frame_id_eq): Make the logic match the comments. Add inline_depth
check.
(frame_id_inner): Handle inlined functions.
(frame_unwind_pc): New function, copied from frame_unwind_caller_pc.
(frame_unwind_caller_pc): Use skip_inlined_frames and frame_unwind_pc.
(get_prev_frame_1): Check for inline frames. Split out frame
allocation to get_prev_frame_raw.
(get_prev_frame_raw): New function.
(get_prev_frame): Handle inline frames.
(get_frame_pc): Use frame_unwind_pc.
(get_frame_address_in_block): Skip inlined frames on both sides.
(pc_notcurrent): Delete.
(find_frame_sal): Rewrite to handle inline call sites. Use
get_frame_address_in_block.
(deprecated_update_frame_pc_hack): Make static.
* frame.h: Update comments.
(struct frame_id): Add inline_depth.
(enum frame_type): Add INLINE_FRAME.
(frame_id_inlined_p, get_stack_frame_id): New prototypes.
* gdbthread.h (struct thread_info): Add step_stack_frame_id field.
* infcmd.c (set_step_frame): New function.
(step_once): Use set_step_frame. Handle inlined functions.
(until_next_command): Use set_step_frame.
(finish_backward), finish_forward): Use get_stack_frame_id.
(finish_command): Support inlined functions.
* inferior.h (set_step_info): New prototype.
* infrun.c (RESUME_ALL): Use minus_one_ptid.
(clear_proceed_status): Clear step_stack_frame_id.
(init_wait_for_inferior): Call clear_inline_frame_state.
(init_execution_control_state): Make static.
(set_step_info): New function.
(init_thread_stepping_state): Do not set the symtab or line here.
(stepped_in_from): New function.
(handle_inferior_event): Handle inlined functions. Use set_step_info.
(insert_step_resume_breakpoint_at_frame): Use get_stack_frame_id.
(struct inferior_status): Add step_stack_frame_id.
(save_inferior_status, restore_inferior_status): Save and restore
step_stack_frame_id.
* inline-frame.c, inline-frame.h: New files.
* minsyms.c (prim_record_minimal_symbol_and_info): Use XCALLOC.
* regcache.c (regcache_write_pc): Call reinit_frame_cache.
* s390-tdep.c (s390_prologue_frame_unwind_cache): Handle INLINE_FRAME.
* stack.c (frame_show_address): New.
(print_frame_info, print_frame): Use it.
(find_frame_funname): Use get_frame_function. Handle inlined blocks.
(frame_info): Mark inlined functions.
(backtrace_command_1): Use get_current_user_frame.
(print_frame_local_vars, print_frame_label_vars): Update comments.
(return_command): Refuse inlined functions.
* symtab.c (lookup_symbol_aux_local): Stop at inlined function
boundaries.
(find_function_start_sal): Avoid inlined functions.
(completion_list_add_fields): New function.
(default_make_symbol_completion_list): Use it. Use block_static_block
and block_global_block. Check for inlined functions.
(skip_prologue_using_sal): Avoid line number comparison across
inlining.
* symtab.h (struct symbol): Add is_inlined.
(SYMBOL_INLINED): New.
* target.c (target_resume): Call clear_inline_frame_state.
* valops.c (value_of_variable): Check block_inlined_p.
gdb/doc/
* gdb.texinfo (Debugging Optimized Code): New chapter.
(Compiling for Debugging): Reference it. Move some
text to the new section.
gdb/testsuite/
* gdb.base/break.exp: Add an XFAIL for gcc/36748.
* gdb.cp/annota2.exp: Accept frames-invalid in more places.
* gdb.opt/Makefile.in (EXECUTABLES): Update.
* gdb.opt/clobbered-registers-O2.exp: Update to GPL v3.
* gdb.opt/inline-bt.c, gdb.opt/inline-bt.exp,
gdb.opt/inline-cmds.c, gdb.opt/inline-cmds.exp,
gdb.opt/inline-locals.c, gdb.opt/inline-locals.exp,
gdb.opt/inline-markers.c: New files.
* lib/gdb.exp (skip_inline_frame_tests): New function.
(skip_inline_var_tests): New function.
* dwarf2read.c
(new_symbol <DW_TAG_variable> <!DW_AT_location> <DW_AT_external>):
Create the symbol in local scope.
* symtab.h (cu->list_in_scope <LOC_UNRESOLVED>): New comment part.
gdb/testsuite/
* gdb.dwarf2/dw2-unresolved-main.c, gdb.dwarf2/dw2-unresolved.S,
gdb.dwarf2/dw2-unresolved.exp: New.
cp_scan_for_anonymous_namespaces here.
(finish_block): Do not call cp_set_block_scope here.
* cp-namespace.c (processing_has_namespace_info)
(processing_current_prefix): Delete.
(cp_initialize_namespace): Do not initialize
processing_has_namespace_info.
(cp_scan_for_anonymous_namespaces): Use SYMBOL_DEMANGLED_NAME. Do
not check processing_has_namespace_info.
(cp_set_block_scope): Take prefix and namespace info flag as
arguments. Honor namespaces regardless of a demangled name.
* cp-support.h (processing_has_namespace_info)
(processing_current_prefix): Delete declarations.
(cp_set_block_scope): Update prototype.
* dwarf2read.c (processing_has_namespace_info)
(processing_current_prefix): New static variables.
(read_file_scope): Initialize processing_has_namespace_info.
(read_func_scope): Call cp_set_block_scope for C++.
(new_symbol): Call cp_scan_for_anonymous_namespaces for C++.
* symtab.c (symbol_demangled_name): Accept a const argument.
* symtab.h (symbol_demangled_name): Update prototype.
* blockframe.c (find_pc_partial_function): Likewise.
* buildsym.c (find_symbol_in_list): Likewise.
* c-valprint.c (c_val_print): Likewise.
* coffread.c (patch_opaque_types, process_coff_symbol): Likewise.
(coff_read_enum_type): Likewise. Use SYMBOL_SET_LINKAGE_NAME.
* cp-support.c (cp_remove_params): Renamed from remove_params and
made global.
(overload_list_add_symbol): Update call to remove_params.
* cp-support.h (cp_remove_params): Declare.
* dwarf2read.c (process_enumeration_scope): Use SYMBOL_LINKAGE_NAME.
(dwarf2_const_value): Use SYMBOL_PRINT_NAME.
* expprint.c (dump_subexp_body_standard): Likewise.
* f-valprint.c (info_common_command, there_is_a_visible_common_named):
Use SYMBOL_LINKAGE_NAME to find symbols and SYMBOL_PRINT_NAME
for messages.
* findvar.c (read_var_value): Use SYMBOL_LINKAGE_NAME.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise.
* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline)
(hppa_hpux_skip_trampoline_code): Use SYMBOL_LINKAGE_NAME to find
symbols and SYMBOL_PRINT_NAME for messages.
* jv-lang.c (add_class_symbol): Use SYMBOL_SET_LINKAGE_NAME.
* linespec.c (decode_line_2): Use SYMBOL_LINKAGE_NAME.
* mdebugread.c (parse_symbol): Use SYMBOL_LINKAGE_NAME and
SYMBOL_SET_LINKAGE_NAME.
(mylookup_symbol): Use SYMBOL_LINKAGE_NAME.
* minsyms.c (add_minsym_to_demangled_hash_table): Use
SYMBOL_SEARCH_NAME.
(lookup_minimal_symbol): Use SYMBOL_LINKAGE_NAME or
SYMBOL_MATCHES_SEARCH_NAME, depending on the pass.
* objfiles.h (ALL_OBJFILE_MSYMBOLS): Use SYMBOL_LINKAGE_NAME.
* printcmd.c (build_address_symbolic): Use SYMBOL_LINKAGE_NAME.
(address_info): Use SYMBOL_PRINT_NAME for messages and
SYMBOL_LINKAGE_NAME for lookups.
* sol-thread.c (info_cb): Use SYMBOL_PRINT_NAME for messages.
* stabsread.c (patch_block_stabs, define_symbol)
(read_type, read_enum_type, common_block_end)
(cleanup_undefined_types_1, scan_file_globals): Use
SYMBOL_LINKAGE_NAME, SYMBOL_SET_LINKAGE_NAME, ALL_OBJFILE_MSYMBOLS,
and SYMBOL_PRINT_NAME.
* stack.c (print_frame_args): Use SYMBOL_LINKAGE_NAME.
(print_frame, frame_info): Use SYMBOL_PRINT_NAME for output. Use
cp_remove_params instead of cplus_demangle.
(print_block_frame_labels, print_frame_arg_vars): Use
SYMBOL_LINKAGE_NAME.
* symmisc.c (dump_msymbols): Use ALL_OBJFILE_MSYMBOLS and
SYMBOL_LINKAGE_NAME.
(dump_symtab_1, print_symbol, print_partial_symbols)
(maintenance_check_symtabs): Use SYMBOL_LINKAGE_NAME.
* symtab.h (DEPRECATED_SYMBOL_NAME): Delete.
(SYMBOL_SET_LINKAGE_NAME): New.
(SYMBOL_SET_NAMES): Add a comment.
* tracepoint.c (set_traceframe_context, validate_actionline)
(collect_symbol, scope_info): Use SYMBOL_LINKAGE_NAME for
lookups and SYMBOL_PRINT_NAME for output.
* typeprint.c (typedef_print): Use SYMBOL_LINKAGE_NAME.
* xcoffread.c (process_xcoff_symbol): Use SYMBOL_SET_LINKAGE_NAME.
2008-05-15 Pedro Alves <pedro@codesourcery.com>
Ulrich Weigand <uweigand@de.ibm.com>
* minsyms.c (lookup_minimal_symbol_by_pc_name): New function.
* symtab.h (lookup_minimal_symbol_by_pc_name): Add prototype.
* symtab.c (fixup_section): Remove prototype. Add ADDR parameter;
use it instead of ginfo->value.address. Look up minimal symbol by
address and name. Assume OBJFILE is non-NULL.
(fixup_symbol_section): Ensure we always have an objfile to look
into. Extract and pass to fixup_section the symbol's address that
will match the minimal symbol's address.
(fixup_psymbol_section): Likewise.
(find_pc_sect_psymtab): Fall back to non-addrmap case when debugging
overlays and the addrmap returned the wrong section.
* dwarf2read.c (var_decode_location): Set SYMBOL_CLASS before
calling fixup_symbol_section.
gdb/testsuite/
2008-05-15 Pedro Alves <pedro@codesourcery.com>
* gdb.base/fixsection.exp: New file.
* gdb.base/fixsection0.c: New file.
* gdb.base/fixsection1.c: New file.
instead of matching the symbol domain explictly.
* dwarf2read.c (add_partial_symbol): Do not add new psym for
STRUCT_DOMAIN. Make sure you recognize c++ struct and java and ada
class as typedefs. See lookup_partial_symbol function.
(new_symbol): Similar to add_partial_symbol, do not create
symbol for the typedef. See lookup_block_symbol.
* symtab.c (symbol_matches_domain): New function, takes care
of dual meaning of STRUCT_DOMAIN symbol for c++, ada and java.
(lookup_partial_symbol): Use symbol_matches_domain to see if the
found psym domain matches the given domain.
(lookup_block_symbol): Likewise.
(minsym_found): Handle minimal symbols pointing to function
descriptors. Use find_function_start_pc.
* minsyms.c (msymbol_objfile): New function.
* parse.c (write_exp_msymbol): Handle minimal symbols pointing
to function descriptors.
* symtab.c (fixup_section): Only use minimal symbol at the same
address to determine section of a symbol.
(find_function_start_pc): New function.
(find_function_start_sal): Use it.
* symtab.h (msymbol_objfile): Add prototype.
(find_function_start_pc): Likewise.
* value.c: Include "objfiles.h".
(value_fn_field): Handle minimal symbols pointing to function
descriptors.
* Makefile.in (linespec.o): Update dependencies.
(value.o): Likewise.
Daniel Jacobowitz <dan@codesourcery.com>
* buildsym.c (end_symtab): Use preallocated symtab if available.
Fill in SYMBOL_SYMTAB.
* buildsym.h (struct subfile): Add symtab member.
* dwarf2read.c (struct dwarf2_cu): Add line_header.
(struct file_entry): Add symtab.
(free_cu_line_header): New function.
(read_file_scope): Use it. Save line_header in the cu. Process
lines before DIEs.
(add_file_name): Initialize new symtab member.
(dwarf_decode_lines): Create symtabs for included files.
(new_symbol): Set SYMBOL_SYMTAB.
* symtab.c (lookup_symbol): Use SYMBOL_SYMTAB.
(search_symbols): Likewise.
* symtab.h (struct symbol): Add symtab member.
(SYMBOL_SYMTAB): Define.
* gdb.base/included.c, gdb.base/included.exp,
gdb.base/included.h: New files.
(record_producer): New function.
* buildsym.h (struct subfile): Include producer.
(record_producer): New prototype.
* dwarf2-frame.c (struct dwarf2_cie): Add version and augmentation.
(struct dwarf2_frame_state): Add armcc_cfa_offsets_sf and
armcc_cfa_offsets_reversed.
(execute_cfa_program): Handle armcc_cfa_offsets_sf.
(dwarf2_frame_find_quirks): New function.
(dwarf2_frame_cache): Call it. Handle armcc_cfa_offsets_reversed.
(decode_frame_entry_1): Record the CIE version. Record the
augmentation. Skip armcc augmentations.
* dwarf2read.c (read_file_scope): Save the producer.
* symtab.h (struct symtab): Rename unused version member to
producer.
2006-01-17 Jim Blandy <jimb@redhat.com>
* symtab.h (struct general_symbol_info): Use gdb_byte for
value.bytes.
* stabsread.c (define_symbol): Use gdb_byte for the buffer holding
a floating-point constant's value.
* dwarf2read.c (dwarf2_const_value): Remove casts of value buffer
to char *.
* findvar.c (read_var_value): Eliminate needless temporary.
(SYMBOL_MATCHES_SEARCH_NAME): New definition.
(symbol_search_name): Declare.
* dictionary.c (iter_name_first_hashed): Match on SYMBOL_SEARCH_NAME.
(iter_name_next_hashed): Ditto.
(iter_name_next_linear): Ditto.
(insert_symbol_hashed): Hash on SYMBOL_SEARCH_NAME.
* symtab.c (lookup_partial_symbol): Assume symbols ordered by
search name, using SYMBOL_SEARCH_NAME and SYMBOL_MATCHES_SEARCH_NAME.
(symbol_search_name): New function.
* symfile.c (compare_psymbols): Order by SYMBOL_SEARCH_NAME.
* minsyms.c (build_minimal_symbol_hash_tables): Change
test for adding to demangled hash table to check for difference
between SYMBOL_SEARCH_NAME and SYMBOL_LINKAGE_NAME.
* symtab.h (find_pc_sect_partial_function): Delete declaration.
* blockframe.c (find_pc_partial_function)
(find_pc_sect_partial_function): Merge into a single
find_pc_partial_function.
* findvar.c (read_var_value): Remove case for thread local storage
variables. It is now entirely handled by the dwarf2 location
expression code.
* printcmd.c (address_info): Ditto.
* symtab.h (address_class): Remove LOC_THREAD_LOCAL_STATIC
enumeration value.
(struct symbol): Remove objfile field, which was used by
LOC_THREAD_LOCAL_STATIC only.
* dwarf2read.c (decode_locdesc): Remove is_thread_local variable.
* dwarf2loc.h (struct dwarf2_loclist_baton): Add comment about
usage of objfile pointer.
* dwarf2loc.c (locexpr_describe_location): Add case to handle
thread local variables.
Add include of objfiles.h.
* dwarf2expr.c (execute_stack_op): Add comments about thread local
storage variables.
* Makefile.in (dwarf2loc.o): Update dependencies.
* dictionary.h: New.
* dictionary.c: New.
* block.h: Add opaque declaration for struct dictionary.
(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
'sym' members.
(BLOCK_DICT): New macro.
Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
BLOCK_SHOULD_SORT.
(ALL_BLOCK_SYMBOLS): Update definition.
* Makefile.in (SFILES): Add dictionary.c.
(dictionary_h): New.
(COMMON_OBS): Add dictionary.o.
(dictionary.o): New.
(ada-lang.o): Depend on dictionary_h.
(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
(mi-cmd-stack.o): Ditto.
(gdbtk-cmds.o): Update dependencies.
(gdbtk-stack.o): Ditto.
* ada-lang.c: Include dictionary.h.
(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
(fill_in_ada_prototype, debug_print_block): Ditto.
(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable
'is_sorted'.
* mdebugread.c: Include dictionary.h.
(struct parse_stack): Delete 'maxsyms' member.
(parse_symbol): Update calls to new_block. Delete calls to
shrink_block. Use dictionary methods.
(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
Update calls to new_symtab. Don't maintain maxsyms data.
(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
(add_symbol): Just call dict_add_symbol.
(new_symtab): Delete 'maxsyms' argument.
(new_symtab): Update calls to new_block.
(new_block): Delete 'maxsyms' argument; add 'function' argument.
(shrink_block): Delete function.
(fixup_sigtramp): Update call to new_block. Add symbol via
dict_add_symbol.
* jv-lang.c: Include dictionary.h.
(get_java_class_symtab): Set the BLOCK_DICT of the blocks
appropriately. Set class_symtab->free_func. Make sure the
blockvector is big enough to hold two blocks.
(add_class_symtab_symbol): Use dictionary methods.
(free_class_block): New function.
(type_from_class): Replace explicit iteration by
ALL_BLOCK_SYMBOLS.
* symtab.h (struct symtab): Replace 'free_ptr' method by
'free_func'.
* dwarf2read.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* dwarfread.c (psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
Include dictionary.h.
(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
sort_symtab_syms.
* objfiles.c: Include dictionary.h.
(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
* buildsym.c: Include dictionary.h.
(finish_block): Use dictionary methods.
(end_symtab): Set free_func to NULL, not free_ptr.
* tracepoint.c: Include dictionary.h.
(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
(scope_info): Ditto.
* stack.c: Include dictionary.h.
(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
(print_block_frame_labels, print_frame_arg_vars)
(print_frame_args): Ditto.
* symmisc.c (free_symtab_block): Use dictionary methods.
(dump_symtab): Ditto.
(free_symtab): Replace use of 'free_ptr' by 'free_func'.
Include dictionary.h.
* symfile.h: Delete declarations of sort_block_syms,
sort_symtab_syms.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Delete.
* symtab.c: Include dictionary.h.
(lookup_block_symbol): Use dictionary iterators.
(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
(search_symbols, make_symbol_completion_list): Ditto.
(make_symbol_overload_list): Ditto.
* valops.c (value_of_local): Use dict_empty.
Include dictionary.h.
2003-06-11 David Carlton <carlton@bactrian.org>
* generic/gdbtk-stack.c: Include dictionary.h.
(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
(gdb_get_blocks, gdb_get_vars_command): Ditto.
* generic/gdbtk-cmds.c: Include dictionary.h.
(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.
2003-06-11 David Carlton <carlton@bactrian.org>
* mi-cmd-stack.c: Include dictionary.h.
(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
Rename commands 'maint list symtabs' and 'maint list psymtabs' to
'maint info symtabs' and 'maint info psymtabs'.
* symmisc.c (maintenance_info_symtabs, maintenance_info_psymtabs):
Renamed from maintenance_list_symtabs and maintenance_list_psymtabs.
* symtab.h (maintenance_info_symtabs, maintenance_info_psymtabs):
Declarations updated.
* maint.c (maintenance_list_command): Delete.
(_initialize_maint_cmds): Update calls to add_cmd.
* gdbcmd.h (maintenancelistlist): Delete declaration.
* cli/cli-cmds.c (maintenancelistlist): Delete.
(init_cmd_lists): Don't initialize it.
* cli/cli-cmds.h (maintenancelistlist): Delete declaration.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Update documentation: 'maint list
symtabs' and 'maint list psymtabs' have been renamed 'maint info
symtabs' and 'maint info psymtabs'.
* symtab.c (symbol_set_names): Rename 'name' arg to
'linkage_name', and 'tmpname' variable to 'linkage_name_copy'.
* symtab.h: Change 'name' argument in declaration of
symbol_set_names to 'linkage_name'.
(SYMBOL_SET_NAMES): Change 'name' argument to 'linkage_name'.
2003-04-10 Jim Blandy <jimb@redhat.com>
* symmisc.c: #include "gdb_regex.h".
(maintenance_list_symtabs, maintenance_list_psymtabs): New
functions.
* maint.c (maintenance_list_command): New function.
(_initialize_maint_cmds): Register the above as commands.
* symtab.h (maintenance_list_symtabs,
maintenance_list_psymtabs): New declarations.
* cli/cli-cmds.c (maintenancelistlist): New variable.
(init_cmd_lists): Initialize it.
* cli/cli-cmds.h (maintenancelistlist): New declaration.
* gdbcmd.h (maintenancelistlist): New declaration.
* Makefile.in (symmisc.o): Update dependencies.
gdb/doc/ChangeLog:
2003-04-09 Jim Blandy <jimb@redhat.com>
* gdb.texinfo (Symbols): Document 'maint list symtabs' and 'maint
list psymtabs'.
* utils.c (streq): New function.
* dwarf2read.c (new_symbol): Use SYMBOL_SET_NAMES instead of
SYMBOL_NAME and SYMBOL_INIT_DEMANGLED_NAME.
* mdebugread.c (new_symbol): Likewise.
* stabsread.c (define_symbol): Likewise.
* coffread.c (process_coff_symbol): Likewise.
* dwarfread.c (new_symbol): Likewise.
* minsyms.c (prim_record_minimal_symbol_and_info): Use
SYMBOL_SET_NAMES instead of setting SYMBOL_NAME. Set the language
here.
(install_minimal_symbols): Don't set SYMBOL_LANGUAGE or call
SYMBOL_INIT_DEMANGLED_NAME.
* objfiles.c: Include "hashtab.h".
(allocate_objfile): Call htab_set_functions_ex for the
demangled_names_hash.
(free_objfile): Call htab_delete for the demangled_names_hash.
* objfiles.h (struct htab): Add declaration.
(struct objfile): Add demangled_names_hash.
* symfile.c: Include "hashtab.h".
(reread_symbols): Call htab_delete for the demangled_names_hash.
(add_psymbol_to_list): Use SYMBOL_SET_NAMES instead of putting
SYMBOL_NAME in the bcache.
* symtab.c: Include "hashtab.h". Update comments.
(create_demangled_names_hash, symbol_set_names): New functions.
(symbol_find_demangled_name): New function, broken out from
symbol_init_demangled_names.
(symbol_init_demangled_names): Use it.
* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Add missing parentheses.
(SYMBOL_SET_NAMES): New macro.
(symbol_set_names): Add prototype.
* symtab.c (symbol_demangled_name): New function.
* symtab.h (SYMBOL_DEMANGLED_NAME): Simplify macro, by
turning most of it into a function.
(symbol_demangled_name): Export.
* symtab.c (symbol_init_language_specific): New function.
* symtab.h (SYMBOL_INIT_LANGUAGE_SPECIFIC): Simplify macro, by
turning most of it into a function.
(symbol_init_language_specific): Export.
Elena Zannoni <ezannoni@redhat.com>
* symtab.h (address_class): Re-add LOC_THREAD_LOCAL_STATIC
for thread local storage locations.
(struct symbol): Add objfile field.
(SYMBOL_OBJFILE): Define.
* dwarf2read.c (is_thread_local): New static variable.
(new_symbol): If variable is in thread local fill in address class
and objfile appropriately.
(decode_locdesc): Recognize and handle DW_OP_GNU_push_tls_address
stack operation.
* printcmd.c (address_info): Print the information for thread
local storage variable.
* findvar.c (read_var_value): In case of thread local variable,
defer to the target vector code to compute address.
* symtab.h: Delete 'struct source' and 'struct sourcevector'.
(Also, I fixed up a date reference for an earlier ChangeLog entry of
mine; sorry about that.)
current_source_line static.
(list_command): Moved to cli/cli-cmds.c.
(ambiguous_line_spec): Moved to cli/cli-cmds.c.
(get_first_line_listed): New accessor function.
(get_lines_to_list): New accessor function.
(get_current_source_symtab_and_line): New function. Retrieves the
position in the source code that we consider current.
(get_current_or_default_source_symtab_and_line): New function.
Like the above but attempts to determine a default position if one
is not currently defined.
(set_current_source_symtab_and_line): New function. Sets the source
code position considered current and returns the previously set one.
(clear_current_source_symtab_and_line): Reset stored information about
a current source line.
(_initialize_source): Remove registration for the "list" command and
its alias.
* source.h: Add declarations for the new functions above.
* symtab.h: Remove declarations for the global variables mentioned
above.
* breakpoint.c (parse_breakpoint_sals): Use accessor functions to
obtain current source line.
* linespec.c (decode_line_1): Ditto.
* macroscope.c (default_macro_scope): Ditto.
* scm-lang.c (scm_unpac): Ditto.
* stack.c (print_frame_info_base): Ditto.
* symfile.c (clear_symtab_users): Ditto.
* symtab.c (decode_line_spec): Ditto.
* cli/cli-cmds.c (list_command): Moved here from source.c.
(ambiguous_line_spec): Moved here from source.c.
(_init_cli_cmds): Add definition for "list" and its alias.
* Makefile.in: Update dependencies.
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.
in them yet.
* symtab.h (struct symtab): New member: `macro_table'.
* buildsym.h (pending_macros): New global variable.
* buildsym.c: #include "macrotab.h".
(buildsym_init): Initialize `pending_macros'.
(end_symtab): If we found macro information while reading a CU's
debugging info, do build a symtab structure for it. Make the
symtab point to the macro information, and clear the
`pending_macros' pointer which held it while we were reading the
debug info.
(really_free_pendings): Free any pending macro table.
* objfiles.h (struct objfile): New member: `macro_cache'.
* objfiles.c (allocate_objfile): Set allocate and free functions
for the macro cache's objstack.
(free_objfile): Empty the macro cache's obstack.
* symfile.c (reread_symbols): Empty the macro cache's obstack, and
set new allocate and free functions for it.
* solib-sunos.c (allocate_rt_common_objfile): Set allocate and
free functions for the macro cache's objstack. (Why is this
function building its own objfile?)
* symmisc.c (print_objfile_statistics): Print statistics on the
macro bcache.
* Makefile.in: Note that buildsym.o depends on macrotab.h.
* symtab.h (find_stab_function_addr): Kill extern.
* minsyms.c (find_stab_function_addr): Remove from here...
* dbxread.c: ... to here, and mark it static.
a function; leave this macro here to invoke that function.
(symbol_init_mangled_name): Declaration for that function.
* symtab.c (symbol_init_mangled_name): New function.
* symtab.h (lookup_block_symbol): Add mangled_name argument
to prototype.
* symmisc.c (maintenance_check_symtabs): Call lookup_block_symbol
with new mangled_name argument.
* linespec.c (decode_line_1): Likewise.
* valops (value_of_this): Likewise.
* symtab.c (lookup_transparent_type): Likewise.
(lookup_symbol_aux): Likewise. Accept new mangled_name argument.
(lookup_symbol): If we are given a mangled name, pass it down
to lookup_symbol_aux.
(lookup_block_symbol): If we are given a mangled name to check
against, only return symbols which match it.
2002-02-21 Fred Fish <fnf@redhat.com>
* dbxread.c (process_one_symbol): When finding an N_FUN symbol
that marks the end of the range of a function, enter a line number
entry that has a line number of zero and a PC offset that matches
the end of the function. This starts a range of PC's for which no
line number information is known.
* symtab.c (find_pc_sect_line): If our best fit is in a range of
PC's for which no line number info is found (line number is zero)
then we didn't find any valid line information.
* symtab.h: Document use of zero line number entry.
* configure.in: Check for realpath.
* defs.h (gdb_realpath): Declare.
* symtab.h (partial_symtab): Added fullname field.
* source.c (openp): Use gdb_realpath.
(forget_cached_source_info): Clear full name of each partial
symtab.
* utils.c (gdb_realpath): New function.
* symtab.c (lookup_symtab): Removed.
(lookup_symtab_1): Renamed to lookup_symtab.
(lookup_symtab): Look for real path.
(lookup_partial_symtab): Likewise.
(line_completion_function): If we are completing on locations,
back up the start of word pointer past all characters which can
appear in a location spec.
(location_completer): New function.
* completer.h: Add prototype for location_completer.
* symtab.c (make_source_files_completion_list)
(add_filename_to_list, not_interesting_fname): New functions.
(filename_seen): New function, body extracted from
output_source_filename.
(output_source_filename): Call filename_seen to check if the file
was already printed.
(make_symbol_completion_list): If TEXT includes a
double-quoted string, return an empty list, not NULL.
(make_file_symbol_completion_list): New function, similar to
make_symbol_completion_list but with an additional argument
SRCFILE.
* symtab.h (make_file_symbol_completion_list)
(make_source_files_completion_list): Add prototypes.
* breakpoint.c (_initialize_breakpoint): Make location_completer
be the completion function for all commands which set breakpoints
and watchpoints.
(top-level): #include "completer.h".
* tracepoint.c (_initialize_tracepoint): Make location_completer
be the completion function for the "trace" command.
(top-level): #include "completer.h".
* printcmd.c (_initialize_printcmd): Make location_completer be
the completion function for the "print", "inspect", "call", and
"disassemble" commands.
(top-level): #include "completer.h".
* infcmd.c (_initialize_infcmd): Make location_completer be the
completion function for the "go", "jump", and "until" commands.
(top-level): #include "completer.h".
Abstract out operations specific to particular C++ ABI's, and
invoke them through a function table. This removes the C++ ABI
dependencies scattered throughout the code, and allows us to
cleanly add support for new C++ ABI's.
* cp-abi.h, cp-abi.h, gnu-v2-abi.c, hpacc-abi.c: New files.
* c-typeprint.c, c-valprint.c, dbxread.c, eval.c, gdbtypes.c,
jv-typeprint.c, linespec.c, symtab.c, typeprint.c, valops.c:
#include "cp-abi.h". These files all use functions now declared
there.
* symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P):
Deleted. These services are now provided by functions declared in
cp-abi.h.
* value.h (value_rtti_type, value_virtual_fn_field): Same.
* values.c (value_virtual_fn_field): Same, for this definition.
* valops.c (value_rtti_type): Same.
* c-typeprint.c (c_type_print_base): Use the functions from
"cp-abi.h", instead of the old macros, or hard-coded ABI-specific
tests.
* dbxread.c (record_minimal_symbol): Same.
* gdbtypes.c (get_destructor_fn_field, virtual_base_index,
virtual_base_index_skip_primaries): Same.
* jv-typeprint.c (java_type_print_base): Same.
* linespec.c (find_methods, decode_line_1): Same.
* symtab.c (gdb_mangle_name): Same.
* Makefile.in (SFILES): Add the new .c files mentioned above.
(cp_abi_h): New variable.
(COMMON_OBS): Add gnu-v2-abi.o, hpacc-abi.o, and cp-abi.o.
(cp-abi.o, gnu-v2-abi.o, hpacc-abi.o): New targets.
(c-typeprint.o, c-valprint.o, dbxread.o, eval.o, gdbtypes.o,
jv-typeprint.o, symtab.o, linespec.o, typeprint.o, valops.o): Add
dependency on $(cp_abi_h).
From Daniel Berlin <dberlin@redhat.com> :
* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Initialize the symbol
language to auto instead of unknown, so it will try to demangle
the symbol.
* symtab.h (OPNAME_PREFIX_P): Change operator prefix to correct value.
* symtab.c (gdb_mangle_name): Properly handle C++ operators.
* objfiles.h (SECT_OFF_BSS): Don't detect invalid sect_index_bss
here, let the users of the macro do it.
* symtab.h (ANOFFSET): Detect here if the section index is not
initialized.
* xcoffread.c (find_targ_sec): Don't treat .bss as special,
because some objfiles may not have that section at all.
* coffread.c (cs_to_section): Ditto.
* elfread.c (elf_symtab_read): Detect an uninitialized index
value.
(elfstab_offset_sections): The macro ANOFFSET cannot be used as an
lvalue anymore.
* remote.c (get_offsets, remote_cisco_objfile_relocate): Don't use
ANOFFSET as an lvalue.
* objfiles.c (objfile_relocate, objfile_relocate): Don't use
ANOFFSET as an lvalue.
* symfile.c (default_symfile_offsets): Don't use ANOFFSET as an
lvalue.
* minsyms.c: #include <ctype.h>, for msymbol_hash_iw.
(compact_minimal_symbols): Added `objfile' argument.
Put symbols in the objfile's hash table.
(install_minimal_symbols): Put symbols in the objfile's demangled
hash table.
(lookup_minimal_symbol): Use hash table to find symbol in
objfile.
(msymbol_hash_iw, msymbol_hash, add_minsym_to_hash_table): New
functions.
(prim_record_minimal_symbol_and_info): Initialize the
hash link fields of the new minimal symbol.
* symtab.h (struct minimal_symbol): New fields `hash_next',
`demangled_hash_next'.
(msymbol_hash_iw, msymbol_hash, add_minsym_to_hash_table): Declare.
* objfiles.h (MINIMAL_SYMBOL_HASH_SIZE): New define.
(struct objfile): New fields `msymbol_hash',
`msymbol_demangled_hash'.