Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [commit] multi-executable support
       [not found] <200910191106.28905.pedro@codesourcery.com>
@ 2009-10-20  6:14 ` Hui Zhu
  2009-10-20 11:20   ` Pedro Alves
  2009-10-20 15:05 ` Ken Werner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Hui Zhu @ 2009-10-20  6:14 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

darwin-nat.c
  if (breakpoint_inserted_here_p (pc))

Hui

On Mon, Oct 19, 2009 at 18:06, Pedro Alves <pedro@codesourcery.com> wrote:
> On Tuesday 13 October 2009 14:40:47, Pedro Alves wrote:
>> ... I'll aim at applying this at the end of the week, say.
>
> Here's the patch that I just committed.
>
> 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".
>
> --
> Pedro Alves
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
  2009-10-20  6:14 ` [commit] multi-executable support Hui Zhu
@ 2009-10-20 11:20   ` Pedro Alves
  2009-10-21  2:18     ` Hui Zhu
  0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2009-10-20 11:20 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches

On Tuesday 20 October 2009 07:13:58, Hui Zhu wrote:
> darwin-nat.c
>   if (breakpoint_inserted_here_p (pc))

Thanks.  "grep breakpoint_inserted_here_p *nat*" doesn't find
any other missing adjustment in native target files.  I've no easy way
to test this, but the needed change is very simple.  Plus, this
function is a copy of linux-nat.c:cancel_breakpoint, where I did
the exact same change.

I'm applying this.

2009-10-20  Pedro Alves  <pedro@codesourcery.com>

	* darwin-nat.c (cancel_breakpoint): Pass the regcache's address
	space to breakpoint_inserted_here_p.

---
 gdb/darwin-nat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: src/gdb/darwin-nat.c
===================================================================
--- src.orig/gdb/darwin-nat.c	2009-10-20 12:15:12.000000000 +0100
+++ src/gdb/darwin-nat.c	2009-10-20 12:16:03.000000000 +0100
@@ -995,7 +995,7 @@ cancel_breakpoint (ptid_t ptid)
   CORE_ADDR pc;
 
   pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch);
-  if (breakpoint_inserted_here_p (pc))
+  if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc))
     {
       inferior_debug (4, "cancel_breakpoint for thread %x\n",
 		      ptid_get_tid (ptid));


-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
       [not found] <200910191106.28905.pedro@codesourcery.com>
  2009-10-20  6:14 ` [commit] multi-executable support Hui Zhu
@ 2009-10-20 15:05 ` Ken Werner
  2009-10-20 15:36   ` Pedro Alves
  2009-10-21  8:27 ` Obvious fix: deprecated_insert_raw_breakpoint change (was [commit] multi-executable support) Pierre Muller
  2009-11-13  1:09 ` [commit] multi-executable support Paul Pluzhnikov
  3 siblings, 1 reply; 12+ messages in thread
From: Ken Werner @ 2009-10-20 15:05 UTC (permalink / raw)
  To: gdb-patches, Pedro Alves

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

Pedro Alves wrote:
> On Tuesday 13 October 2009 14:40:47, Pedro Alves wrote:
>> ... I'll aim at applying this at the end of the week, say.
> 
> Here's the patch that I just committed.

I noticed the gdb/go32-nat.c and gdb/remote-sim.c are calling 
inferior_appeared_silent which is not declared by the inferior.h header. It 
looks like this is a typo. The attached patch calls inferior_appeared 
instead.

-ken

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: inferior_appeared.patch --]
[-- Type: text/x-patch; name="inferior_appeared.patch", Size: 1188 bytes --]

Index: src/gdb/go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.78
diff -u -r1.78 go32-nat.c
--- src/gdb/go32-nat.c	19 Oct 2009 09:51:41 -0000	1.78
+++ src/gdb/go32-nat.c	20 Oct 2009 07:26:33 -0000
@@ -716,7 +716,7 @@
 
   inferior_ptid = pid_to_ptid (SOME_PID);
   inf = current_inferior ();
-  inferior_appeared_silent (inf, SOME_PID);
+  inferior_appeared (inf, SOME_PID);
 
   push_target (&go32_ops);
 
Index: src/gdb/remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.91
diff -u -r1.91 remote-sim.c
--- src/gdb/remote-sim.c	19 Oct 2009 09:51:41 -0000	1.91
+++ src/gdb/remote-sim.c	20 Oct 2009 07:26:33 -0000
@@ -471,7 +471,7 @@
   sim_create_inferior (gdbsim_desc, exec_bfd, argv, env);
 
   inferior_ptid = remote_sim_ptid;
-  inferior_appeared_silent (current_inferior (), ptid_get_pid (inferior_ptid));
+  inferior_appeared (current_inferior (), ptid_get_pid (inferior_ptid));
   add_thread_silent (inferior_ptid);
 
   insert_breakpoints ();	/* Needed to get correct instruction in cache */


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
  2009-10-20 15:05 ` Ken Werner
@ 2009-10-20 15:36   ` Pedro Alves
  2009-10-20 15:54     ` Ken Werner
  0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2009-10-20 15:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ken Werner

On Tuesday 20 October 2009 16:04:22, Ken Werner wrote:
> I noticed the gdb/go32-nat.c and gdb/remote-sim.c are calling 
> inferior_appeared_silent which is not declared by the inferior.h header. It 
> looks like this is a typo. The attached patch calls inferior_appeared 
> instead.

Thanks, you're right.  This is OK, with changelog entry.  Do you have
write access to cvs?  Otherwise, I'll apply it.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
  2009-10-20 15:36   ` Pedro Alves
@ 2009-10-20 15:54     ` Ken Werner
  2009-10-20 16:34       ` Pedro Alves
  0 siblings, 1 reply; 12+ messages in thread
From: Ken Werner @ 2009-10-20 15:54 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pedro Alves

On Tuesday 20 October 2009 05:36:24 pm you wrote:
> On Tuesday 20 October 2009 16:04:22, Ken Werner wrote:
> > I noticed the gdb/go32-nat.c and gdb/remote-sim.c are calling
> > inferior_appeared_silent which is not declared by the inferior.h header.
> > It looks like this is a typo. The attached patch calls inferior_appeared
> > instead.
> 
> Thanks, you're right.  This is OK, with changelog entry.  Do you have
> write access to cvs?  Otherwise, I'll apply it.

Please go ahead since I do not have commit privileges.
Thanks.
-ken


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
  2009-10-20 15:54     ` Ken Werner
@ 2009-10-20 16:34       ` Pedro Alves
  0 siblings, 0 replies; 12+ messages in thread
From: Pedro Alves @ 2009-10-20 16:34 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ken Werner

On Tuesday 20 October 2009 16:54:32, Ken Werner wrote:
> On Tuesday 20 October 2009 05:36:24 pm you wrote:
> > On Tuesday 20 October 2009 16:04:22, Ken Werner wrote:
> > > I noticed the gdb/go32-nat.c and gdb/remote-sim.c are calling
> > > inferior_appeared_silent which is not declared by the inferior.h header.
> > > It looks like this is a typo. The attached patch calls inferior_appeared
> > > instead.
> > 
> > Thanks, you're right.  This is OK, with changelog entry.  Do you have
> > write access to cvs?  Otherwise, I'll apply it.
> 
> Please go ahead since I do not have commit privileges.

Done, with the ChangeLog entry below.  Thanks again.

2009-10-20  Ken Werner  <ken@linux.vnet.ibm.com>

	* go32-nat.c (go32_create_inferior): Use inferior_appeared, not
	inferior_appeared_silent.
	* remote-sim.c (gdbsim_create_inferior): Ditto.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
  2009-10-20 11:20   ` Pedro Alves
@ 2009-10-21  2:18     ` Hui Zhu
  0 siblings, 0 replies; 12+ messages in thread
From: Hui Zhu @ 2009-10-21  2:18 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Thanks.

Hui

On Tue, Oct 20, 2009 at 19:20, Pedro Alves <pedro@codesourcery.com> wrote:
> On Tuesday 20 October 2009 07:13:58, Hui Zhu wrote:
>> darwin-nat.c
>>   if (breakpoint_inserted_here_p (pc))
>
> Thanks.  "grep breakpoint_inserted_here_p *nat*" doesn't find
> any other missing adjustment in native target files.  I've no easy way
> to test this, but the needed change is very simple.  Plus, this
> function is a copy of linux-nat.c:cancel_breakpoint, where I did
> the exact same change.
>
> I'm applying this.
>
> 2009-10-20  Pedro Alves  <pedro@codesourcery.com>
>
>        * darwin-nat.c (cancel_breakpoint): Pass the regcache's address
>        space to breakpoint_inserted_here_p.
>
> ---
>  gdb/darwin-nat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: src/gdb/darwin-nat.c
> ===================================================================
> --- src.orig/gdb/darwin-nat.c   2009-10-20 12:15:12.000000000 +0100
> +++ src/gdb/darwin-nat.c        2009-10-20 12:16:03.000000000 +0100
> @@ -995,7 +995,7 @@ cancel_breakpoint (ptid_t ptid)
>   CORE_ADDR pc;
>
>   pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch);
> -  if (breakpoint_inserted_here_p (pc))
> +  if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc))
>     {
>       inferior_debug (4, "cancel_breakpoint for thread %x\n",
>                      ptid_get_tid (ptid));
>
>
> --
> Pedro Alves
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Obvious fix: deprecated_insert_raw_breakpoint change (was [commit] multi-executable support)
       [not found] <200910191106.28905.pedro@codesourcery.com>
  2009-10-20  6:14 ` [commit] multi-executable support Hui Zhu
  2009-10-20 15:05 ` Ken Werner
@ 2009-10-21  8:27 ` Pierre Muller
  2009-10-21  8:40   ` Pedro Alves
  2009-11-13  1:09 ` [commit] multi-executable support Paul Pluzhnikov
  3 siblings, 1 reply; 12+ messages in thread
From: Pierre Muller @ 2009-10-21  8:27 UTC (permalink / raw)
  To: 'Pedro Alves', gdb-patches

Pedro,

your patch missed two usages of 
depreacted_insert_raw_breakpoint function.
As you added a parameter, this caused
opensolaris compilation to fail...

  I looked at the source and
found out that using NULL parameter
is OK for targets not supporting multiple
address spaces.


Committed as obvious


Pierre Muller
Pascal language support maintainer for GDB




2009-10-21  Pierre Muller  <muller@ics.u-strasbg.fr>

	* rs6000-nat.c (exec_one_dummy_insn): Add missing new ASPACE parameter
	to depreacted_insert_raw_breakpoint function call.
	* procfs.c (insert_dbx_link_bpt_in_file): Likewise.

Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.98
diff -u -p -r1.98 rs6000-nat.c
--- rs6000-nat.c	18 Sep 2009 17:33:51 -0000	1.98
+++ rs6000-nat.c	21 Oct 2009 08:15:38 -0000
@@ -590,7 +590,7 @@ exec_one_dummy_insn (struct regcache *re
      assume that this address will never be executed again by the real
      code. */
 
-  bp = deprecated_insert_raw_breakpoint (gdbarch, DUMMY_INSN_ADDR);
+  bp = deprecated_insert_raw_breakpoint (gdbarch, NULL, DUMMY_INSN_ADDR);
 
   /* You might think this could be done with a single ptrace call, and
      you'd be correct for just about every platform I've ever worked
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.118
diff -u -p -r1.118 procfs.c
--- procfs.c	19 Oct 2009 09:51:41 -0000	1.118
+++ procfs.c	21 Oct 2009 08:15:39 -0000
@@ -5666,7 +5666,7 @@ insert_dbx_link_bpt_in_file (int fd, COR
     {
       /* Insert the breakpoint.  */
       dbx_link_bpt_addr = sym_addr;
-      dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch,
+      dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch, NULL,
 						       sym_addr);
       if (dbx_link_bpt == NULL)
         {

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Monday, October 19, 2009 12:06 PM
> À : gdb-patches@sourceware.org
> Objet : [commit] multi-executable support
> 
> On Tuesday 13 October 2009 14:40:47, Pedro Alves wrote:
> > ... I'll aim at applying this at the end of the week, say.
> 
> Here's the patch that I just committed.
> 
> 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".
> 
> --
> Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Obvious fix: deprecated_insert_raw_breakpoint change (was [commit] multi-executable support)
  2009-10-21  8:27 ` Obvious fix: deprecated_insert_raw_breakpoint change (was [commit] multi-executable support) Pierre Muller
@ 2009-10-21  8:40   ` Pedro Alves
  0 siblings, 0 replies; 12+ messages in thread
From: Pedro Alves @ 2009-10-21  8:40 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Wednesday 21 October 2009 09:27:37, Pierre Muller wrote:

> your patch missed two usages of 
> depreacted_insert_raw_breakpoint function.
> As you added a parameter, this caused
> opensolaris compilation to fail...

Thanks for fixing!

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
       [not found] <200910191106.28905.pedro@codesourcery.com>
                   ` (2 preceding siblings ...)
  2009-10-21  8:27 ` Obvious fix: deprecated_insert_raw_breakpoint change (was [commit] multi-executable support) Pierre Muller
@ 2009-11-13  1:09 ` Paul Pluzhnikov
  2009-11-15 22:53   ` Pedro Alves
  3 siblings, 1 reply; 12+ messages in thread
From: Paul Pluzhnikov @ 2009-11-13  1:09 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Mon, Oct 19, 2009 at 2:06 AM, Pedro Alves <pedro@codesourcery.com> wrote:

> 2009-10-19  Pedro Alves  <pedro@codesourcery.com>
>            Stan Shebs  <stan@codesourcery.com>
>
>        Add base multi-executable/process support to GDB.

This appears to be triggering an assert for me:

struct Foo {
  Foo();
  Foo(const char *);
  const char *bar();
  const char *x;
};

Foo::Foo(const char *y)
{
 x = y;
}

Foo::Foo()
{
  x = "Hello";
}

const char *
Foo::bar()
{
  return x;
}

int main()
{
  int x = 1;
  Foo f("abc");
  const char *s = f.bar();
}

g++ -g foo.cc && gdb-cvs ./a.out
GNU gdb (GDB) 7.0.50.20091113-cvs
...
This GDB was configured as "x86_64-unknown-linux-gnu".
Reading symbols from /usr/local/google/tmp/b1844402/a.out...done.
(gdb) b Foo::Foo
../../src/gdb/breakpoint.c:4789: internal-error: set_raw_breakpoint:
Assertion `sal.pspace != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Aborted (core dumped)

The crash is here:

#0  0x00007f72aeaee095 in raise () from /lib/libc.so.6
#1  0x00007f72aeaefaf0 in abort () from /lib/libc.so.6
#2  0x0000000000460c25 in internal_vproblem (problem=0xab3e90,
file=0x731a26 "../../src/gdb/breakpoint.c", line=4789, fmt=0x7319f2
"%s: Assertion `%s' failed.", ap=0x7fffb7c81ae0) at
../../src/gdb/utils.c:969
#3  0x0000000000460c82 in internal_verror (file=0x731a26
"../../src/gdb/breakpoint.c", line=4789, fmt=0x7319f2 "%s: Assertion
`%s' failed.", ap=0x7fffb7c81ae0) at ../../src/gdb/utils.c:994
#4  0x0000000000460d74 in internal_error (file=0x731a26
"../../src/gdb/breakpoint.c", line=4789, string=0x7319f2 "%s:
Assertion `%s' failed.") at ../../src/gdb/utils.c:1003
#5  0x00000000004f0623 in set_raw_breakpoint (gdbarch=0xc0e040,
sal=..., bptype=bp_breakpoint) at ../../src/gdb/breakpoint.c:4789
#6  0x00000000004f3126 in create_breakpoint (gdbarch=0xc0e040,
sals=..., addr_string=0xbffd70 "Foo", cond_string=0x0,
type=bp_breakpoint, disposition=disp_donttouch, thread=-1, task=0,
ignore_count=0, ops=0x0, from_tty=0,
    enabled=1) at ../../src/gdb/breakpoint.c:6098
#7  0x00000000004f39f7 in create_breakpoints (gdbarch=0xc0e040,
sals=..., addr_string=0xbe9390, cond_string=0x0, type=bp_breakpoint,
disposition=disp_donttouch, thread=-1, task=0, ignore_count=0,
ops=0x0, from_tty=0, enabled=1)
    at ../../src/gdb/breakpoint.c:6333
#8  0x00000000004f4439 in break_command_really (gdbarch=0xc0e040,
arg=0xae494a "", cond_string=0x0, thread=-1,
parse_condition_and_thread=1, tempflag=0, hardwareflag=0, traceflag=0,
ignore_count=0,
    pending_break_support=AUTO_BOOLEAN_AUTO, ops=0x0, from_tty=0,
enabled=1) at ../../src/gdb/breakpoint.c:6663
#9  0x00000000004f4635 in break_command_1 (arg=0xae4942 "Foo::Foo",
flag=0, from_tty=0) at ../../src/gdb/breakpoint.c:6721
#10 0x00000000004f4912 in break_command (arg=0xae4942 "Foo::Foo",
from_tty=0) at ../../src/gdb/breakpoint.c:6846

The 'sal' in frame 5 looks bogus:

(gdb) p sal
$1 = {pspace = 0x0, symtab = 0x0, section = 0x0, line = 0, pc = 0, end
= 0, explicit_pc = 0, explicit_line = 0}


The official 7.0 release does something unreasonable as well:

Reading symbols from /usr/local/google/tmp/b1844402/a.out...done.
(gdb) b Foo::Foo
Breakpoint 1 at 0x0
Note: breakpoint 1 also set at pc 0x0.
Breakpoint 2 at 0x0
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb)

but didn't assert.

-- 
Paul Pluzhnikov


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
  2009-11-13  1:09 ` [commit] multi-executable support Paul Pluzhnikov
@ 2009-11-15 22:53   ` Pedro Alves
  2009-11-16 18:42     ` Paul Pluzhnikov
  0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2009-11-15 22:53 UTC (permalink / raw)
  To: Paul Pluzhnikov; +Cc: gdb-patches

On Friday 13 November 2009 01:09:34, Paul Pluzhnikov wrote:
> On Mon, Oct 19, 2009 at 2:06 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> 
> > 2009-10-19  Pedro Alves  <pedro@codesourcery.com>
> >            Stan Shebs  <stan@codesourcery.com>
> >
> >        Add base multi-executable/process support to GDB.
> 
> This appears to be triggering an assert for me:

(...)

> The crash is here:

(...)

> The 'sal' in frame 5 looks bogus:
> 
> (gdb) p sal
> $1 = {pspace = 0x0, symtab = 0x0, section = 0x0, line = 0, pc = 0, end
> = 0, explicit_pc = 0, explicit_line = 0}

Indeed.

> The official 7.0 release does something unreasonable as well:
> 
> Reading symbols from /usr/local/google/tmp/b1844402/a.out...done.
> (gdb) b Foo::Foo
> Breakpoint 1 at 0x0
> Note: breakpoint 1 also set at pc 0x0.
> Breakpoint 2 at 0x0
> warning: Multiple breakpoints were set.
> Use the "delete" command to delete unwanted breakpoints.
> (gdb)
> 

This is what we need to fix.  Did you happen to take a
look at why this happens?

Could you open a PR, if there isn't one already, please?

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [commit] multi-executable support
  2009-11-15 22:53   ` Pedro Alves
@ 2009-11-16 18:42     ` Paul Pluzhnikov
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Pluzhnikov @ 2009-11-16 18:42 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Sun, Nov 15, 2009 at 2:52 PM, Pedro Alves <pedro@codesourcery.com> wrote:

> This is what we need to fix. Did you happen to take a
> look at why this happens?

Not yet: I was chasing the "first problem" in PR 10966 when I hit the assert.

> Could you open a PR, if there isn't one already, please?

Done: http://sourceware.org/bugzilla/show_bug.cgi?id=10966

Thanks,
-- 
Paul Pluzhnikov


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-11-16 18:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200910191106.28905.pedro@codesourcery.com>
2009-10-20  6:14 ` [commit] multi-executable support Hui Zhu
2009-10-20 11:20   ` Pedro Alves
2009-10-21  2:18     ` Hui Zhu
2009-10-20 15:05 ` Ken Werner
2009-10-20 15:36   ` Pedro Alves
2009-10-20 15:54     ` Ken Werner
2009-10-20 16:34       ` Pedro Alves
2009-10-21  8:27 ` Obvious fix: deprecated_insert_raw_breakpoint change (was [commit] multi-executable support) Pierre Muller
2009-10-21  8:40   ` Pedro Alves
2009-11-13  1:09 ` [commit] multi-executable support Paul Pluzhnikov
2009-11-15 22:53   ` Pedro Alves
2009-11-16 18:42     ` Paul Pluzhnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox