2009-02-06 22:59:01 +00:00
|
|
|
/* Target-dependent code for GNU/Linux, architecture independent.
|
|
|
|
|
2014-01-01 03:54:24 +00:00
|
|
|
Copyright (C) 2009-2014 Free Software Foundation, Inc.
|
2009-02-06 22:59:01 +00:00
|
|
|
|
|
|
|
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 3 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, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "gdbtypes.h"
|
2008-02-21 Pedro Alves <pedro@codesorcery.com>
Silence a few -Wmissing-prototypes warnings.
PR build/9877:
* amd64-nat.c: Include "amd64-nat.h".
* fork-child.c (_initialize_fork_child): Ditto.
* gcore.c (_initialize_gcore): Ditto.
* inf-ptrace.c: Include "inf-ptrace.h".
(inf_ptrace_store_registers): Make it static.
* linux-nat.c (linux_nat_terminal_ours): Make it static.
(_initialize_linux_nat): Declare before definition.
* linux-tdep.c: Include "linux-tdep.h".
* linux-thread-db.c (_initialize_thread_db): Declare before
definition.
* proc-service.c (_initialize_proc_service): Ditto.
* remote.c (remote_send_printf): Make it static.
* solib.c: Include "solib.h".
* symfile-mem.c (_initialize_symfile_mem): Declare before
definition.
* ada-lang.c (ada_la_decode, ada_match_name)
(ada_suppress_symbol_printing, ada_is_array_type)
(ada_value_ptr_subscript, ada_array_length)
(ada_to_static_fixed_value): Make them static.
(_initialize_ada_language): Declare before definition.
* ada-tasks.c (ada_get_task_number, ada_get_environment_task)
(ada_task_list_changed, ada_new_objfile_observer): Make them
static.
(_initialize_tasks): Declare before definition.
* addrmap.c (_initialize_addrmap): Declare before definition.
* auxv.c (default_auxv_parse): Make it static.
* bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make
them static.
* breakpoint.c (remove_sal): Add line break.
(expand_line_sal_maybe): Make it static.
* cp-name-parser.y: Include "cp-support.h".
* cp-valprint.c (cp_find_class_member): Make it static.
* eval.c (value_f90_subarray): Ditto.
* exceptions.c (print_any_exception): Ditto.
* findcmd.c (_initialize_mem_search): Declare before definition.
* frame.c (frame_observer_target_changed): Make it static.
* gnu-v3-abi.c (gnuv3_find_method_in): Make it static.
* inf-child.c: Include "inf-child.h".
* inferior.h (valid_inferior_id): Rename to ...
(valid_gdb_inferior_id): ... this.
* infrun.c (infrun_thread_stop_requested, siginfo_make_value):
Make them static.
* jv-lang.c (java_language_arch_info): Make it static.
* m2-typeprint.c (m2_get_discrete_bounds): Ditto.
* osdata.c (info_osdata_command): Make it static.
* regcache.c (regcache_observer_target_changed): Make it static.
* reverse.c (_initialize_reverse): Declare before definition.
* stabsread.c (cleanup_undefined_types_noname)
(cleanup_undefined_types_1): Make them static.
* symfile.c (place_section): Make it static.
* symtab.c (find_pc_sect_psymtab_closer): Make it static.
* target-descriptions.c (_initialize_target_descriptions): Declare
before definition.
* target.c (default_get_ada_task_ptid, find_default_can_async_p)
(find_default_is_async_p, find_default_supports_non_stop): Make
them static.
(target_supports_non_stop): Add prototype.
(dummy_pid_to_str): Make it static.
* utils.c (_initialize_utils): Declare before definition.
* ada-exp.y (_initialize_ada_exp): Declare before definition.
* solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype.
* target.h (struct target_ops): Add a prototype to the
to_can_execute_reverse callback.
* macroscope.c (_initialize_macroscope): Declare before definition.
* cp-namespace.c (_initialize_cp_namespace): Declare before definition.
* python/python.c (_initialize_python): Declare before definition.
* tui/tui-command.c: Include "tui/tui-command.h".
* tui/tui-data.c (init_content_element, init_win_info): Make them
static.
* tui/tui-disasm.c: Include "tui/tui-disasm.h".
* tui/tui-interp.c (_initialize_tui_interp): Declare before
definition.
* tui/tui-layout.c: Include "tui/tui-layout.h".
(_initialize_tui_layout): Declare before definition.
* tui/tui-regs.c: Include "tui/tui-regs.h".
(tui_display_reg_element_at_line): Make it static.
(_initialize_tui_regs): Declare before definition.
* tui/tui-stack.c (_initialize_tui_stack): Declare before
definition.
* tui/tui-win.c: Include "tui/tui-win.h".
(_initialize_tui_win): Declare before definition.
(tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH.
* tui/tui-win.h (tui_sigwinch_handler): Delete declaration.
(tui_get_cmd_list): Add a prototype.
* tui/tui-windata.c: Include tui-windata.h.
* tui/tui-wingeneral.c (box_win): Make it static.
* cli/cli-logging.c (show_logging_command): Make it static.
(_initialize_cli_logging): Declare before definition.
* mi/mi-common.c (_initialize_gdb_mi_common): Declare before
definition.
2009-02-21 16:14:50 +00:00
|
|
|
#include "linux-tdep.h"
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
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".
2009-10-19 09:51:43 +00:00
|
|
|
#include "auxv.h"
|
|
|
|
#include "target.h"
|
2012-01-20 09:56:56 +00:00
|
|
|
#include "gdbthread.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "regcache.h"
|
|
|
|
#include "regset.h"
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
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".
2009-10-19 09:51:43 +00:00
|
|
|
#include "elf/common.h"
|
2012-01-20 09:56:56 +00:00
|
|
|
#include "elf-bfd.h" /* for elfcore_write_* */
|
2010-08-04 15:27:57 +00:00
|
|
|
#include "inferior.h"
|
2012-01-20 09:49:58 +00:00
|
|
|
#include "cli/cli-utils.h"
|
2012-12-14 15:30:38 +00:00
|
|
|
#include "arch-utils.h"
|
|
|
|
#include "gdb_obstack.h"
|
2012-01-20 09:49:58 +00:00
|
|
|
|
|
|
|
#include <ctype.h>
|
2009-02-06 22:59:01 +00:00
|
|
|
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 16:54:43 +00:00
|
|
|
/* This enum represents the signals' numbers on a generic architecture
|
|
|
|
running the Linux kernel. The definition of "generic" comes from
|
|
|
|
the file <include/uapi/asm-generic/signal.h>, from the Linux kernel
|
|
|
|
tree, which is the "de facto" implementation of signal numbers to
|
|
|
|
be used by new architecture ports.
|
|
|
|
|
|
|
|
For those architectures which have differences between the generic
|
|
|
|
standard (e.g., Alpha), we define the different signals (and *only*
|
|
|
|
those) in the specific target-dependent file (e.g.,
|
|
|
|
alpha-linux-tdep.c, for Alpha). Please refer to the architecture's
|
|
|
|
tdep file for more information.
|
|
|
|
|
|
|
|
ARM deserves a special mention here. On the file
|
|
|
|
<arch/arm/include/uapi/asm/signal.h>, it defines only one different
|
|
|
|
(and ARM-only) signal, which is SIGSWI, with the same number as
|
|
|
|
SIGRTMIN. This signal is used only for a very specific target,
|
|
|
|
called ArthurOS (from RISCOS). Therefore, we do not handle it on
|
|
|
|
the ARM-tdep file, and we can safely use the generic signal handler
|
|
|
|
here for ARM targets.
|
|
|
|
|
|
|
|
As stated above, this enum is derived from
|
|
|
|
<include/uapi/asm-generic/signal.h>, from the Linux kernel
|
|
|
|
tree. */
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LINUX_SIGHUP = 1,
|
|
|
|
LINUX_SIGINT = 2,
|
|
|
|
LINUX_SIGQUIT = 3,
|
|
|
|
LINUX_SIGILL = 4,
|
|
|
|
LINUX_SIGTRAP = 5,
|
|
|
|
LINUX_SIGABRT = 6,
|
|
|
|
LINUX_SIGIOT = 6,
|
|
|
|
LINUX_SIGBUS = 7,
|
|
|
|
LINUX_SIGFPE = 8,
|
|
|
|
LINUX_SIGKILL = 9,
|
|
|
|
LINUX_SIGUSR1 = 10,
|
|
|
|
LINUX_SIGSEGV = 11,
|
|
|
|
LINUX_SIGUSR2 = 12,
|
|
|
|
LINUX_SIGPIPE = 13,
|
|
|
|
LINUX_SIGALRM = 14,
|
|
|
|
LINUX_SIGTERM = 15,
|
|
|
|
LINUX_SIGSTKFLT = 16,
|
|
|
|
LINUX_SIGCHLD = 17,
|
|
|
|
LINUX_SIGCONT = 18,
|
|
|
|
LINUX_SIGSTOP = 19,
|
|
|
|
LINUX_SIGTSTP = 20,
|
|
|
|
LINUX_SIGTTIN = 21,
|
|
|
|
LINUX_SIGTTOU = 22,
|
|
|
|
LINUX_SIGURG = 23,
|
|
|
|
LINUX_SIGXCPU = 24,
|
|
|
|
LINUX_SIGXFSZ = 25,
|
|
|
|
LINUX_SIGVTALRM = 26,
|
|
|
|
LINUX_SIGPROF = 27,
|
|
|
|
LINUX_SIGWINCH = 28,
|
|
|
|
LINUX_SIGIO = 29,
|
|
|
|
LINUX_SIGPOLL = LINUX_SIGIO,
|
|
|
|
LINUX_SIGPWR = 30,
|
|
|
|
LINUX_SIGSYS = 31,
|
|
|
|
LINUX_SIGUNUSED = 31,
|
|
|
|
|
|
|
|
LINUX_SIGRTMIN = 32,
|
|
|
|
LINUX_SIGRTMAX = 64,
|
|
|
|
};
|
|
|
|
|
2010-08-31 18:11:48 +00:00
|
|
|
static struct gdbarch_data *linux_gdbarch_data_handle;
|
|
|
|
|
|
|
|
struct linux_gdbarch_data
|
|
|
|
{
|
|
|
|
struct type *siginfo_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void *
|
|
|
|
init_linux_gdbarch_data (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct linux_gdbarch_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct linux_gdbarch_data *
|
|
|
|
get_linux_gdbarch_data (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
return gdbarch_data (gdbarch, linux_gdbarch_data_handle);
|
|
|
|
}
|
|
|
|
|
2009-02-06 22:59:01 +00:00
|
|
|
/* This function is suitable for architectures that don't
|
|
|
|
extend/override the standard siginfo structure. */
|
|
|
|
|
|
|
|
struct type *
|
|
|
|
linux_get_siginfo_type (struct gdbarch *gdbarch)
|
|
|
|
{
|
2010-08-31 18:11:48 +00:00
|
|
|
struct linux_gdbarch_data *linux_gdbarch_data;
|
2009-02-06 22:59:01 +00:00
|
|
|
struct type *int_type, *uint_type, *long_type, *void_ptr_type;
|
|
|
|
struct type *uid_type, *pid_type;
|
|
|
|
struct type *sigval_type, *clock_type;
|
|
|
|
struct type *siginfo_type, *sifields_type;
|
|
|
|
struct type *type;
|
|
|
|
|
2010-08-31 18:11:48 +00:00
|
|
|
linux_gdbarch_data = get_linux_gdbarch_data (gdbarch);
|
|
|
|
if (linux_gdbarch_data->siginfo_type != NULL)
|
|
|
|
return linux_gdbarch_data->siginfo_type;
|
|
|
|
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
|
|
|
|
0, "int");
|
|
|
|
uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
|
|
|
|
1, "unsigned int");
|
|
|
|
long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
|
|
|
|
0, "long");
|
2009-02-06 22:59:01 +00:00
|
|
|
void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
|
|
|
|
|
|
|
|
/* sival_t */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
|
2009-02-06 22:59:01 +00:00
|
|
|
TYPE_NAME (sigval_type) = xstrdup ("sigval_t");
|
|
|
|
append_composite_type_field (sigval_type, "sival_int", int_type);
|
|
|
|
append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
|
|
|
|
|
|
|
|
/* __pid_t */
|
2011-03-05 21:21:32 +00:00
|
|
|
pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
|
|
|
TYPE_LENGTH (int_type), "__pid_t");
|
2009-02-06 22:59:01 +00:00
|
|
|
TYPE_TARGET_TYPE (pid_type) = int_type;
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
TYPE_TARGET_STUB (pid_type) = 1;
|
2009-02-06 22:59:01 +00:00
|
|
|
|
|
|
|
/* __uid_t */
|
2011-03-05 21:21:32 +00:00
|
|
|
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
|
|
|
TYPE_LENGTH (uint_type), "__uid_t");
|
2009-02-06 22:59:01 +00:00
|
|
|
TYPE_TARGET_TYPE (uid_type) = uint_type;
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
TYPE_TARGET_STUB (uid_type) = 1;
|
2009-02-06 22:59:01 +00:00
|
|
|
|
|
|
|
/* __clock_t */
|
2011-03-05 21:21:32 +00:00
|
|
|
clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
|
|
|
|
TYPE_LENGTH (long_type), "__clock_t");
|
2009-02-06 22:59:01 +00:00
|
|
|
TYPE_TARGET_TYPE (clock_type) = long_type;
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
TYPE_TARGET_STUB (clock_type) = 1;
|
2009-02-06 22:59:01 +00:00
|
|
|
|
|
|
|
/* _sifields */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
|
2009-02-06 22:59:01 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
const int si_max_size = 128;
|
|
|
|
int si_pad_size;
|
|
|
|
int size_of_int = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT;
|
|
|
|
|
|
|
|
/* _pad */
|
|
|
|
if (gdbarch_ptr_bit (gdbarch) == 64)
|
|
|
|
si_pad_size = (si_max_size / size_of_int) - 4;
|
|
|
|
else
|
|
|
|
si_pad_size = (si_max_size / size_of_int) - 3;
|
|
|
|
append_composite_type_field (sifields_type, "_pad",
|
|
|
|
init_vector_type (int_type, si_pad_size));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* _kill */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
2009-02-06 22:59:01 +00:00
|
|
|
append_composite_type_field (type, "si_pid", pid_type);
|
|
|
|
append_composite_type_field (type, "si_uid", uid_type);
|
|
|
|
append_composite_type_field (sifields_type, "_kill", type);
|
|
|
|
|
|
|
|
/* _timer */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
2009-02-06 22:59:01 +00:00
|
|
|
append_composite_type_field (type, "si_tid", int_type);
|
|
|
|
append_composite_type_field (type, "si_overrun", int_type);
|
|
|
|
append_composite_type_field (type, "si_sigval", sigval_type);
|
|
|
|
append_composite_type_field (sifields_type, "_timer", type);
|
|
|
|
|
|
|
|
/* _rt */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
2009-02-06 22:59:01 +00:00
|
|
|
append_composite_type_field (type, "si_pid", pid_type);
|
|
|
|
append_composite_type_field (type, "si_uid", uid_type);
|
|
|
|
append_composite_type_field (type, "si_sigval", sigval_type);
|
|
|
|
append_composite_type_field (sifields_type, "_rt", type);
|
|
|
|
|
|
|
|
/* _sigchld */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
2009-02-06 22:59:01 +00:00
|
|
|
append_composite_type_field (type, "si_pid", pid_type);
|
|
|
|
append_composite_type_field (type, "si_uid", uid_type);
|
|
|
|
append_composite_type_field (type, "si_status", int_type);
|
|
|
|
append_composite_type_field (type, "si_utime", clock_type);
|
|
|
|
append_composite_type_field (type, "si_stime", clock_type);
|
|
|
|
append_composite_type_field (sifields_type, "_sigchld", type);
|
|
|
|
|
|
|
|
/* _sigfault */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
2009-02-06 22:59:01 +00:00
|
|
|
append_composite_type_field (type, "si_addr", void_ptr_type);
|
|
|
|
append_composite_type_field (sifields_type, "_sigfault", type);
|
|
|
|
|
|
|
|
/* _sigpoll */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
2009-02-06 22:59:01 +00:00
|
|
|
append_composite_type_field (type, "si_band", long_type);
|
|
|
|
append_composite_type_field (type, "si_fd", int_type);
|
|
|
|
append_composite_type_field (sifields_type, "_sigpoll", type);
|
|
|
|
|
|
|
|
/* struct siginfo */
|
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros.
(TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement.
(alloc_type_arch): Add prototype.
(alloc_type_copy): Likewise.
(get_type_arch): Likewise.
(arch_type): Likewise.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
* gdbtypes.c (alloc_type): No longer support NULL objfile.
(init_type): Likewise.
(alloc_type_arch): New function.
(alloc_type_copy): New function.
(get_type_arch): New function.
(smash_type): Preserve type ownership information.
(make_pointer_type, make_reference_type, make_function_type,
smash_to_memberptr_type, smash_to_method_type): No longer
preserve OBJFILE across smash_type calls.
(make_pointer_type, make_reference_type, make_function_type,
lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method,
create_range_type, create_array_type, create_set_type, copy_type):
Use alloc_type_copy when allocating types.
(check_typedef): Use alloc_type_arch.
(copy_type_recursive): Likewise. Preserve type ownership data
after copying type.
(recursive_dump_type): Dump type ownership data.
(alloc_type_instance): Update type ownership check.
(copy_type, copy_type_recursive): Likewise.
(arch_type): New function.
(arch_integer_type): Likewise.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(init_float_type): Remove, replace by ...
(arch_float_type): ... this.
(init_complex_type): Remove, replace by ...
(arch_complex_type): ... this.
(init_flags_type): Remove, replace by ...
(arch_flags_type): ... this.
(append_flags_type_flag): Move down.
(init_composite_type): Remove, replace by ...
(arch_composite_type): ... this.
(append_composite_type_field_aligned,
append_composite_type_field): Move down.
* gdbarch.c (gdbtypes_post_init): Allocate all types
using per-architecture routines.
* ada-lang.c (ada_language_arch_info): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* jv-lang.c (build_java_types): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* scm-lang.c (build_scm_types): Likewise.
* ada-lang.c (ada_type_of_array): Use alloc_type_copy.
(packed_array_type): Likewise.
(ada_template_to_fixed_record_type_1): Likewise.
(template_to_static_fixed_type): Likewise.
(to_record_with_fixed_variant_part): Likewise.
(to_fixed_variant_branch_type): Likewise.
(to_fixed_array_type): Likewise.
(to_fixed_range_type): Likewise.
(empty_record): Use type instead of objfile argument.
Use alloc_type_copy.
(to_fixed_variant_branch_type): Update call to empty_record.
* jv-lang.c (type_from_class): Use alloc_type_arch.
* arm-tdep.c (arm_ext_type): Allocate per-architecture type.
* i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type,
i386_mmx_type, i386_sse_type): Likewise.
* ia64-tdep.c (ia64_ext_type): Likewise.
* m32c-tdep.c (make_types): Likewise.
* m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise.
* rs6000-tdep.c (rs6000_builtin_type_vec64,
rs6000_builtin_type_vec128): Likewise.
* sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type,
sparc64_fprs_type): Likewise.
* spu-tdep.c (spu_builtin_type_vec128): Likewise.
* xtensa-tdep.c (xtensa_register_type): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 12:55:30 +00:00
|
|
|
siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
|
2009-02-06 22:59:01 +00:00
|
|
|
TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
|
|
|
|
append_composite_type_field (siginfo_type, "si_signo", int_type);
|
|
|
|
append_composite_type_field (siginfo_type, "si_errno", int_type);
|
|
|
|
append_composite_type_field (siginfo_type, "si_code", int_type);
|
|
|
|
append_composite_type_field_aligned (siginfo_type,
|
|
|
|
"_sifields", sifields_type,
|
|
|
|
TYPE_LENGTH (long_type));
|
|
|
|
|
2010-08-31 18:11:48 +00:00
|
|
|
linux_gdbarch_data->siginfo_type = siginfo_type;
|
|
|
|
|
2009-02-06 22:59:01 +00:00
|
|
|
return siginfo_type;
|
|
|
|
}
|
2009-08-04 20:41:13 +00:00
|
|
|
|
2013-09-02 23:09:57 +00:00
|
|
|
/* Return true if the target is running on uClinux instead of normal
|
|
|
|
Linux kernel. */
|
|
|
|
|
|
|
|
int
|
|
|
|
linux_is_uclinux (void)
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
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".
2009-10-19 09:51:43 +00:00
|
|
|
{
|
|
|
|
CORE_ADDR dummy;
|
|
|
|
|
2013-09-02 23:09:57 +00:00
|
|
|
return (target_auxv_search (¤t_target, AT_NULL, &dummy) > 0
|
|
|
|
&& target_auxv_search (¤t_target, AT_PAGESZ, &dummy) == 0);
|
|
|
|
}
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
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".
2009-10-19 09:51:43 +00:00
|
|
|
|
2013-09-02 23:09:57 +00:00
|
|
|
static int
|
|
|
|
linux_has_shared_address_space (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
return linux_is_uclinux ();
|
2009-10-19 Pedro Alves <pedro@codesourcery.com>
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".
2009-10-19 09:51:43 +00:00
|
|
|
}
|
2010-08-04 15:27:57 +00:00
|
|
|
|
|
|
|
/* This is how we want PTIDs from core files to be printed. */
|
|
|
|
|
|
|
|
static char *
|
|
|
|
linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
|
|
|
|
{
|
|
|
|
static char buf[80];
|
|
|
|
|
|
|
|
if (ptid_get_lwp (ptid) != 0)
|
|
|
|
{
|
|
|
|
snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
return normal_pid_to_str (ptid);
|
|
|
|
}
|
|
|
|
|
2012-01-20 09:49:58 +00:00
|
|
|
/* Service function for corefiles and info proc. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
read_mapping (const char *line,
|
|
|
|
ULONGEST *addr, ULONGEST *endaddr,
|
|
|
|
const char **permissions, size_t *permissions_len,
|
|
|
|
ULONGEST *offset,
|
|
|
|
const char **device, size_t *device_len,
|
|
|
|
ULONGEST *inode,
|
|
|
|
const char **filename)
|
|
|
|
{
|
|
|
|
const char *p = line;
|
|
|
|
|
|
|
|
*addr = strtoulst (p, &p, 16);
|
|
|
|
if (*p == '-')
|
|
|
|
p++;
|
|
|
|
*endaddr = strtoulst (p, &p, 16);
|
|
|
|
|
2013-03-07 21:57:30 +00:00
|
|
|
p = skip_spaces_const (p);
|
2012-01-20 09:49:58 +00:00
|
|
|
*permissions = p;
|
|
|
|
while (*p && !isspace (*p))
|
|
|
|
p++;
|
|
|
|
*permissions_len = p - *permissions;
|
|
|
|
|
|
|
|
*offset = strtoulst (p, &p, 16);
|
|
|
|
|
2013-03-07 21:57:30 +00:00
|
|
|
p = skip_spaces_const (p);
|
2012-01-20 09:49:58 +00:00
|
|
|
*device = p;
|
|
|
|
while (*p && !isspace (*p))
|
|
|
|
p++;
|
|
|
|
*device_len = p - *device;
|
|
|
|
|
|
|
|
*inode = strtoulst (p, &p, 10);
|
|
|
|
|
2013-03-07 21:57:30 +00:00
|
|
|
p = skip_spaces_const (p);
|
2012-01-20 09:49:58 +00:00
|
|
|
*filename = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Implement the "info proc" command. */
|
|
|
|
|
|
|
|
static void
|
2014-06-06 19:38:16 +00:00
|
|
|
linux_info_proc (struct gdbarch *gdbarch, const char *args,
|
2012-01-20 09:49:58 +00:00
|
|
|
enum info_proc_what what)
|
|
|
|
{
|
|
|
|
/* A long is used for pid instead of an int to avoid a loss of precision
|
|
|
|
compiler warning from the output of strtoul. */
|
|
|
|
long pid;
|
|
|
|
int cmdline_f = (what == IP_MINIMAL || what == IP_CMDLINE || what == IP_ALL);
|
|
|
|
int cwd_f = (what == IP_MINIMAL || what == IP_CWD || what == IP_ALL);
|
|
|
|
int exe_f = (what == IP_MINIMAL || what == IP_EXE || what == IP_ALL);
|
|
|
|
int mappings_f = (what == IP_MAPPINGS || what == IP_ALL);
|
|
|
|
int status_f = (what == IP_STATUS || what == IP_ALL);
|
|
|
|
int stat_f = (what == IP_STAT || what == IP_ALL);
|
|
|
|
char filename[100];
|
2013-04-19 15:10:53 +00:00
|
|
|
char *data;
|
2012-01-20 09:49:58 +00:00
|
|
|
int target_errno;
|
|
|
|
|
|
|
|
if (args && isdigit (args[0]))
|
2014-06-06 19:38:16 +00:00
|
|
|
{
|
|
|
|
char *tem;
|
|
|
|
|
|
|
|
pid = strtoul (args, &tem, 10);
|
|
|
|
args = tem;
|
|
|
|
}
|
2012-01-20 09:49:58 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!target_has_execution)
|
|
|
|
error (_("No current process: you must name one."));
|
|
|
|
if (current_inferior ()->fake_pid_p)
|
|
|
|
error (_("Can't determine the current process's PID: you must name one."));
|
|
|
|
|
|
|
|
pid = current_inferior ()->pid;
|
|
|
|
}
|
|
|
|
|
2014-06-06 19:38:16 +00:00
|
|
|
args = skip_spaces_const (args);
|
2012-01-20 09:49:58 +00:00
|
|
|
if (args && args[0])
|
|
|
|
error (_("Too many parameters: %s"), args);
|
|
|
|
|
|
|
|
printf_filtered (_("process %ld\n"), pid);
|
|
|
|
if (cmdline_f)
|
|
|
|
{
|
|
|
|
xsnprintf (filename, sizeof filename, "/proc/%ld/cmdline", pid);
|
|
|
|
data = target_fileio_read_stralloc (filename);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup = make_cleanup (xfree, data);
|
|
|
|
printf_filtered ("cmdline = '%s'\n", data);
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
warning (_("unable to open /proc file '%s'"), filename);
|
|
|
|
}
|
|
|
|
if (cwd_f)
|
|
|
|
{
|
|
|
|
xsnprintf (filename, sizeof filename, "/proc/%ld/cwd", pid);
|
|
|
|
data = target_fileio_readlink (filename, &target_errno);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup = make_cleanup (xfree, data);
|
|
|
|
printf_filtered ("cwd = '%s'\n", data);
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
warning (_("unable to read link '%s'"), filename);
|
|
|
|
}
|
|
|
|
if (exe_f)
|
|
|
|
{
|
|
|
|
xsnprintf (filename, sizeof filename, "/proc/%ld/exe", pid);
|
|
|
|
data = target_fileio_readlink (filename, &target_errno);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup = make_cleanup (xfree, data);
|
|
|
|
printf_filtered ("exe = '%s'\n", data);
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
warning (_("unable to read link '%s'"), filename);
|
|
|
|
}
|
|
|
|
if (mappings_f)
|
|
|
|
{
|
|
|
|
xsnprintf (filename, sizeof filename, "/proc/%ld/maps", pid);
|
|
|
|
data = target_fileio_read_stralloc (filename);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup = make_cleanup (xfree, data);
|
|
|
|
char *line;
|
|
|
|
|
|
|
|
printf_filtered (_("Mapped address spaces:\n\n"));
|
|
|
|
if (gdbarch_addr_bit (gdbarch) == 32)
|
|
|
|
{
|
|
|
|
printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
|
|
|
"Start Addr",
|
|
|
|
" End Addr",
|
|
|
|
" Size", " Offset", "objfile");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf_filtered (" %18s %18s %10s %10s %s\n",
|
|
|
|
"Start Addr",
|
|
|
|
" End Addr",
|
|
|
|
" Size", " Offset", "objfile");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (line = strtok (data, "\n"); line; line = strtok (NULL, "\n"))
|
|
|
|
{
|
|
|
|
ULONGEST addr, endaddr, offset, inode;
|
|
|
|
const char *permissions, *device, *filename;
|
|
|
|
size_t permissions_len, device_len;
|
|
|
|
|
|
|
|
read_mapping (line, &addr, &endaddr,
|
|
|
|
&permissions, &permissions_len,
|
|
|
|
&offset, &device, &device_len,
|
|
|
|
&inode, &filename);
|
|
|
|
|
|
|
|
if (gdbarch_addr_bit (gdbarch) == 32)
|
|
|
|
{
|
|
|
|
printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
|
|
|
paddress (gdbarch, addr),
|
|
|
|
paddress (gdbarch, endaddr),
|
|
|
|
hex_string (endaddr - addr),
|
|
|
|
hex_string (offset),
|
|
|
|
*filename? filename : "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf_filtered (" %18s %18s %10s %10s %s\n",
|
|
|
|
paddress (gdbarch, addr),
|
|
|
|
paddress (gdbarch, endaddr),
|
|
|
|
hex_string (endaddr - addr),
|
|
|
|
hex_string (offset),
|
|
|
|
*filename? filename : "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
warning (_("unable to open /proc file '%s'"), filename);
|
|
|
|
}
|
|
|
|
if (status_f)
|
|
|
|
{
|
|
|
|
xsnprintf (filename, sizeof filename, "/proc/%ld/status", pid);
|
|
|
|
data = target_fileio_read_stralloc (filename);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup = make_cleanup (xfree, data);
|
|
|
|
puts_filtered (data);
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
warning (_("unable to open /proc file '%s'"), filename);
|
|
|
|
}
|
|
|
|
if (stat_f)
|
|
|
|
{
|
|
|
|
xsnprintf (filename, sizeof filename, "/proc/%ld/stat", pid);
|
|
|
|
data = target_fileio_read_stralloc (filename);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup = make_cleanup (xfree, data);
|
|
|
|
const char *p = data;
|
|
|
|
|
|
|
|
printf_filtered (_("Process: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
|
2013-03-07 21:57:30 +00:00
|
|
|
p = skip_spaces_const (p);
|
2012-01-23 13:35:22 +00:00
|
|
|
if (*p == '(')
|
2012-01-20 09:49:58 +00:00
|
|
|
{
|
2014-02-21 17:39:40 +00:00
|
|
|
/* ps command also relies on no trailing fields
|
|
|
|
ever contain ')'. */
|
|
|
|
const char *ep = strrchr (p, ')');
|
2012-01-23 13:35:22 +00:00
|
|
|
if (ep != NULL)
|
|
|
|
{
|
|
|
|
printf_filtered ("Exec file: %.*s\n",
|
|
|
|
(int) (ep - p - 1), p + 1);
|
|
|
|
p = ep + 1;
|
|
|
|
}
|
2012-01-20 09:49:58 +00:00
|
|
|
}
|
|
|
|
|
2013-03-07 21:57:30 +00:00
|
|
|
p = skip_spaces_const (p);
|
2012-01-20 09:49:58 +00:00
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("State: %c\n"), *p++);
|
|
|
|
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Parent process: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Process group: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Session id: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("TTY: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("TTY owner process group: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Flags: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Minor faults (no memory page): %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Minor faults, children: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Major faults (memory page faults): %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Major faults, children: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("utime: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("stime: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("utime, children: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("stime, children: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("jiffies remaining in current "
|
|
|
|
"time slice: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("'nice' value: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("jiffies until next timeout: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("jiffies until next SIGALRM: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("start time (jiffies since "
|
|
|
|
"system boot): %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Virtual memory size: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Resident set size: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("rlim: %s\n"),
|
|
|
|
pulongest (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Start of text: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("End of text: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Start of stack: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
#if 0 /* Don't know how architecture-dependent the rest is...
|
|
|
|
Anyway the signal bitmap info is available from "status". */
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Kernel stack pointer: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Kernel instr pointer: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Pending signals bitmap: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Blocked signals bitmap: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Ignored signals bitmap: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("Catched signals bitmap: %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
if (*p)
|
|
|
|
printf_filtered (_("wchan (system call): %s\n"),
|
|
|
|
hex_string (strtoulst (p, &p, 10)));
|
|
|
|
#endif
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
warning (_("unable to open /proc file '%s'"), filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-14 15:30:38 +00:00
|
|
|
/* Implement "info proc mappings" for a corefile. */
|
|
|
|
|
|
|
|
static void
|
2014-06-06 19:38:16 +00:00
|
|
|
linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
|
2012-12-14 15:30:38 +00:00
|
|
|
{
|
|
|
|
asection *section;
|
|
|
|
ULONGEST count, page_size;
|
|
|
|
unsigned char *descdata, *filenames, *descend, *contents;
|
|
|
|
size_t note_size;
|
|
|
|
unsigned int addr_size_bits, addr_size;
|
|
|
|
struct cleanup *cleanup;
|
|
|
|
struct gdbarch *core_gdbarch = gdbarch_from_bfd (core_bfd);
|
|
|
|
/* We assume this for reading 64-bit core files. */
|
|
|
|
gdb_static_assert (sizeof (ULONGEST) >= 8);
|
|
|
|
|
|
|
|
section = bfd_get_section_by_name (core_bfd, ".note.linuxcore.file");
|
|
|
|
if (section == NULL)
|
|
|
|
{
|
|
|
|
warning (_("unable to find mappings in core file"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
addr_size_bits = gdbarch_addr_bit (core_gdbarch);
|
|
|
|
addr_size = addr_size_bits / 8;
|
|
|
|
note_size = bfd_get_section_size (section);
|
|
|
|
|
|
|
|
if (note_size < 2 * addr_size)
|
|
|
|
error (_("malformed core note - too short for header"));
|
|
|
|
|
|
|
|
contents = xmalloc (note_size);
|
|
|
|
cleanup = make_cleanup (xfree, contents);
|
|
|
|
if (!bfd_get_section_contents (core_bfd, section, contents, 0, note_size))
|
|
|
|
error (_("could not get core note contents"));
|
|
|
|
|
|
|
|
descdata = contents;
|
|
|
|
descend = descdata + note_size;
|
|
|
|
|
|
|
|
if (descdata[note_size - 1] != '\0')
|
|
|
|
error (_("malformed note - does not end with \\0"));
|
|
|
|
|
|
|
|
count = bfd_get (addr_size_bits, core_bfd, descdata);
|
|
|
|
descdata += addr_size;
|
|
|
|
|
|
|
|
page_size = bfd_get (addr_size_bits, core_bfd, descdata);
|
|
|
|
descdata += addr_size;
|
|
|
|
|
|
|
|
if (note_size < 2 * addr_size + count * 3 * addr_size)
|
|
|
|
error (_("malformed note - too short for supplied file count"));
|
|
|
|
|
|
|
|
printf_filtered (_("Mapped address spaces:\n\n"));
|
|
|
|
if (gdbarch_addr_bit (gdbarch) == 32)
|
|
|
|
{
|
|
|
|
printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
|
|
|
"Start Addr",
|
|
|
|
" End Addr",
|
|
|
|
" Size", " Offset", "objfile");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf_filtered (" %18s %18s %10s %10s %s\n",
|
|
|
|
"Start Addr",
|
|
|
|
" End Addr",
|
|
|
|
" Size", " Offset", "objfile");
|
|
|
|
}
|
|
|
|
|
|
|
|
filenames = descdata + count * 3 * addr_size;
|
|
|
|
while (--count > 0)
|
|
|
|
{
|
|
|
|
ULONGEST start, end, file_ofs;
|
|
|
|
|
|
|
|
if (filenames == descend)
|
|
|
|
error (_("malformed note - filenames end too early"));
|
|
|
|
|
|
|
|
start = bfd_get (addr_size_bits, core_bfd, descdata);
|
|
|
|
descdata += addr_size;
|
|
|
|
end = bfd_get (addr_size_bits, core_bfd, descdata);
|
|
|
|
descdata += addr_size;
|
|
|
|
file_ofs = bfd_get (addr_size_bits, core_bfd, descdata);
|
|
|
|
descdata += addr_size;
|
|
|
|
|
|
|
|
file_ofs *= page_size;
|
|
|
|
|
|
|
|
if (gdbarch_addr_bit (gdbarch) == 32)
|
|
|
|
printf_filtered ("\t%10s %10s %10s %10s %s\n",
|
|
|
|
paddress (gdbarch, start),
|
|
|
|
paddress (gdbarch, end),
|
|
|
|
hex_string (end - start),
|
|
|
|
hex_string (file_ofs),
|
|
|
|
filenames);
|
|
|
|
else
|
|
|
|
printf_filtered (" %18s %18s %10s %10s %s\n",
|
|
|
|
paddress (gdbarch, start),
|
|
|
|
paddress (gdbarch, end),
|
|
|
|
hex_string (end - start),
|
|
|
|
hex_string (file_ofs),
|
|
|
|
filenames);
|
|
|
|
|
|
|
|
filenames += 1 + strlen ((char *) filenames);
|
|
|
|
}
|
|
|
|
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Implement "info proc" for a corefile. */
|
|
|
|
|
|
|
|
static void
|
2014-06-06 19:38:16 +00:00
|
|
|
linux_core_info_proc (struct gdbarch *gdbarch, const char *args,
|
2012-12-14 15:30:38 +00:00
|
|
|
enum info_proc_what what)
|
|
|
|
{
|
|
|
|
int exe_f = (what == IP_MINIMAL || what == IP_EXE || what == IP_ALL);
|
|
|
|
int mappings_f = (what == IP_MAPPINGS || what == IP_ALL);
|
|
|
|
|
|
|
|
if (exe_f)
|
|
|
|
{
|
|
|
|
const char *exe;
|
|
|
|
|
|
|
|
exe = bfd_core_file_failing_command (core_bfd);
|
|
|
|
if (exe != NULL)
|
|
|
|
printf_filtered ("exe = '%s'\n", exe);
|
|
|
|
else
|
|
|
|
warning (_("unable to find command name in core file"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mappings_f)
|
|
|
|
linux_core_info_proc_mappings (gdbarch, args);
|
|
|
|
|
|
|
|
if (!exe_f && !mappings_f)
|
|
|
|
error (_("unable to handle request"));
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef int linux_find_memory_region_ftype (ULONGEST vaddr, ULONGEST size,
|
|
|
|
ULONGEST offset, ULONGEST inode,
|
|
|
|
int read, int write,
|
|
|
|
int exec, int modified,
|
|
|
|
const char *filename,
|
|
|
|
void *data);
|
|
|
|
|
2012-01-20 09:59:15 +00:00
|
|
|
/* List memory regions in the inferior for a corefile. */
|
|
|
|
|
|
|
|
static int
|
2012-12-14 15:30:38 +00:00
|
|
|
linux_find_memory_regions_full (struct gdbarch *gdbarch,
|
|
|
|
linux_find_memory_region_ftype *func,
|
|
|
|
void *obfd)
|
2012-01-20 09:59:15 +00:00
|
|
|
{
|
2013-04-05 19:14:44 +00:00
|
|
|
char mapsfilename[100];
|
2013-04-19 15:10:53 +00:00
|
|
|
char *data;
|
2012-01-20 09:59:15 +00:00
|
|
|
|
|
|
|
/* We need to know the real target PID to access /proc. */
|
|
|
|
if (current_inferior ()->fake_pid_p)
|
|
|
|
return 1;
|
|
|
|
|
2013-04-05 19:14:44 +00:00
|
|
|
xsnprintf (mapsfilename, sizeof mapsfilename,
|
2012-08-07 13:26:33 +00:00
|
|
|
"/proc/%d/smaps", current_inferior ()->pid);
|
2013-04-05 19:14:44 +00:00
|
|
|
data = target_fileio_read_stralloc (mapsfilename);
|
2012-08-07 13:26:33 +00:00
|
|
|
if (data == NULL)
|
|
|
|
{
|
|
|
|
/* Older Linux kernels did not support /proc/PID/smaps. */
|
2013-04-05 19:14:44 +00:00
|
|
|
xsnprintf (mapsfilename, sizeof mapsfilename,
|
2012-08-07 13:26:33 +00:00
|
|
|
"/proc/%d/maps", current_inferior ()->pid);
|
2013-04-05 19:14:44 +00:00
|
|
|
data = target_fileio_read_stralloc (mapsfilename);
|
2012-08-07 13:26:33 +00:00
|
|
|
}
|
2012-01-20 09:59:15 +00:00
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup = make_cleanup (xfree, data);
|
|
|
|
char *line;
|
|
|
|
|
2012-08-07 13:26:33 +00:00
|
|
|
line = strtok (data, "\n");
|
|
|
|
while (line)
|
2012-01-20 09:59:15 +00:00
|
|
|
{
|
|
|
|
ULONGEST addr, endaddr, offset, inode;
|
|
|
|
const char *permissions, *device, *filename;
|
|
|
|
size_t permissions_len, device_len;
|
|
|
|
int read, write, exec;
|
2012-08-07 13:26:33 +00:00
|
|
|
int modified = 0, has_anonymous = 0;
|
2012-01-20 09:59:15 +00:00
|
|
|
|
|
|
|
read_mapping (line, &addr, &endaddr, &permissions, &permissions_len,
|
|
|
|
&offset, &device, &device_len, &inode, &filename);
|
|
|
|
|
|
|
|
/* Decode permissions. */
|
|
|
|
read = (memchr (permissions, 'r', permissions_len) != 0);
|
|
|
|
write = (memchr (permissions, 'w', permissions_len) != 0);
|
|
|
|
exec = (memchr (permissions, 'x', permissions_len) != 0);
|
|
|
|
|
2012-08-07 13:26:33 +00:00
|
|
|
/* Try to detect if region was modified by parsing smaps counters. */
|
|
|
|
for (line = strtok (NULL, "\n");
|
|
|
|
line && line[0] >= 'A' && line[0] <= 'Z';
|
|
|
|
line = strtok (NULL, "\n"))
|
|
|
|
{
|
|
|
|
char keyword[64 + 1];
|
|
|
|
|
2013-04-05 19:17:15 +00:00
|
|
|
if (sscanf (line, "%64s", keyword) != 1)
|
2012-08-07 13:26:33 +00:00
|
|
|
{
|
2013-04-05 19:14:44 +00:00
|
|
|
warning (_("Error parsing {s,}maps file '%s'"), mapsfilename);
|
2012-08-07 13:26:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (strcmp (keyword, "Anonymous:") == 0)
|
|
|
|
has_anonymous = 1;
|
2013-04-05 19:17:15 +00:00
|
|
|
if (strcmp (keyword, "Shared_Dirty:") == 0
|
|
|
|
|| strcmp (keyword, "Private_Dirty:") == 0
|
|
|
|
|| strcmp (keyword, "Swap:") == 0
|
|
|
|
|| strcmp (keyword, "Anonymous:") == 0)
|
|
|
|
{
|
|
|
|
unsigned long number;
|
|
|
|
|
|
|
|
if (sscanf (line, "%*s%lu", &number) != 1)
|
|
|
|
{
|
|
|
|
warning (_("Error parsing {s,}maps file '%s' number"),
|
|
|
|
mapsfilename);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (number != 0)
|
|
|
|
modified = 1;
|
|
|
|
}
|
2012-08-07 13:26:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Older Linux kernels did not support the "Anonymous:" counter.
|
|
|
|
If it is missing, we can't be sure - dump all the pages. */
|
|
|
|
if (!has_anonymous)
|
|
|
|
modified = 1;
|
|
|
|
|
2012-01-20 09:59:15 +00:00
|
|
|
/* Invoke the callback function to create the corefile segment. */
|
2012-12-14 15:30:38 +00:00
|
|
|
func (addr, endaddr - addr, offset, inode,
|
|
|
|
read, write, exec, modified, filename, obfd);
|
2012-01-20 09:59:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-12-14 15:30:38 +00:00
|
|
|
/* A structure for passing information through
|
|
|
|
linux_find_memory_regions_full. */
|
|
|
|
|
|
|
|
struct linux_find_memory_regions_data
|
|
|
|
{
|
|
|
|
/* The original callback. */
|
|
|
|
|
|
|
|
find_memory_region_ftype func;
|
|
|
|
|
|
|
|
/* The original datum. */
|
|
|
|
|
|
|
|
void *obfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* A callback for linux_find_memory_regions that converts between the
|
|
|
|
"full"-style callback and find_memory_region_ftype. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
linux_find_memory_regions_thunk (ULONGEST vaddr, ULONGEST size,
|
|
|
|
ULONGEST offset, ULONGEST inode,
|
|
|
|
int read, int write, int exec, int modified,
|
|
|
|
const char *filename, void *arg)
|
|
|
|
{
|
|
|
|
struct linux_find_memory_regions_data *data = arg;
|
|
|
|
|
|
|
|
return data->func (vaddr, size, read, write, exec, modified, data->obfd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A variant of linux_find_memory_regions_full that is suitable as the
|
|
|
|
gdbarch find_memory_regions method. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
linux_find_memory_regions (struct gdbarch *gdbarch,
|
|
|
|
find_memory_region_ftype func, void *obfd)
|
|
|
|
{
|
|
|
|
struct linux_find_memory_regions_data data;
|
|
|
|
|
|
|
|
data.func = func;
|
|
|
|
data.obfd = obfd;
|
|
|
|
|
|
|
|
return linux_find_memory_regions_full (gdbarch,
|
|
|
|
linux_find_memory_regions_thunk,
|
|
|
|
&data);
|
|
|
|
}
|
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
/* Determine which signal stopped execution. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
find_signalled_thread (struct thread_info *info, void *data)
|
|
|
|
{
|
2012-05-24 16:51:47 +00:00
|
|
|
if (info->suspend.stop_signal != GDB_SIGNAL_0
|
2012-01-20 09:56:56 +00:00
|
|
|
&& ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-05-24 16:39:15 +00:00
|
|
|
static enum gdb_signal
|
2012-01-20 09:56:56 +00:00
|
|
|
find_stop_signal (void)
|
|
|
|
{
|
|
|
|
struct thread_info *info =
|
|
|
|
iterate_over_threads (find_signalled_thread, NULL);
|
|
|
|
|
|
|
|
if (info)
|
|
|
|
return info->suspend.stop_signal;
|
|
|
|
else
|
2012-05-24 16:51:47 +00:00
|
|
|
return GDB_SIGNAL_0;
|
2012-01-20 09:56:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Generate corefile notes for SPU contexts. */
|
|
|
|
|
|
|
|
static char *
|
|
|
|
linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
|
|
|
|
{
|
|
|
|
static const char *spu_files[] =
|
|
|
|
{
|
|
|
|
"object-id",
|
|
|
|
"mem",
|
|
|
|
"regs",
|
|
|
|
"fpcr",
|
|
|
|
"lslr",
|
|
|
|
"decr",
|
|
|
|
"decr_status",
|
|
|
|
"signal1",
|
|
|
|
"signal1_type",
|
|
|
|
"signal2",
|
|
|
|
"signal2_type",
|
|
|
|
"event_mask",
|
|
|
|
"event_status",
|
|
|
|
"mbox_info",
|
|
|
|
"ibox_info",
|
|
|
|
"wbox_info",
|
|
|
|
"dma_info",
|
|
|
|
"proxydma_info",
|
|
|
|
};
|
|
|
|
|
* gdbarch.sh (target_gdbarch): Remove macro.
(get_target_gdbarch): Rename to target_gdbarch.
* gdbarch.c, gdbarch.h: Rebuild.
* ada-tasks.c, aix-thread.c, amd64-linux-nat.c, arch-utils.c,
arm-tdep.c, auxv.c, breakpoint.c, bsd-uthread.c, corefile.c,
darwin-nat-info.c, dcache.c, dsrec.c, exec.c, fbsd-nat.c,
filesystem.c, gcore.c, gnu-nat.c, i386-darwin-nat.c, i386-nat.c,
ia64-vms-tdep.c, inf-ptrace.c, infcmd.c, jit.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, m32r-rom.c, memattr.c,
mep-tdep.c, microblaze-tdep.c, mips-linux-nat.c,
mips-linux-tdep.c, mips-tdep.c, monitor.c, moxie-tdep.c,
nto-procfs.c, nto-tdep.c, ppc-linux-nat.c, proc-service.c,
procfs.c, progspace.c, ravenscar-thread.c, record.c,
remote-m32r-sdi.c, remote-mips.c, remote-sim.c, remote.c,
rl78-tdep.c, rs6000-nat.c, rx-tdep.c, s390-nat.c, sol-thread.c,
solib-darwin.c, solib-dsbt.c, solib-frv.c, solib-ia64-hpux.c,
solib-irix.c, solib-pa64.c, solib-som.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, solib.c, spu-linux-nat.c,
spu-multiarch.c, spu-tdep.c, symfile-mem.c, symfile.c, symtab.c,
target-descriptions.c, target.c, target.h, tracepoint.c,
windows-nat.c, windows-tdep.c, xcoffsolib.c, cli/cli-dump.c,
common/agent.c, mi/mi-interp.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/python.c: Update.
2012-11-09 19:58:03 +00:00
|
|
|
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
2012-01-20 09:56:56 +00:00
|
|
|
gdb_byte *spu_ids;
|
|
|
|
LONGEST i, j, size;
|
|
|
|
|
|
|
|
/* Determine list of SPU ids. */
|
|
|
|
size = target_read_alloc (¤t_target, TARGET_OBJECT_SPU,
|
|
|
|
NULL, &spu_ids);
|
|
|
|
|
|
|
|
/* Generate corefile notes for each SPU file. */
|
|
|
|
for (i = 0; i < size; i += 4)
|
|
|
|
{
|
|
|
|
int fd = extract_unsigned_integer (spu_ids + i, 4, byte_order);
|
|
|
|
|
|
|
|
for (j = 0; j < sizeof (spu_files) / sizeof (spu_files[0]); j++)
|
|
|
|
{
|
|
|
|
char annex[32], note_name[32];
|
|
|
|
gdb_byte *spu_data;
|
|
|
|
LONGEST spu_len;
|
|
|
|
|
|
|
|
xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[j]);
|
|
|
|
spu_len = target_read_alloc (¤t_target, TARGET_OBJECT_SPU,
|
|
|
|
annex, &spu_data);
|
|
|
|
if (spu_len > 0)
|
|
|
|
{
|
|
|
|
xsnprintf (note_name, sizeof note_name, "SPU/%s", annex);
|
|
|
|
note_data = elfcore_write_note (obfd, note_data, note_size,
|
|
|
|
note_name, NT_SPU,
|
|
|
|
spu_data, spu_len);
|
|
|
|
xfree (spu_data);
|
|
|
|
|
|
|
|
if (!note_data)
|
|
|
|
{
|
|
|
|
xfree (spu_ids);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size > 0)
|
|
|
|
xfree (spu_ids);
|
|
|
|
|
|
|
|
return note_data;
|
|
|
|
}
|
|
|
|
|
2012-12-14 15:30:38 +00:00
|
|
|
/* This is used to pass information from
|
|
|
|
linux_make_mappings_corefile_notes through
|
|
|
|
linux_find_memory_regions_full. */
|
|
|
|
|
|
|
|
struct linux_make_mappings_data
|
|
|
|
{
|
|
|
|
/* Number of files mapped. */
|
|
|
|
ULONGEST file_count;
|
|
|
|
|
|
|
|
/* The obstack for the main part of the data. */
|
|
|
|
struct obstack *data_obstack;
|
|
|
|
|
|
|
|
/* The filename obstack. */
|
|
|
|
struct obstack *filename_obstack;
|
|
|
|
|
|
|
|
/* The architecture's "long" type. */
|
|
|
|
struct type *long_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
static linux_find_memory_region_ftype linux_make_mappings_callback;
|
|
|
|
|
|
|
|
/* A callback for linux_find_memory_regions_full that updates the
|
|
|
|
mappings data for linux_make_mappings_corefile_notes. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
|
|
|
|
ULONGEST offset, ULONGEST inode,
|
|
|
|
int read, int write, int exec, int modified,
|
|
|
|
const char *filename, void *data)
|
|
|
|
{
|
|
|
|
struct linux_make_mappings_data *map_data = data;
|
|
|
|
gdb_byte buf[sizeof (ULONGEST)];
|
|
|
|
|
|
|
|
if (*filename == '\0' || inode == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
++map_data->file_count;
|
|
|
|
|
|
|
|
pack_long (buf, map_data->long_type, vaddr);
|
|
|
|
obstack_grow (map_data->data_obstack, buf, TYPE_LENGTH (map_data->long_type));
|
|
|
|
pack_long (buf, map_data->long_type, vaddr + size);
|
|
|
|
obstack_grow (map_data->data_obstack, buf, TYPE_LENGTH (map_data->long_type));
|
|
|
|
pack_long (buf, map_data->long_type, offset);
|
|
|
|
obstack_grow (map_data->data_obstack, buf, TYPE_LENGTH (map_data->long_type));
|
|
|
|
|
|
|
|
obstack_grow_str0 (map_data->filename_obstack, filename);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write the file mapping data to the core file, if possible. OBFD is
|
|
|
|
the output BFD. NOTE_DATA is the current note data, and NOTE_SIZE
|
|
|
|
is a pointer to the note size. Returns the new NOTE_DATA and
|
|
|
|
updates NOTE_SIZE. */
|
|
|
|
|
|
|
|
static char *
|
|
|
|
linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
|
|
|
|
char *note_data, int *note_size)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanup;
|
|
|
|
struct obstack data_obstack, filename_obstack;
|
|
|
|
struct linux_make_mappings_data mapping_data;
|
|
|
|
struct type *long_type
|
|
|
|
= arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "long");
|
|
|
|
gdb_byte buf[sizeof (ULONGEST)];
|
|
|
|
|
|
|
|
obstack_init (&data_obstack);
|
|
|
|
cleanup = make_cleanup_obstack_free (&data_obstack);
|
|
|
|
obstack_init (&filename_obstack);
|
|
|
|
make_cleanup_obstack_free (&filename_obstack);
|
|
|
|
|
|
|
|
mapping_data.file_count = 0;
|
|
|
|
mapping_data.data_obstack = &data_obstack;
|
|
|
|
mapping_data.filename_obstack = &filename_obstack;
|
|
|
|
mapping_data.long_type = long_type;
|
|
|
|
|
|
|
|
/* Reserve space for the count. */
|
|
|
|
obstack_blank (&data_obstack, TYPE_LENGTH (long_type));
|
|
|
|
/* We always write the page size as 1 since we have no good way to
|
|
|
|
determine the correct value. */
|
|
|
|
pack_long (buf, long_type, 1);
|
|
|
|
obstack_grow (&data_obstack, buf, TYPE_LENGTH (long_type));
|
|
|
|
|
|
|
|
linux_find_memory_regions_full (gdbarch, linux_make_mappings_callback,
|
|
|
|
&mapping_data);
|
|
|
|
|
|
|
|
if (mapping_data.file_count != 0)
|
|
|
|
{
|
|
|
|
/* Write the count to the obstack. */
|
2013-04-19 15:24:55 +00:00
|
|
|
pack_long ((gdb_byte *) obstack_base (&data_obstack),
|
|
|
|
long_type, mapping_data.file_count);
|
2012-12-14 15:30:38 +00:00
|
|
|
|
|
|
|
/* Copy the filenames to the data obstack. */
|
|
|
|
obstack_grow (&data_obstack, obstack_base (&filename_obstack),
|
|
|
|
obstack_object_size (&filename_obstack));
|
|
|
|
|
|
|
|
note_data = elfcore_write_note (obfd, note_data, note_size,
|
|
|
|
"CORE", NT_FILE,
|
|
|
|
obstack_base (&data_obstack),
|
|
|
|
obstack_object_size (&data_obstack));
|
|
|
|
}
|
|
|
|
|
|
|
|
do_cleanups (cleanup);
|
|
|
|
return note_data;
|
|
|
|
}
|
|
|
|
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 15:26:43 +00:00
|
|
|
/* Structure for passing information from
|
|
|
|
linux_collect_thread_registers via an iterator to
|
|
|
|
linux_collect_regset_section_cb. */
|
|
|
|
|
|
|
|
struct linux_collect_regset_section_cb_data
|
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch;
|
|
|
|
const struct regcache *regcache;
|
|
|
|
bfd *obfd;
|
|
|
|
char *note_data;
|
|
|
|
int *note_size;
|
|
|
|
unsigned long lwp;
|
|
|
|
enum gdb_signal stop_signal;
|
|
|
|
int abort_iteration;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Callback for iterate_over_regset_sections that records a single
|
|
|
|
regset in the corefile note section. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
linux_collect_regset_section_cb (const char *sect_name, int size,
|
|
|
|
const char *human_name, void *cb_data)
|
|
|
|
{
|
|
|
|
const struct regset *regset;
|
|
|
|
char *buf;
|
|
|
|
struct linux_collect_regset_section_cb_data *data = cb_data;
|
|
|
|
|
|
|
|
if (data->abort_iteration)
|
|
|
|
return;
|
|
|
|
|
|
|
|
regset = gdbarch_regset_from_core_section (data->gdbarch, sect_name, size);
|
|
|
|
gdb_assert (regset && regset->collect_regset);
|
|
|
|
|
|
|
|
buf = xmalloc (size);
|
|
|
|
regset->collect_regset (regset, data->regcache, -1, buf, size);
|
|
|
|
|
|
|
|
/* PRSTATUS still needs to be treated specially. */
|
|
|
|
if (strcmp (sect_name, ".reg") == 0)
|
|
|
|
data->note_data = (char *) elfcore_write_prstatus
|
|
|
|
(data->obfd, data->note_data, data->note_size, data->lwp,
|
|
|
|
gdb_signal_to_host (data->stop_signal), buf);
|
|
|
|
else
|
|
|
|
data->note_data = (char *) elfcore_write_register_note
|
|
|
|
(data->obfd, data->note_data, data->note_size,
|
|
|
|
sect_name, buf, size);
|
|
|
|
xfree (buf);
|
|
|
|
|
|
|
|
if (data->note_data == NULL)
|
|
|
|
data->abort_iteration = 1;
|
|
|
|
}
|
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
/* Records the thread's register state for the corefile note
|
|
|
|
section. */
|
|
|
|
|
|
|
|
static char *
|
|
|
|
linux_collect_thread_registers (const struct regcache *regcache,
|
|
|
|
ptid_t ptid, bfd *obfd,
|
|
|
|
char *note_data, int *note_size,
|
2012-05-24 16:39:15 +00:00
|
|
|
enum gdb_signal stop_signal)
|
2012-01-20 09:56:56 +00:00
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 15:26:43 +00:00
|
|
|
struct linux_collect_regset_section_cb_data data;
|
2012-01-20 09:56:56 +00:00
|
|
|
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 15:26:43 +00:00
|
|
|
data.gdbarch = gdbarch;
|
|
|
|
data.regcache = regcache;
|
|
|
|
data.obfd = obfd;
|
|
|
|
data.note_data = note_data;
|
|
|
|
data.note_size = note_size;
|
|
|
|
data.stop_signal = stop_signal;
|
|
|
|
data.abort_iteration = 0;
|
2012-01-20 09:56:56 +00:00
|
|
|
|
|
|
|
/* For remote targets the LWP may not be available, so use the TID. */
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 15:26:43 +00:00
|
|
|
data.lwp = ptid_get_lwp (ptid);
|
|
|
|
if (!data.lwp)
|
|
|
|
data.lwp = ptid_get_tid (ptid);
|
|
|
|
|
|
|
|
gdbarch_iterate_over_regset_sections (gdbarch,
|
|
|
|
linux_collect_regset_section_cb,
|
|
|
|
&data, regcache);
|
|
|
|
return data.note_data;
|
2012-01-20 09:56:56 +00:00
|
|
|
}
|
|
|
|
|
2012-11-08 21:16:43 +00:00
|
|
|
/* Fetch the siginfo data for the current thread, if it exists. If
|
|
|
|
there is no data, or we could not read it, return NULL. Otherwise,
|
|
|
|
return a newly malloc'd buffer holding the data and fill in *SIZE
|
|
|
|
with the size of the data. The caller is responsible for freeing
|
|
|
|
the data. */
|
|
|
|
|
|
|
|
static gdb_byte *
|
|
|
|
linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
|
|
|
|
{
|
|
|
|
struct type *siginfo_type;
|
|
|
|
gdb_byte *buf;
|
|
|
|
LONGEST bytes_read;
|
|
|
|
struct cleanup *cleanups;
|
|
|
|
|
|
|
|
if (!gdbarch_get_siginfo_type_p (gdbarch))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
siginfo_type = gdbarch_get_siginfo_type (gdbarch);
|
|
|
|
|
|
|
|
buf = xmalloc (TYPE_LENGTH (siginfo_type));
|
|
|
|
cleanups = make_cleanup (xfree, buf);
|
|
|
|
|
|
|
|
bytes_read = target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
|
|
|
|
buf, 0, TYPE_LENGTH (siginfo_type));
|
|
|
|
if (bytes_read == TYPE_LENGTH (siginfo_type))
|
|
|
|
{
|
|
|
|
discard_cleanups (cleanups);
|
|
|
|
*size = bytes_read;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do_cleanups (cleanups);
|
|
|
|
buf = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
struct linux_corefile_thread_data
|
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch;
|
|
|
|
int pid;
|
|
|
|
bfd *obfd;
|
|
|
|
char *note_data;
|
|
|
|
int *note_size;
|
2012-05-24 16:39:15 +00:00
|
|
|
enum gdb_signal stop_signal;
|
2012-01-20 09:56:56 +00:00
|
|
|
linux_collect_thread_registers_ftype collect;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Called by gdbthread.c once per thread. Records the thread's
|
|
|
|
register state for the corefile note section. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
linux_corefile_thread_callback (struct thread_info *info, void *data)
|
|
|
|
{
|
|
|
|
struct linux_corefile_thread_data *args = data;
|
|
|
|
|
2014-08-21 18:36:20 +00:00
|
|
|
/* It can be current thread
|
|
|
|
which cannot be removed by update_thread_list. */
|
|
|
|
if (info->state == THREAD_EXITED)
|
|
|
|
return 0;
|
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
if (ptid_get_pid (info->ptid) == args->pid)
|
|
|
|
{
|
|
|
|
struct cleanup *old_chain;
|
|
|
|
struct regcache *regcache;
|
2012-11-08 21:16:43 +00:00
|
|
|
gdb_byte *siginfo_data;
|
2013-10-30 01:05:18 +00:00
|
|
|
LONGEST siginfo_size = 0;
|
2012-11-08 21:16:43 +00:00
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
regcache = get_thread_arch_regcache (info->ptid, args->gdbarch);
|
|
|
|
|
|
|
|
old_chain = save_inferior_ptid ();
|
|
|
|
inferior_ptid = info->ptid;
|
|
|
|
target_fetch_registers (regcache, -1);
|
2012-11-08 21:16:43 +00:00
|
|
|
siginfo_data = linux_get_siginfo_data (args->gdbarch, &siginfo_size);
|
2012-01-20 09:56:56 +00:00
|
|
|
do_cleanups (old_chain);
|
|
|
|
|
2012-11-08 21:16:43 +00:00
|
|
|
old_chain = make_cleanup (xfree, siginfo_data);
|
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
args->note_data = args->collect (regcache, info->ptid, args->obfd,
|
|
|
|
args->note_data, args->note_size,
|
|
|
|
args->stop_signal);
|
2012-11-08 21:16:43 +00:00
|
|
|
|
2013-10-24 19:37:49 +00:00
|
|
|
/* Don't return anything if we got no register information above,
|
|
|
|
such a core file is useless. */
|
|
|
|
if (args->note_data != NULL)
|
|
|
|
if (siginfo_data != NULL)
|
2012-11-08 21:16:43 +00:00
|
|
|
args->note_data = elfcore_write_note (args->obfd,
|
|
|
|
args->note_data,
|
|
|
|
args->note_size,
|
|
|
|
"CORE", NT_SIGINFO,
|
|
|
|
siginfo_data, siginfo_size);
|
|
|
|
|
|
|
|
do_cleanups (old_chain);
|
2012-01-20 09:56:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return !args->note_data;
|
|
|
|
}
|
|
|
|
|
2013-02-04 18:40:41 +00:00
|
|
|
/* Fill the PRPSINFO structure with information about the process being
|
|
|
|
debugged. Returns 1 in case of success, 0 for failures. Please note that
|
|
|
|
even if the structure cannot be entirely filled (e.g., GDB was unable to
|
|
|
|
gather information about the process UID/GID), this function will still
|
|
|
|
return 1 since some information was already recorded. It will only return
|
|
|
|
0 iff nothing can be gathered. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
|
|
|
|
{
|
|
|
|
/* The filename which we will use to obtain some info about the process.
|
|
|
|
We will basically use this to store the `/proc/PID/FILENAME' file. */
|
|
|
|
char filename[100];
|
|
|
|
/* The full name of the program which generated the corefile. */
|
|
|
|
char *fname;
|
|
|
|
/* The basename of the executable. */
|
|
|
|
const char *basename;
|
|
|
|
/* The arguments of the program. */
|
|
|
|
char *psargs;
|
|
|
|
char *infargs;
|
|
|
|
/* The contents of `/proc/PID/stat' and `/proc/PID/status' files. */
|
|
|
|
char *proc_stat, *proc_status;
|
|
|
|
/* Temporary buffer. */
|
|
|
|
char *tmpstr;
|
|
|
|
/* The valid states of a process, according to the Linux kernel. */
|
|
|
|
const char valid_states[] = "RSDTZW";
|
|
|
|
/* The program state. */
|
|
|
|
const char *prog_state;
|
|
|
|
/* The state of the process. */
|
|
|
|
char pr_sname;
|
|
|
|
/* The PID of the program which generated the corefile. */
|
|
|
|
pid_t pid;
|
|
|
|
/* Process flags. */
|
|
|
|
unsigned int pr_flag;
|
|
|
|
/* Process nice value. */
|
|
|
|
long pr_nice;
|
|
|
|
/* The number of fields read by `sscanf'. */
|
|
|
|
int n_fields = 0;
|
|
|
|
/* Cleanups. */
|
|
|
|
struct cleanup *c;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
gdb_assert (p != NULL);
|
|
|
|
|
|
|
|
/* Obtaining PID and filename. */
|
|
|
|
pid = ptid_get_pid (inferior_ptid);
|
|
|
|
xsnprintf (filename, sizeof (filename), "/proc/%d/cmdline", (int) pid);
|
|
|
|
fname = target_fileio_read_stralloc (filename);
|
|
|
|
|
|
|
|
if (fname == NULL || *fname == '\0')
|
|
|
|
{
|
|
|
|
/* No program name was read, so we won't be able to retrieve more
|
|
|
|
information about the process. */
|
|
|
|
xfree (fname);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
c = make_cleanup (xfree, fname);
|
|
|
|
memset (p, 0, sizeof (*p));
|
|
|
|
|
|
|
|
/* Defining the PID. */
|
|
|
|
p->pr_pid = pid;
|
|
|
|
|
|
|
|
/* Copying the program name. Only the basename matters. */
|
|
|
|
basename = lbasename (fname);
|
|
|
|
strncpy (p->pr_fname, basename, sizeof (p->pr_fname));
|
|
|
|
p->pr_fname[sizeof (p->pr_fname) - 1] = '\0';
|
|
|
|
|
|
|
|
infargs = get_inferior_args ();
|
|
|
|
|
|
|
|
psargs = xstrdup (fname);
|
|
|
|
if (infargs != NULL)
|
|
|
|
psargs = reconcat (psargs, psargs, " ", infargs, NULL);
|
|
|
|
|
|
|
|
make_cleanup (xfree, psargs);
|
|
|
|
|
|
|
|
strncpy (p->pr_psargs, psargs, sizeof (p->pr_psargs));
|
|
|
|
p->pr_psargs[sizeof (p->pr_psargs) - 1] = '\0';
|
|
|
|
|
|
|
|
xsnprintf (filename, sizeof (filename), "/proc/%d/stat", (int) pid);
|
|
|
|
proc_stat = target_fileio_read_stralloc (filename);
|
|
|
|
make_cleanup (xfree, proc_stat);
|
|
|
|
|
|
|
|
if (proc_stat == NULL || *proc_stat == '\0')
|
|
|
|
{
|
|
|
|
/* Despite being unable to read more information about the
|
|
|
|
process, we return 1 here because at least we have its
|
|
|
|
command line, PID and arguments. */
|
|
|
|
do_cleanups (c);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ok, we have the stats. It's time to do a little parsing of the
|
|
|
|
contents of the buffer, so that we end up reading what we want.
|
|
|
|
|
|
|
|
The following parsing mechanism is strongly based on the
|
|
|
|
information generated by the `fs/proc/array.c' file, present in
|
|
|
|
the Linux kernel tree. More details about how the information is
|
|
|
|
displayed can be obtained by seeing the manpage of proc(5),
|
|
|
|
specifically under the entry of `/proc/[pid]/stat'. */
|
|
|
|
|
|
|
|
/* Getting rid of the PID, since we already have it. */
|
|
|
|
while (isdigit (*proc_stat))
|
|
|
|
++proc_stat;
|
|
|
|
|
|
|
|
proc_stat = skip_spaces (proc_stat);
|
|
|
|
|
2014-02-21 17:39:40 +00:00
|
|
|
/* ps command also relies on no trailing fields ever contain ')'. */
|
|
|
|
proc_stat = strrchr (proc_stat, ')');
|
|
|
|
if (proc_stat == NULL)
|
|
|
|
{
|
|
|
|
do_cleanups (c);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
proc_stat++;
|
2013-02-04 18:40:41 +00:00
|
|
|
|
|
|
|
proc_stat = skip_spaces (proc_stat);
|
|
|
|
|
|
|
|
n_fields = sscanf (proc_stat,
|
|
|
|
"%c" /* Process state. */
|
|
|
|
"%d%d%d" /* Parent PID, group ID, session ID. */
|
|
|
|
"%*d%*d" /* tty_nr, tpgid (not used). */
|
|
|
|
"%u" /* Flags. */
|
|
|
|
"%*s%*s%*s%*s" /* minflt, cminflt, majflt,
|
|
|
|
cmajflt (not used). */
|
|
|
|
"%*s%*s%*s%*s" /* utime, stime, cutime,
|
|
|
|
cstime (not used). */
|
|
|
|
"%*s" /* Priority (not used). */
|
|
|
|
"%ld", /* Nice. */
|
|
|
|
&pr_sname,
|
|
|
|
&p->pr_ppid, &p->pr_pgrp, &p->pr_sid,
|
|
|
|
&pr_flag,
|
|
|
|
&pr_nice);
|
|
|
|
|
|
|
|
if (n_fields != 6)
|
|
|
|
{
|
|
|
|
/* Again, we couldn't read the complementary information about
|
|
|
|
the process state. However, we already have minimal
|
|
|
|
information, so we just return 1 here. */
|
|
|
|
do_cleanups (c);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Filling the structure fields. */
|
|
|
|
prog_state = strchr (valid_states, pr_sname);
|
|
|
|
if (prog_state != NULL)
|
|
|
|
p->pr_state = prog_state - valid_states;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Zero means "Running". */
|
|
|
|
p->pr_state = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->pr_sname = p->pr_state > 5 ? '.' : pr_sname;
|
|
|
|
p->pr_zomb = p->pr_sname == 'Z';
|
|
|
|
p->pr_nice = pr_nice;
|
|
|
|
p->pr_flag = pr_flag;
|
|
|
|
|
|
|
|
/* Finally, obtaining the UID and GID. For that, we read and parse the
|
|
|
|
contents of the `/proc/PID/status' file. */
|
|
|
|
xsnprintf (filename, sizeof (filename), "/proc/%d/status", (int) pid);
|
|
|
|
proc_status = target_fileio_read_stralloc (filename);
|
|
|
|
make_cleanup (xfree, proc_status);
|
|
|
|
|
|
|
|
if (proc_status == NULL || *proc_status == '\0')
|
|
|
|
{
|
|
|
|
/* Returning 1 since we already have a bunch of information. */
|
|
|
|
do_cleanups (c);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extracting the UID. */
|
|
|
|
tmpstr = strstr (proc_status, "Uid:");
|
|
|
|
if (tmpstr != NULL)
|
|
|
|
{
|
|
|
|
/* Advancing the pointer to the beginning of the UID. */
|
|
|
|
tmpstr += sizeof ("Uid:");
|
|
|
|
while (*tmpstr != '\0' && !isdigit (*tmpstr))
|
|
|
|
++tmpstr;
|
|
|
|
|
|
|
|
if (isdigit (*tmpstr))
|
|
|
|
p->pr_uid = strtol (tmpstr, &tmpstr, 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extracting the GID. */
|
|
|
|
tmpstr = strstr (proc_status, "Gid:");
|
|
|
|
if (tmpstr != NULL)
|
|
|
|
{
|
|
|
|
/* Advancing the pointer to the beginning of the GID. */
|
|
|
|
tmpstr += sizeof ("Gid:");
|
|
|
|
while (*tmpstr != '\0' && !isdigit (*tmpstr))
|
|
|
|
++tmpstr;
|
|
|
|
|
|
|
|
if (isdigit (*tmpstr))
|
|
|
|
p->pr_gid = strtol (tmpstr, &tmpstr, 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
do_cleanups (c);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
/* Fills the "to_make_corefile_note" target vector. Builds the note
|
|
|
|
section for a corefile, and returns it in a malloc buffer. */
|
|
|
|
|
|
|
|
char *
|
|
|
|
linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size,
|
|
|
|
linux_collect_thread_registers_ftype collect)
|
|
|
|
{
|
|
|
|
struct linux_corefile_thread_data thread_args;
|
2013-02-04 18:40:41 +00:00
|
|
|
struct elf_internal_linux_prpsinfo prpsinfo;
|
2012-01-20 09:56:56 +00:00
|
|
|
char *note_data = NULL;
|
|
|
|
gdb_byte *auxv;
|
|
|
|
int auxv_len;
|
2014-08-21 18:36:20 +00:00
|
|
|
volatile struct gdb_exception e;
|
2012-01-20 09:56:56 +00:00
|
|
|
|
2013-02-04 18:40:41 +00:00
|
|
|
if (linux_fill_prpsinfo (&prpsinfo))
|
2012-01-20 09:56:56 +00:00
|
|
|
{
|
2013-02-04 18:40:41 +00:00
|
|
|
if (gdbarch_elfcore_write_linux_prpsinfo_p (gdbarch))
|
|
|
|
{
|
|
|
|
note_data = gdbarch_elfcore_write_linux_prpsinfo (gdbarch, obfd,
|
|
|
|
note_data, note_size,
|
|
|
|
&prpsinfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gdbarch_ptr_bit (gdbarch) == 64)
|
|
|
|
note_data = elfcore_write_linux_prpsinfo64 (obfd,
|
|
|
|
note_data, note_size,
|
|
|
|
&prpsinfo);
|
|
|
|
else
|
|
|
|
note_data = elfcore_write_linux_prpsinfo32 (obfd,
|
|
|
|
note_data, note_size,
|
|
|
|
&prpsinfo);
|
|
|
|
}
|
2012-01-20 09:56:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Thread register information. */
|
2014-08-21 18:36:20 +00:00
|
|
|
TRY_CATCH (e, RETURN_MASK_ERROR)
|
|
|
|
{
|
|
|
|
update_thread_list ();
|
|
|
|
}
|
|
|
|
if (e.reason < 0)
|
|
|
|
exception_print (gdb_stderr, e);
|
2012-01-20 09:56:56 +00:00
|
|
|
thread_args.gdbarch = gdbarch;
|
|
|
|
thread_args.pid = ptid_get_pid (inferior_ptid);
|
|
|
|
thread_args.obfd = obfd;
|
|
|
|
thread_args.note_data = note_data;
|
|
|
|
thread_args.note_size = note_size;
|
|
|
|
thread_args.stop_signal = find_stop_signal ();
|
|
|
|
thread_args.collect = collect;
|
|
|
|
iterate_over_threads (linux_corefile_thread_callback, &thread_args);
|
|
|
|
note_data = thread_args.note_data;
|
|
|
|
if (!note_data)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* Auxillary vector. */
|
|
|
|
auxv_len = target_read_alloc (¤t_target, TARGET_OBJECT_AUXV,
|
|
|
|
NULL, &auxv);
|
|
|
|
if (auxv_len > 0)
|
|
|
|
{
|
|
|
|
note_data = elfcore_write_note (obfd, note_data, note_size,
|
|
|
|
"CORE", NT_AUXV, auxv, auxv_len);
|
|
|
|
xfree (auxv);
|
|
|
|
|
|
|
|
if (!note_data)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SPU information. */
|
|
|
|
note_data = linux_spu_make_corefile_notes (obfd, note_data, note_size);
|
|
|
|
if (!note_data)
|
|
|
|
return NULL;
|
|
|
|
|
2012-12-14 15:30:38 +00:00
|
|
|
/* File mappings. */
|
|
|
|
note_data = linux_make_mappings_corefile_notes (gdbarch, obfd,
|
|
|
|
note_data, note_size);
|
|
|
|
|
2012-01-20 09:56:56 +00:00
|
|
|
return note_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
linux_make_corefile_notes_1 (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
|
|
|
|
{
|
|
|
|
/* FIXME: uweigand/2011-10-06: Once all GNU/Linux architectures have been
|
|
|
|
converted to gdbarch_core_regset_sections, we no longer need to fall back
|
|
|
|
to the target method at this point. */
|
|
|
|
|
Replace 'core_regset_sections' by iterator method
The core_regset_sections list in gdbarch (needed for multi-arch
capable core file generation support) is replaced by an iterator
method. Overall, this reduces the code a bit, and it allows for more
flexibility.
gdb/ChangeLog:
* amd64-linux-tdep.c (amd64_linux_regset_sections): Remove.
(amd64_linux_iterate_over_regset_sections): New.
(amd64_linux_init_abi_common): Don't install the regset section
list, but the new iterator in gdbarch.
* arm-linux-tdep.c (arm_linux_fpa_regset_sections)
(arm_linux_vfp_regset_sections): Remove. Move combined logic...
(arm_linux_iterate_over_regset_sections): ...here. New function.
(arm_linux_init_abi): Set iterator instead of section list.
* corelow.c (get_core_registers_cb): New function, logic moved
from...
(get_core_registers): ...loop body here. Use new iterator method
instead of walking through the regset section list.
* gdbarch.sh: Remove 'core_regset_sections'. New method
'iterate_over_regset_sections'. New typedef
'iterate_over_regset_sections_cb'.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* i386-linux-tdep.c (i386_linux_regset_sections)
(i386_linux_sse_regset_sections, i386_linux_avx_regset_sections):
Remove.
(i386_linux_iterate_over_regset_sections): New.
(i386_linux_init_abi): Don't choose a regset section list, but
install new iterator in gdbarch.
* linux-tdep.c (struct linux_collect_regset_section_cb_data): New.
(linux_collect_regset_section_cb): New function, logic moved
from...
(linux_collect_thread_registers): ...loop body here. Use iterator
method instead of walking through list.
(linux_make_corefile_notes_1): Check for presence of iterator
method instead of regset section list.
* ppc-linux-tdep.c (ppc_linux_vsx_regset_sections)
(ppc_linux_vmx_regset_sections, ppc_linux_fp_regset_sections)
(ppc64_linux_vsx_regset_sections, ppc64_linux_vmx_regset_sections)
(ppc64_linux_fp_regset_sections): Remove. Move combined logic...
(ppc_linux_iterate_over_regset_sections): ...here. New function.
(ppc_linux_init_abi): Don't choose from above regset section
lists, but install new iterator in gdbarch.
* regset.h (struct core_regset_section): Remove.
* s390-linux-tdep.c (struct gdbarch_tdep): Add new fields
have_linux_v1, have_linux_v2, and have_tdb.
(s390_linux32_regset_sections, s390_linux32v1_regset_sections)
(s390_linux32v2_regset_sections, s390_linux64_regset_sections)
(s390_linux64v1_regset_sections, s390_linux64v2_regset_sections)
(s390x_linux64_regset_sections, s390x_linux64v1_regset_sections)
(s390x_linux64v2_regset_sections): Remove. Move combined logic...
(s390_iterate_over_regset_sections): ...here. New function. Use
new tdep fields.
(s390_gdbarch_init): Set new tdep fields. Don't choose from above
regset section lists, but install new iterator.
2014-09-04 15:26:43 +00:00
|
|
|
if (!gdbarch_iterate_over_regset_sections_p (gdbarch))
|
2012-01-20 09:56:56 +00:00
|
|
|
return target_make_corefile_notes (obfd, note_size);
|
|
|
|
else
|
|
|
|
return linux_make_corefile_notes (gdbarch, obfd, note_size,
|
|
|
|
linux_collect_thread_registers);
|
|
|
|
}
|
|
|
|
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 16:54:43 +00:00
|
|
|
/* Implementation of `gdbarch_gdb_signal_from_target', as defined in
|
|
|
|
gdbarch.h. This function is not static because it is exported to
|
|
|
|
other -tdep files. */
|
|
|
|
|
|
|
|
enum gdb_signal
|
|
|
|
linux_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
|
|
|
|
{
|
|
|
|
switch (signal)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return GDB_SIGNAL_0;
|
|
|
|
|
|
|
|
case LINUX_SIGHUP:
|
|
|
|
return GDB_SIGNAL_HUP;
|
|
|
|
|
|
|
|
case LINUX_SIGINT:
|
|
|
|
return GDB_SIGNAL_INT;
|
|
|
|
|
|
|
|
case LINUX_SIGQUIT:
|
|
|
|
return GDB_SIGNAL_QUIT;
|
|
|
|
|
|
|
|
case LINUX_SIGILL:
|
|
|
|
return GDB_SIGNAL_ILL;
|
|
|
|
|
|
|
|
case LINUX_SIGTRAP:
|
|
|
|
return GDB_SIGNAL_TRAP;
|
|
|
|
|
|
|
|
case LINUX_SIGABRT:
|
|
|
|
return GDB_SIGNAL_ABRT;
|
|
|
|
|
|
|
|
case LINUX_SIGBUS:
|
|
|
|
return GDB_SIGNAL_BUS;
|
|
|
|
|
|
|
|
case LINUX_SIGFPE:
|
|
|
|
return GDB_SIGNAL_FPE;
|
|
|
|
|
|
|
|
case LINUX_SIGKILL:
|
|
|
|
return GDB_SIGNAL_KILL;
|
|
|
|
|
|
|
|
case LINUX_SIGUSR1:
|
|
|
|
return GDB_SIGNAL_USR1;
|
|
|
|
|
|
|
|
case LINUX_SIGSEGV:
|
|
|
|
return GDB_SIGNAL_SEGV;
|
|
|
|
|
|
|
|
case LINUX_SIGUSR2:
|
|
|
|
return GDB_SIGNAL_USR2;
|
|
|
|
|
|
|
|
case LINUX_SIGPIPE:
|
|
|
|
return GDB_SIGNAL_PIPE;
|
|
|
|
|
|
|
|
case LINUX_SIGALRM:
|
|
|
|
return GDB_SIGNAL_ALRM;
|
|
|
|
|
|
|
|
case LINUX_SIGTERM:
|
|
|
|
return GDB_SIGNAL_TERM;
|
|
|
|
|
|
|
|
case LINUX_SIGCHLD:
|
|
|
|
return GDB_SIGNAL_CHLD;
|
|
|
|
|
|
|
|
case LINUX_SIGCONT:
|
|
|
|
return GDB_SIGNAL_CONT;
|
|
|
|
|
|
|
|
case LINUX_SIGSTOP:
|
|
|
|
return GDB_SIGNAL_STOP;
|
|
|
|
|
|
|
|
case LINUX_SIGTSTP:
|
|
|
|
return GDB_SIGNAL_TSTP;
|
|
|
|
|
|
|
|
case LINUX_SIGTTIN:
|
|
|
|
return GDB_SIGNAL_TTIN;
|
|
|
|
|
|
|
|
case LINUX_SIGTTOU:
|
|
|
|
return GDB_SIGNAL_TTOU;
|
|
|
|
|
|
|
|
case LINUX_SIGURG:
|
|
|
|
return GDB_SIGNAL_URG;
|
|
|
|
|
|
|
|
case LINUX_SIGXCPU:
|
|
|
|
return GDB_SIGNAL_XCPU;
|
|
|
|
|
|
|
|
case LINUX_SIGXFSZ:
|
|
|
|
return GDB_SIGNAL_XFSZ;
|
|
|
|
|
|
|
|
case LINUX_SIGVTALRM:
|
|
|
|
return GDB_SIGNAL_VTALRM;
|
|
|
|
|
|
|
|
case LINUX_SIGPROF:
|
|
|
|
return GDB_SIGNAL_PROF;
|
|
|
|
|
|
|
|
case LINUX_SIGWINCH:
|
|
|
|
return GDB_SIGNAL_WINCH;
|
|
|
|
|
|
|
|
/* No way to differentiate between SIGIO and SIGPOLL.
|
|
|
|
Therefore, we just handle the first one. */
|
|
|
|
case LINUX_SIGIO:
|
|
|
|
return GDB_SIGNAL_IO;
|
|
|
|
|
|
|
|
case LINUX_SIGPWR:
|
|
|
|
return GDB_SIGNAL_PWR;
|
|
|
|
|
|
|
|
case LINUX_SIGSYS:
|
|
|
|
return GDB_SIGNAL_SYS;
|
|
|
|
|
|
|
|
/* SIGRTMIN and SIGRTMAX are not continuous in <gdb/signals.def>,
|
|
|
|
therefore we have to handle them here. */
|
|
|
|
case LINUX_SIGRTMIN:
|
|
|
|
return GDB_SIGNAL_REALTIME_32;
|
|
|
|
|
|
|
|
case LINUX_SIGRTMAX:
|
|
|
|
return GDB_SIGNAL_REALTIME_64;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (signal >= LINUX_SIGRTMIN + 1 && signal <= LINUX_SIGRTMAX - 1)
|
|
|
|
{
|
|
|
|
int offset = signal - LINUX_SIGRTMIN + 1;
|
|
|
|
|
|
|
|
return (enum gdb_signal) ((int) GDB_SIGNAL_REALTIME_33 + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return GDB_SIGNAL_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Implementation of `gdbarch_gdb_signal_to_target', as defined in
|
|
|
|
gdbarch.h. This function is not static because it is exported to
|
|
|
|
other -tdep files. */
|
|
|
|
|
|
|
|
int
|
|
|
|
linux_gdb_signal_to_target (struct gdbarch *gdbarch,
|
|
|
|
enum gdb_signal signal)
|
|
|
|
{
|
|
|
|
switch (signal)
|
|
|
|
{
|
|
|
|
case GDB_SIGNAL_0:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_HUP:
|
|
|
|
return LINUX_SIGHUP;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_INT:
|
|
|
|
return LINUX_SIGINT;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_QUIT:
|
|
|
|
return LINUX_SIGQUIT;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_ILL:
|
|
|
|
return LINUX_SIGILL;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_TRAP:
|
|
|
|
return LINUX_SIGTRAP;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_ABRT:
|
|
|
|
return LINUX_SIGABRT;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_FPE:
|
|
|
|
return LINUX_SIGFPE;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_KILL:
|
|
|
|
return LINUX_SIGKILL;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_BUS:
|
|
|
|
return LINUX_SIGBUS;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_SEGV:
|
|
|
|
return LINUX_SIGSEGV;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_SYS:
|
|
|
|
return LINUX_SIGSYS;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_PIPE:
|
|
|
|
return LINUX_SIGPIPE;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_ALRM:
|
|
|
|
return LINUX_SIGALRM;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_TERM:
|
|
|
|
return LINUX_SIGTERM;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_URG:
|
|
|
|
return LINUX_SIGURG;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_STOP:
|
|
|
|
return LINUX_SIGSTOP;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_TSTP:
|
|
|
|
return LINUX_SIGTSTP;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_CONT:
|
|
|
|
return LINUX_SIGCONT;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_CHLD:
|
|
|
|
return LINUX_SIGCHLD;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_TTIN:
|
|
|
|
return LINUX_SIGTTIN;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_TTOU:
|
|
|
|
return LINUX_SIGTTOU;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_IO:
|
|
|
|
return LINUX_SIGIO;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_XCPU:
|
|
|
|
return LINUX_SIGXCPU;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_XFSZ:
|
|
|
|
return LINUX_SIGXFSZ;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_VTALRM:
|
|
|
|
return LINUX_SIGVTALRM;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_PROF:
|
|
|
|
return LINUX_SIGPROF;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_WINCH:
|
|
|
|
return LINUX_SIGWINCH;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_USR1:
|
|
|
|
return LINUX_SIGUSR1;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_USR2:
|
|
|
|
return LINUX_SIGUSR2;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_PWR:
|
|
|
|
return LINUX_SIGPWR;
|
|
|
|
|
|
|
|
case GDB_SIGNAL_POLL:
|
|
|
|
return LINUX_SIGPOLL;
|
|
|
|
|
|
|
|
/* GDB_SIGNAL_REALTIME_32 is not continuous in <gdb/signals.def>,
|
|
|
|
therefore we have to handle it here. */
|
|
|
|
case GDB_SIGNAL_REALTIME_32:
|
|
|
|
return LINUX_SIGRTMIN;
|
|
|
|
|
|
|
|
/* Same comment applies to _64. */
|
|
|
|
case GDB_SIGNAL_REALTIME_64:
|
|
|
|
return LINUX_SIGRTMAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* GDB_SIGNAL_REALTIME_33 to _64 are continuous. */
|
|
|
|
if (signal >= GDB_SIGNAL_REALTIME_33
|
|
|
|
&& signal <= GDB_SIGNAL_REALTIME_63)
|
|
|
|
{
|
|
|
|
int offset = signal - GDB_SIGNAL_REALTIME_33;
|
|
|
|
|
|
|
|
return LINUX_SIGRTMIN + 1 + offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-08-04 15:27:57 +00:00
|
|
|
/* To be called from the various GDB_OSABI_LINUX handlers for the
|
|
|
|
various GNU/Linux architectures and machine types. */
|
|
|
|
|
|
|
|
void
|
|
|
|
linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
set_gdbarch_core_pid_to_str (gdbarch, linux_core_pid_to_str);
|
2012-01-20 09:49:58 +00:00
|
|
|
set_gdbarch_info_proc (gdbarch, linux_info_proc);
|
2012-12-14 15:30:38 +00:00
|
|
|
set_gdbarch_core_info_proc (gdbarch, linux_core_info_proc);
|
2012-01-20 09:59:15 +00:00
|
|
|
set_gdbarch_find_memory_regions (gdbarch, linux_find_memory_regions);
|
2012-01-20 09:56:56 +00:00
|
|
|
set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes_1);
|
2012-03-01 21:12:47 +00:00
|
|
|
set_gdbarch_has_shared_address_space (gdbarch,
|
|
|
|
linux_has_shared_address_space);
|
This patch implements the new gdbarch method gdbarch_gdb_signal_to_target.
It will be used when one wants to convert between the internal GDB signal
representation (enum gdb_signal) and the target's representation.
The idea of this patch came from a chat between Pedro and I on IRC, plus
the discussion of my patches to add the new $_exitsignal convenience
variable:
<http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
<http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
What I did was to investigate, on the Linux kernel, which targets shared
the signal numbers definition with the generic definition, present at
<include/uapi/asm-generic/signal.h>. For the record, I used linux-3.10-rc7
as the main source of information, always looking at
<arch/<ARCH_NAME>/include/uapi/asm/signal.h>. For SIGRTMAX (which defaults
to _NSIG in most cases), I had to look at different signal-related
files, but most of them (except MIPS) were defined to 64 anyway.
Then, with all the differences in hand, I implemented the bits on each
target.
2013-08-09 Sergio Durigan Junior <sergiodj@redhat.com>
* linux-tdep.c: Define enum with generic signal numbers.
(linux_gdb_signal_from_target): New function.
(linux_gdb_signal_to_target): Likewise.
(linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
methods to the functions above.
* linux-tdep.h (linux_gdb_signal_from_target): New prototype.
(linux_gdb_signal_to_target): Likewise.
* alpha-linux-tdep.c: Define new enum with signals different
from generic Linux kernel.
(alpha_linux_gdb_signal_from_target): New function.
(alpha_linux_gdb_signal_to_target): Likewise.
(alpha_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
with the functions mentioned above.
* avr-tdep.c: Define enum with differences between Linux kernel
and AVR signals.
(avr_linux_gdb_signal_from_target): New function.
(avr_linux_gdb_signal_to_target): Likewise.
(avr_gdbarch_init): Set gdbarch_gdb_signal_{to,from}_target to
the functions mentioned above.
* sparc-linux-tdep.c: Define enum with differences between SPARC
and generic Linux kernel signal numbers.
(sparc32_linux_gdb_signal_from_target): New function.
(sparc32_linux_gdb_signal_to_target): Likewise.
(sparc32_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
to the functions defined above.
* xtensa-linux-tdep.c: Define enum with differences between
Xtensa and Linux kernel generic signals.
(xtensa_linux_gdb_signal_from_target): New function.
(xtensa_linux_gdb_signal_to_target): Likewise.
(xtensa_linux_init_abi): Set gdbarch_gdb_signal_to_target
to the functions defined above.
* mips-linux-tdep.c: Define enum with differences between
signals in MIPS and Linux kernel generic ones.
(mips_gdb_signal_to_target): New function.
(mips_gdb_signal_from_target): Redefine to use new enum, handle
only different signals from the Linux kernel generic.
(mips_linux_init_abi): Set gdbarch_gdb_signal_{to,from}_target
the functions defined above.
* mips-linux-tdep.h (enum mips_signals): Remove.
2013-08-09 16:54:43 +00:00
|
|
|
set_gdbarch_gdb_signal_from_target (gdbarch,
|
|
|
|
linux_gdb_signal_from_target);
|
|
|
|
set_gdbarch_gdb_signal_to_target (gdbarch,
|
|
|
|
linux_gdb_signal_to_target);
|
2010-08-04 15:27:57 +00:00
|
|
|
}
|
2010-08-31 18:11:48 +00:00
|
|
|
|
2012-03-01 Pedro Alves <palves@redhat.com>
* amd64-linux-tdep.c (amd64_linux_record_signal): Make static.
* breakpoint.c (create_exception_master_breakpoint, trace_command)
(ftrace_command, strace_command): Make static.
* d-lang.c (_initialize_d_language): Declare.
* dwarf2expr.c (_initialize_dwarf2expr): Declare.
* dwarf2loc.c (_initialize_dwarf2loc):
* dwarf2read.c (process_psymtab_comp_unit): Make static.
* exec.c (exec_get_section_table): Make static.
* i386-linux-tdep.c (i386_linux_record_signal): Make static.
* infcmd.c (ensure_valid_thread, ensure_not_tfind_mode): Make static.
* inferior.c (remove_inferior_command, add_inferior_command)
(clone_inferior_command): Make static.
* linux-nat.c (linux_nat_thread_address_space)
(linux_nat_core_of_thread): Make static.
* linux-tdep.c (_initialize_linux_tdep): Declare.
* objc-lang.c (_initialize_objc_lang): Declare.
* opencl-lang.c (builtin_opencl_type, opencl_language_arch_info):
Make static.
(_initialize_opencl_language): Declare.
* record.c (_initialize_record): Declare.
* remote.c (demand_private_info, remote_get_tib_address)
(remote_supports_cond_tracepoints)
(remote_supports_fast_tracepoints, remote_get_tracepoint_status):
Make static.
* skip.c (_initialize_step_skip): Declare.
* symtab.c (skip_prologue_using_lineinfo): Make static.
* tracepoint.c (delete_trace_state_variable)
(trace_variable_command, delete_trace_variable_command)
(get_uploaded_tsv, find_matching_tracepoint_location)
(find_matching_tsv, create_tsv_from_upload, get_traceframe_info):
Make static.
* value.c (pack_unsigned_long): Make static.
* varobj.c (varobj_ensure_python_env): Make static.
* windows-tdep.c (_initialize_windows_tdep): Declare.
* xml-syscall.c (make_cleanup_free_syscalls_info): Make static.
2012-03-01 21:14:00 +00:00
|
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
|
|
|
extern initialize_file_ftype _initialize_linux_tdep;
|
|
|
|
|
2010-08-31 18:11:48 +00:00
|
|
|
void
|
|
|
|
_initialize_linux_tdep (void)
|
|
|
|
{
|
|
|
|
linux_gdbarch_data_handle =
|
|
|
|
gdbarch_data_register_post_init (init_linux_gdbarch_data);
|
|
|
|
}
|