match a breakpoint.
(handle_inferior_event): Move the check for unusual breakpoint
signals earlier.
gdbserver/
* linux-low.c (get_stop_pc): Check for SIGTRAP.
(linux_wait_for_event_1): Handle SIGILL and SIGSEGV as possible
breakpoints.
never random signals.
* breakpoint.c (update_global_location_list): Always delete
immediately delete hardware watchpoint locations and other
locations whose target address isn't meaningful. Update comment
explaining the hazard of moribund locations.
event, check if the bpstat causes a stop, instead of if it
explains the signal.
* breakpoint.c (bpstat_causes_stop): New.
* breakpoint.h (bpstat_causes_stop): Declare.
the pspace doesn't allow breakpoints.
(insert_breakpoint_locations): Remove waiting_for_vfork_done
special case. Expect watchpoints that shouldn't be inserted, to
not be inserted.
* progspace.h (struct program_space) <breakpoints_not_allowed>:
New field.
* infrun.c (handle_inferior_event): Clear it.
* linux-nat.c (linux_child_follow_fork): Set it.
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".
(SYSCALL_SIGTRAP): New.
(status_to_str): Adjust.
(get_pending_status): Pending events in lp->waitstatus don't map
to any signal. Simplify.
(linux_handle_syscall_trap): New.
(linux_handle_extended_wait): When handling PTRACE_EVENT_CLONE
events, use linux_ops->to_resume instead of direct ptrace with
PTRACE_CONT. Remove all TRAP_IS_SYSCALL handling.
(wait_lwp): Handle syscall traps with linux_handle_syscall_trap,
and clear the sysgood bit.
(status_callback): Make it clearer and add comments.
(cancel_breakpoints_callback): Ignore if LP has waitstatus set.
(linux_nat_filter_event): Handle syscall traps with
linux_handle_syscall_trap, and clear the sysgood bit. Move the
check for storing siginfo to after handling extended statuses and
syscall traps. Store status in the lwp object.
(linux_wait_1): Don't swap the pending status out of the lwp
object until after deciding we found an lwp with an interesting
event. Requeue a new pending signal if we find one while getting
rid or a pending SIGSTOP we sent ourselves. Don't clear the
sysgood bit here.
* infrun.c (deal_with_syscall_event): Rename to ...
(handle_syscall_event): ... this. Always context switch and set
stop_pc, even if not catching the syscall. If not catching the
syscall, always resume with keep_going.
(handle_inferior_event): Adjust.
* gdbarch.c, gdbarch.h: Regenerate.
* arch-utils.c (default_displaced_step_hw_singlestep): New function.
* arch-utils.h (default_displaced_step_hw_singlestep): Add prototype.
* ppc-linux-tdep.c (ppc_displaced_step_hw_singlestep): New function.
(rs6000_gdbarch_init): Install it.
* infrun.c (displaced_step_fixup): Use new callback to determine
whether to "step" or "continue" displaced copy.
(resume): Likewise. Do not call maybe_software_singlestep
for displaced stepping.
(maybe_software_singlestep): Do not handle displaced stepping.
* amd64-linux-tdep.c: Include xml-syscall.h header, define the XML
syscall name for the architecture.
(amd64_linux_get_syscall_number): New function.
(amd64_linux_init_abi): Register the correct functions for syscall
catchpoint; set the correct syscall file name.
* breakpoint.c: New include: xml-syscall.h.
(set_raw_breakpoint_without_location): Setting the parameters
for the catch syscall feature.
(insert_catch_syscall): New.
(remove_catch_syscall): New.
(breakpoint_hit_catch_syscall): New.
(print_it_catch_syscall): New.
(print_one_catch_syscall): New.
(print_mention_catch_syscall): New.
(catch_syscall_breakpoint_ops): New.
(syscall_catchpoint_p): New.
(create_catchpoint_without_mention): New.
(create_catchpoint): Modified in order to use
create_catchpoint_without_mention.
(create_syscall_event_catchpoint): New.
(clean_up_filters): New.
(catch_syscall_split_args): New.
(catch_syscall_command_1): New.
(delete_breakpoint): Add cleanup for catch syscall.
(is_syscall_catchpoint_enabled): New.
(catch_syscall_enabled): New.
(catching_syscall_number): New.
(catch_syscall_completer): New completer function.
(add_catch_command): Add the completer function for catchpoints.
* breakpoint.h (syscalls_to_be_caught): New vector.
(catch_syscall_enabled): New.
(catching_syscall_number): New.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* gdbarch.sh: Add syscall catchpoint functions and structures.
(get_syscall_number): New.
(UNKNOWN_SYSCALL): New definition.
* i386-linux-nat.c (i386_linux_resume): Select the proper request
to be made for ptrace() considering if we are catching syscalls
or not.
* i386-linux-tdep.c: Include xml-syscall.h header, define the XML
syscall name for the architecture.
(i386_linux_get_syscall_number): New.
(i386_linux_init_abi): Register the correct functions for syscall
catchpoint; set the correct syscall file name.
* inf-child.c (inf_child_set_syscall_catchpoint): New.
(inf_child_target): Assign default values to target_ops.
* inf-ptrace.c (inf_ptrace_resume): Select the proper request
to be made for ptrace() considering if we are catching syscalls
or not.
* inferior.h (struct inferior): Included new variables
any_syscall_count, syscalls_counts and total_syscalls_count,
used to keep track of requested syscall catchpoints.
* infrun.c (resume): Add syscall catchpoint.
(deal_with_syscall_event): New.
(handle_inferior_event): Add syscall entry/return events.
(inferior_has_called_syscall): New.
* linux-nat.c: Define some helpful variables to track wether we have
support for the needed ptrace option.
(linux_test_for_tracesysgood): New.
(linux_supports_tracesysgood): New.
(linux_enable_tracesysgood): New.
(linux_enable_event_reporting): Save the current used ptrace
options.
(linux_child_post_attach): Calling linux_enable_tracesysgood.
(linux_child_post_startup_inferior): Likewise.
(linux_child_set_syscall_catchpoint): New function.
(linux_handle_extended_wait): Handle the case which the inferior stops
because it has called or returned from a syscall.
(linux_target_install_ops): Install the necessary functions to handle
syscall catchpoints.
* linux-nat.h (struct lwp_info): Include syscall_state into the
structure, which indicates if we are in a syscall entry or return.
* ppc-linux-tdep.c: Include xml-syscall.h header, define the XML
syscall filename for the arch.
(ppc_linux_get_syscall_number): New.
(ppc_linux_init_abi): Register the correct functions for syscall
catchpoint; setting the correct name for the XML syscall file.
* target.c (update_current_target): Update/copy functions related to
syscall catchpoint.
(target_waitstatus_to_string): Add syscall catchpoint entry/return
events.
* target.h (struct target_waitstatus): Add syscall number.
(struct syscall): New struct to hold information about syscalls
in the system.
(struct target_ops): Add ops for syscall catchpoint.
(inferior_has_called_syscall): New.
(target_set_syscall_catchpoint): New.
* xml-support.c (xml_fetch_content_from_file): New function,
transferred from xml-tdesc.c.
* xml-support.h (xml_fetch_content_from_file): New.
* xml-tdesc.c (fetch_xml_from_file): Function removed;
transferred to xml-support.c.
(file_read_description_xml): Updated to use the new
xml_fetch_content_from_file function.
* syscalls/gdb-syscalls.dtd: New definition file for syscall's XML
support.
* syscalls/amd64-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use amd64 architecture.
* syscalls/i386-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use i386 architecture.
* syscalls/ppc-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use PPC architecture.
* syscalls/ppc64-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use PPC64 architecture.
* xml-syscall.c: New file containing functions for manipulating
syscall's XML files.
* xml-syscall.h: New file, exporting the functions above mentioned.
* Makefile.in: Support for relocatable GDB datadir and XML
syscall.
* NEWS: Added information about the catch syscall feature.
* doc/gdb.texinfo (Set Catchpoints): Documentation about the new
feature.
* testsuite/Makefile.in: Inclusion of catch-syscall object.
* testsuite/gdb.base/catch-syscall.c: New file.
* testsuite/gdb.base/catch-syscall.exp: New file.
* frame.c (get_frame_id): Default to outer_frame_id if the this_id
method does not supply an ID. Assert that the result is not
null_frame_id.
(outer_frame_id): New.
(frame_id_p): Accept outer_frame_id.
(frame_id_eq): Allow outer_frame_id to be equal to itself.
(frame_find_by_id): Revert previous local workarounds.
(get_prev_frame_1): Adjust end-of-stack check to test outer_frame_id.
* frame.h (null_frame_id, frame_id_p): Update comments.
(outer_frame_id): Declare.
* infrun.c (handle_inferior_event): Do not treat all steps from the
outermost frame as subroutine calls.
* libunwind-frame.c (libunwind_frame_this_id): Do not clear THIS_ID.
* hppa-tdep.c (hppa_stub_frame_this_id): Likewise.
* ia64-tdep.c (ia64_frame_this_id): Likewise.
(ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id):
Use outer_frame_id instead of null_frame_id.
* amd64obsd-tdep.c (amd64obsd_trapframe_cache): Use outer_frame_id.
* i386obsd-tdep.c (i386obsd_trapframe_cache): Likewise.
* inline-frame.c (inline_frame_this_id): Refuse outer_frame_id.
* thread.c (restore_selected_frame): Update comment and remove
frame_id_p check.
gdb/doc/
* gdbint.texinfo (Unwinding the Frame ID): Reference outer_frame_id.
* NEWS: Announce JIT interface.
* Makefile.in (SFILES): Add jit.c.
(HFILES_NO_SRCDIR): Add jit.h.
(COMMON_OBS): Add jit.o.
* jit.c: New file.
* jit.h: New file.
* breakpoint.h (enum bptype): Add bp_jit_event to enum.
* breakpoint.c:
(update_breakpoints_after_exec): Delete jit breakpoints after exec.
(bpstat_what): Update event table for bp_jit_event.
(print_it_typical): Added case for bp_jit_event.
(print_one_breakpoint_location): Added case for bp_jit_event.
(allocate_bp_location): Added case for bp_jit_event.
(mention): Added case for bp_jit_event.
(delete_command): Added case for bp_jit_event.
(breakpoint_re_set_one): Added case for bp_jit_event.
(breakpoint_re_set): Added call to jit_inferior_created_hook.
(create_jit_event_breakpoint): New.
* infrun.c (handle_inferior_event): Add handler for jit event.
(follow_exec): Add call to jit_inferior_created_hook.
* doc/gdb.texinfo: Add chapter on JIT interface.
single-stepping arch, don't tell the target to single-step.
(maybe_software_singlestep): Return 0 if we're using displaced
stepping.
(resume): If this is a software single-stepping arch, and
displaced-stepping is enabled, use it for all single-step
requests.
cache every time before calling target_wait.
(handle_inferior_event): Make static. Always reset waiton_ptid.
Never call registers_changed.
(prepare_to_wait): Do not invaliate registers or overlay cache
(moved to wait_for_inferior). Do not reset waiton_ptid (moved
to handle_inferior_event).
(fetch_inferior_event): Remove check for always-true condition.
* infrun.c (handle_inferior_event): Remove an execution_direction
check in the "check for subroutine calls" test, and add some
additional handling for reverse-stepping through shared libraries.
* gdbtypes.c (gdbtypes_post_init): Initialize it.
* value.c (internal_fn_type): Remove.
(_initialize_values): Do not initialize it.
* value.c (struct internalvar): Add enum internalvar_kind type and
kind member. Restructure union internalvar_data type. Remove type,
canonical, and make_value members.
(init_if_undefined_command): Update for data structure changes.
(create_internalvar): Likewise.
(create_internalvar_type_lazy): Likewise.
(get_internalvar_integer): Likewise.
(get_internalvar_function): Likewise.
(set_internalvar_component): Likewise.
(set_internalvar): Likewise.
(set_internalvar_integer): Likewise.
(set_internalvar_function): Likewise.
(clear_internalvar): Likewise.
(add_internal_function): Likewise.
(preserve_one_internalvar): New function.
(preserve_values): Call it.
* value.h (value_of_internalvar): Add GDBARCH parameter.
(internalvar_make_value): Likewise.
* value.c (value_of_internalvar): Add GDBARCH parameter. Pass it to
make_value callback. Use it to generate per-architecture result value
types for internal variables with no pre-defined type. Update for data
structure changes.
(show_convenience): Pass architecture to value_of_internalvar.
* eval.c (evaluate_subexp_standard): Likewise.
* infrun.c (siginfo_make_value): Add GDBARCH parameter. Use it
instead of current frame architecture. Return per-architecture type.
* value.h (set_internalvar_string): Add prototype.
* value.c (set_internalvar_string): New function.
* tracepoint.c (set_traceframe_context): Use it.
* NEWS: Document inlined function support.
* Makefile.in (SFILES): Add inline-frame.c.
(COMMON_OBS): Add inline-frame.o.
* block.c (contained_in): Rewrite to use lexical nesting.
(block_linkage_function): Skip inlined function blocks.
(block_inlined_p): New.
* block.h (struct block): Update comment.
(block_inlined_p): New prototype.
* blockframe.c (get_frame_block): Handle inlined functions.
(get_frame_function): Do not use block_linkage_function.
(block_innermost_frame): Use get_frame_block and contained_in.
* breakpoint.c (watchpoint_check): Remove extra reinit_frame_cache.
Skip over inlined functions. Simplify epilogue check.
(bpstat_check_breakpoint_conditions): Use get_stack_frame_id.
Update comments.
(set_momentary_breakpoint): Only accept non-inlined frames.
(watch_command_1): Use frame_unwind_caller_pc and
frame_unwind_caller_id instead of get_prev_frame.
(until_break_command): Likewise. Use get_stack_frame_id.
* buildsym.c (end_symtab): Set SYMBOL_SYMTAB for block functions.
* dwarf2loc.c (dwarf_expr_frame_base): Use block_linkage_function.
* dwarf2read.c (process_die): Handle DW_TAG_inlined_subroutine.
(read_func_scope, new_symbol): Likewise. Handle arguments specially
for inlined functions without call site information.
(inherit_abstract_dies): Allow tag mismatch for inlined subroutines.
(die_specification): Treat DW_AT_abstract_origin as a specification.
(read_type_die): Handle DW_TAG_inlined_subroutine.
* frame-unwind.c (frame_unwind_init): Add inline_frame_unwind.
* frame.c (fprint_frame_id): Print inline depth.
(fprint_frame_type): Handle INLINE_FRAME and SENTINEL_FRAME.
(skip_inlined_frames, get_stack_frame_id): New.
(frame_unwind_caller_id): Use skip_inlined_frames.
(frame_id_inlined_p): New.
(frame_id_eq): Make the logic match the comments. Add inline_depth
check.
(frame_id_inner): Handle inlined functions.
(frame_unwind_pc): New function, copied from frame_unwind_caller_pc.
(frame_unwind_caller_pc): Use skip_inlined_frames and frame_unwind_pc.
(get_prev_frame_1): Check for inline frames. Split out frame
allocation to get_prev_frame_raw.
(get_prev_frame_raw): New function.
(get_prev_frame): Handle inline frames.
(get_frame_pc): Use frame_unwind_pc.
(get_frame_address_in_block): Skip inlined frames on both sides.
(pc_notcurrent): Delete.
(find_frame_sal): Rewrite to handle inline call sites. Use
get_frame_address_in_block.
(deprecated_update_frame_pc_hack): Make static.
* frame.h: Update comments.
(struct frame_id): Add inline_depth.
(enum frame_type): Add INLINE_FRAME.
(frame_id_inlined_p, get_stack_frame_id): New prototypes.
* gdbthread.h (struct thread_info): Add step_stack_frame_id field.
* infcmd.c (set_step_frame): New function.
(step_once): Use set_step_frame. Handle inlined functions.
(until_next_command): Use set_step_frame.
(finish_backward), finish_forward): Use get_stack_frame_id.
(finish_command): Support inlined functions.
* inferior.h (set_step_info): New prototype.
* infrun.c (RESUME_ALL): Use minus_one_ptid.
(clear_proceed_status): Clear step_stack_frame_id.
(init_wait_for_inferior): Call clear_inline_frame_state.
(init_execution_control_state): Make static.
(set_step_info): New function.
(init_thread_stepping_state): Do not set the symtab or line here.
(stepped_in_from): New function.
(handle_inferior_event): Handle inlined functions. Use set_step_info.
(insert_step_resume_breakpoint_at_frame): Use get_stack_frame_id.
(struct inferior_status): Add step_stack_frame_id.
(save_inferior_status, restore_inferior_status): Save and restore
step_stack_frame_id.
* inline-frame.c, inline-frame.h: New files.
* minsyms.c (prim_record_minimal_symbol_and_info): Use XCALLOC.
* regcache.c (regcache_write_pc): Call reinit_frame_cache.
* s390-tdep.c (s390_prologue_frame_unwind_cache): Handle INLINE_FRAME.
* stack.c (frame_show_address): New.
(print_frame_info, print_frame): Use it.
(find_frame_funname): Use get_frame_function. Handle inlined blocks.
(frame_info): Mark inlined functions.
(backtrace_command_1): Use get_current_user_frame.
(print_frame_local_vars, print_frame_label_vars): Update comments.
(return_command): Refuse inlined functions.
* symtab.c (lookup_symbol_aux_local): Stop at inlined function
boundaries.
(find_function_start_sal): Avoid inlined functions.
(completion_list_add_fields): New function.
(default_make_symbol_completion_list): Use it. Use block_static_block
and block_global_block. Check for inlined functions.
(skip_prologue_using_sal): Avoid line number comparison across
inlining.
* symtab.h (struct symbol): Add is_inlined.
(SYMBOL_INLINED): New.
* target.c (target_resume): Call clear_inline_frame_state.
* valops.c (value_of_variable): Check block_inlined_p.
gdb/doc/
* gdb.texinfo (Debugging Optimized Code): New chapter.
(Compiling for Debugging): Reference it. Move some
text to the new section.
gdb/testsuite/
* gdb.base/break.exp: Add an XFAIL for gcc/36748.
* gdb.cp/annota2.exp: Accept frames-invalid in more places.
* gdb.opt/Makefile.in (EXECUTABLES): Update.
* gdb.opt/clobbered-registers-O2.exp: Update to GPL v3.
* gdb.opt/inline-bt.c, gdb.opt/inline-bt.exp,
gdb.opt/inline-cmds.c, gdb.opt/inline-cmds.exp,
gdb.opt/inline-locals.c, gdb.opt/inline-locals.exp,
gdb.opt/inline-markers.c: New files.
* lib/gdb.exp (skip_inline_frame_tests): New function.
(skip_inline_var_tests): New function.
(displaced_step_clear_cleanup): Move to before displaced_step_prepare.
(displaced_step_prepare): Use displaced_step_clear_cleanup instead
of cleanup_displaced_step_closure.
(handle_inferior_event, keep_going): Use thread architecture instead
of current_gdbarch.
* infrun.c (handle_inferior_event): Use current frame architecture
or thread architecture instead of current_gdbarch. Pass to
handle_step_into_function and handle_step_into_function_backward.
(handle_step_into_function): Add GDBARCH parameter. Use it instead
of current_gdbarch.
(handle_step_into_function_backward): Likewise.
(insert_step_resume_breakpoint_at_frame): Use frame architecture
instead of current_gdbarch.
(insert_step_resume_breakpoint_at_caller): Likewise.
testsuite/ChangeLog:
* gdb.base/annota1.exp: Allow multiple occurrences of the
frames-invalid annotation.
* gdb.cp/annota2.exp: Likewise.
* infrun.c (sched_multi): New global.
(resume): If sched_multi is set, resume only threads of the
current inferior.
(prepare_to_proceed): Don't switch over to wait_ptid if we're
resuming a different inferior, and sched_multi is off.
(show_schedule_multiple): New.
(_initialize_infrun): Register new "set schedule-multiple" command.
* inferior.h (sched_multi): Declare.
* NEWS: Mention new "schedule-multiple" setting.
gdb/doc/
* gdb.texinfo (All-Stop): Document new 'set schedule-multiple'
command.
(update_current_target): Don't inherit to_sections or
to_sections_end.
(target_get_section_table): New.
(target_section_by_addr): Fetch the section table from the passed
in target.
(memory_xfer_partial): Handle unmapped overlay sections before
anything else. Get the overlay mapped address here. Adjust to
use section_table_xfer_memory_partial.
(get_target_memory): Request a TARGET_OBJECT_RAW_MEMORY object
instead of TARGET_OBJECT_MEMORY.
(target_resize_to_sections): Delete.
(remove_target_sections): Adjust to remove target sections from
`current_target_sections', and use resize_section_table.
* target.h (struct target_ops) <to_sections, to_sections_end>:
Remove fields.
<to_get_section_table>: New method.
(xfer_memory, print_section_info): Delete declarations.
(struct target_section_table): New type.
(target_get_section_table): Declare.
(target_resize_to_sections): Delete declaration.
(remove_target_sections): Delete declaration.
* bfd-target.c (target_bfd_xfer_partial): Get the section table
from to_data.
(target_bfd_get_section_table): New.
(target_bfd_xclose): Adjust.
(target_bfd_reopen): Store the section table in the to_data field.
* corelow.c (core_data): New.
(core_close): Adjust to release core_data and its sections.
(core_open): Allocate core_data, and build its target sections
table.
(deprecated_core_resize_section_table): New.
(core_files_info): Pass core_data to print_section_info.
(core_xfer_partial): Adjust to use
section_table_xfer_memory_partial for TARGET_OBJECT_MEMORY xfers.
(init_core_ops): Do not install a deprecated_xfer_memory callback
anymore.
* solib.c (update_solib_list): Add the shared library sections
to the current target sections table.
* exec.c (current_target_sections_1): New global.
(current_target_sections): New global.
(exec_close_1): New function, refactored from exec_close. Remove
the exec_bfd's sections from the current target sections table.
Adjust to not use to_sections.
(exec_close): Remove all target sections. Call exec_close_1.
(exec_file_clear): Use exec_close_1 instead of unpushing the
target.
(exec_file_attach): Likewise. Adjust to not use to_sections. Add
exec_bfd's sections to the current target sections table. Don't
push the exec_ops target here.
(resize_section_table): New.
(add_target_sections): New.
(remove_target_sections): Moved here.
(section_table_xfer_memory): Adjust to implement the xfer_partial
interface, and rename to...
(section_table_xfer_memory_partial): ... this, replacing the
current function of that same name.
(exec_get_section_table): New.
(exec_xfer_partial): New.
(xfer_memory): Delete.
(print_section_info): Replace the target_ops parameter by a
target_section_table parameter.
(exec_files_info, set_section_command, exec_set_section_address):
Adjust to use the current sections table.
(init_exec_ops): Do not register a deprecated_xfer_memory
callback. Register to_xfer_partial and to_get_section_table
callbacks.
* infrun.c (handle_inferior_event): Update comments around
solib_add.
* rs6000-nat.c (xcoff_relocate_core): Adjust to use
deprecated_core_resize_section_table.
* exec.h (resize_section_table): Declare.
(section_table_xfer_memory_partial): Add const char * argument.
(remove_target_sections): Declare here.
(add_target_sections): Declare.
(print_section_info): Declare here.
* gdbcore.h (deprecated_core_resize_section_table): Declare.
If scheduler-locking is enabled, we're not going to be singlestepping
any other previously stopped thread.
* gdb.threads/hand-call-in-threads.exp: New file.
* gdb.threads/hand-call-in-threads.c: New file.
2009-05-28 Pedro Alves <pedro@codesourcery.com>
* infrun.c (handle_inferior_event): When thread hoping, switch
inferior_ptid to the event thread before removing breakpoints from
the target. If not stopping, also try to revert back to a thread
that was doing a "next". Check if that thread still exists before
resuming.
(currently_stepping_thread): Delete and merge with ...
(currently_stepping): ... this.
(currently_stepping_callback): Rename to ...
(currently_stepping_or_nexting_callback): ... this, and also
return true if the thread was stepping over a call (has a
step-resume breakpoint).
gdb/testsuite/
2009-05-28 Pedro Alves <pedro@codesourcery.com>
* gdb.threads/threxit-hop-specific.c: New.
* gdb.threads/threxit-hop-specific.exp: New.
* gdb.threads/thread-execl.c: New.
* gdb.threads/thread-execl.exp: New.
Global renaming of find_thread_pid to find_thread_ptid.
* gdbthread.h (find_thread_ptid): Renamed from find_thread_pid.
* thread.c (find_thread_ptid): Renamed from find_thread_pid.
All callers updated.
gdbserver:
Global renaming of find_thread_pid to find_thread_ptid.
* server.h (find_thread_ptid): Renamed from find_thread_pid.
* inferiors.c (find_thread_ptid): Renamed from find_thread_pid.
All callers updated.
* gdbthread.h (struct thread_info): New `pending_follow' field.
* thread.c (new_thread): New function.
(add_thread_silent): Use it.
* breakpoint.c (internal_breakpoint_number): New global, moved
from inside...
(create_internal_breakpoint): ... this.
(clone_momentary_breakpoint): New.
* breakpoint.h (clone_momentary_breakpoint): Declare.
* infrun.c (nullify_last_target_wait_ptid): Move declaration
higher.
(pending_follow): Delete.
(follow_fork): Handle pending follow fork event here. Moved the
preserving of thread stepping state here.
(resume): Don't handle pending follow fork events here. Only
install the inferior's terminal modes if we're about to resume it.
(proceed): Handle possible pending follow fork events here.
(init_wait_for_inferior): No need to clear pending_follow anymore,
it's gone.
(handle_inferior_event): Adjust to per-thread `pending_follow'.
Call `follow_fork' to handle following the fork. If the
follow-fork is cancelled, stop stepping.
* linux-nat.c (linux_child_follow_fork): Adjust to per-thread
`pending_follow' events. Remove code that handled preserving the
thread stepping state.
* inf-ptrace.c (inf_ptrace_follow_fork): Ditto.
* inf-ttrace.c (inf_ttrace_follow_fork): Ditto.
gdb/testsuite/
* gdb.threads/fork-thread-pending.c: New.
* gdb.threads/fork-thread-pending.exp: New.
2009-05-17 Pedro Alves <pedro@codesourcery.com>
* infrun.c (handle_inferior_event): When handling a
TARGET_WAITKIND_FORKED, detach breakpoints from the fork child
immediatelly.
* linux-nat.c (linux_child_follow_fork): Only detach breakpoint
from the child if vforking.
* inf-ptrace.c (inf_ptrace_follow_fork): No need to detach
breakpoints from the child here.
gdb/testsuite/
2009-05-17 Pedro Alves <pedro@codesourcery.com>
* gdb.base/foll-fork.c: Include stdlib.h. Add markers for
`gdb_get_line_number'. Call `callee' in both parent and child.
* gdb.base/foll-fork.exp (catch_fork_child_follow): Use
`gdb_get_line_number' instead of hardcoding line numbers.
(catch_fork_unpatch_child): New procedure to test detaching
breakpoints from child fork.
(tcatch_fork_parent_follow): Use `gdb_get_line_number' instead of
hardcoding line numbers.
(do_fork_tests): Run `catch_fork_unpatch_child'.
(resume): No longer handle TARGET_WAITKIND_EXECD pending follow.
(handle_inferior_event): When handling a TARGET_WAITKIND_EXECD
event, don't copy `execd_pathname' to pending_follow, use the
event copy instead. Release `execd_pathname' once done with
handling the event.
target_has_stack.
* mi/mi-main.c (mi_execute_command): Avoid calling inferior_thread
when there is no thread selected.
(mi_cmd_execute): Don't special case commands that can run without
a valid selected thread.
* top.c (execute_command): Don't special case commands that can
run without a valid selected thread. Use has_stack_frames.
* infcmd.c (ensure_valid_thread): New.
(continue_1, step_1, jump_command, signal_command): Use it.
(detach_command): Error out if there's no selected thread/inferior.
* thread.c (print_thread_info): Allow having no thread selected.
(switch_to_thread): Don't read the PC if there is no current thread.
(do_restore_current_thread_cleanup): Don't record the current
frame if there is no current thread.
(make_cleanup_restore_current_thread): Don't read frame info if
there is no selected thread.
(_initialize_thread): Don't mark commands as
"no_selected_thread_ok".
* frame.c (get_current_frame): Error out if there is no valid
selected thread.
(has_stack_frames): Return false if there is no valid
selected thread.
* cli/cli-cmds.c (init_cli_cmds): Don't mark commands as
"no_selected_thread_ok".
* cli/cli-decode.c (set_cmd_no_selected_thread_ok)
(get_cmd_no_selected_thread_ok): Delete.
* cli/cli-decode.h (CMD_NO_SELECTED_THREAD_OK): Delete.
(set_cmd_no_selected_thread_ok, get_cmd_no_selected_thread_ok):
Delete declaration.
* stack.c (get_selected_block): Use has_stack_frames.
* mi/mi-interp.c (mi_interpreter_init): Attach mi_about_to_proceed
to the about_to_proceed observer notification.
(mi_about_to_proceed): New.
(mi_on_resume): Only output ^running and the prompt here if the
target was proceeded.
* breakpoint.c (breakpoint_proceeded): New static.
(breakpoint_about_to_proceed): New.
(_initialize_breakpoints): Attach breakpoint_about_to_proceed to
the about_to_proceed observer notification.
* inferior.h (breakpoint_proceeded): Delete declaration.
* infrun.c (clear_proceed_status): Don't set breakpoint_proceeded.
Notify the about_to_proceed observers.
(struct inferior_status): Delete breakpoint_proceeded member.
(save_inferior_status): Don't save it.
(restore_inferior_status): Don't restore it.
* mi-main.h (mi_proceeded): Declare.
* mi/mi-main.c (mi_cmd_execute): Clear mi_proceeded before running
a command.
gdb/doc/
* observer.texi (about_to_proceed): New.
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.
* ada-tasks.c (ada_normal_stop_observer): Adjust prototype.
* infcmd.c (finish_command_continuation): Pass '1' for
'print_frame' parameter to the observer.
* infrun.c (normal_stop): Don't print mi-specific information
here. Pass 'stop_print_frame' to the 'print_frame' parameter
of the observer.
* mi/mi-interp.c (mi_on_normal_stop): Adjust prototype.
If we need to print frame, and current uiout is not the MI one,
print frame again.
* target.c (target_waitstatus_to_string): New function. Copied from
debug_to_wait. Add missing entries for TARGET_WAITKIND_SYSCALL_ENTRY,
TARGET_WAITKIND_SYSCALL_RETURN, TARGET_WAITKIND_IGNORE,
TARGET_WAITKIND_NO_HISTORY.
(debug_to_wait): Call it.
* infrun.c (wait_for_inferior): If debug_infrun, print result of
target_wait.
(fetch_inferior_event): Ditto.
PR gdb/9664:
* infrun.c (normal_stop): Tag threads as stopped, and run the
hook-stop before printing the stack frame.
2009-01-23 Pedro Alves <pedro@codesourcery.com>
PR gdb/9664:
* gdb.base/hook-stop-frame.c, gdb.base/hook-stop-frame.exp: New.
caller_state.
(dummy_frame_push): Replace caller_regcache arg with caller_state.
All callers updated.
(remove_dummy_frame,pop_dummy_frame,lookup_dummy_frame): New fns.
(dummy_frame_pop): Rewrite. Verify requested frame is in the
dummy frame stack. Restore program state.
(cleanup_dummy_frames): Rewrite.
(dummy_frame_sniffer): Update. Make static.
* dummy-frame.h (regcache,frame_info): Delete forward decls.
(inferior_thread_state): New forward decl.
(dummy_frame_push): Update prototype.
* frame.c (frame_pop): dummy_frame_pop now does all the work for
DUMMY_FRAMEs.
* infcall.c (breakpoint_auto_delete_contents): Delete.
(get_function_name,run_inferior_call): New fns.
(call_function_by_hand): Simplify by moving some code to
get_function_name, run_inferior_call. Inferior function call wrapped
in TRY_CATCH so there's less need for cleanups and all exits from
proceed are handled similarily. Detect program exit.
Detect program stopping in a different thread.
Make error messages more consistent.
* inferior.h (inferior_thread_state): Declare (opaque type).
(save_inferior_thread_state,restore_inferior_thread_state,
make_cleanup_restore_inferior_thread_state,
discard_inferior_thread_state, get_inferior_thread_state_regcache):
Declare.
(save_inferior_status): Update prototype.
* infrun.c: (normal_stop): When stopped for the completion of an
inferior function call, verify the expected stack frame kind.
(inferior_thread_state): New struct.
(save_inferior_thread_state,restore_inferior_thread_state,
do_restore_inferior_thread_state_cleanup,
make_cleanup_restore_inferior_thread_state,
discard_inferior_thread_state,
get_inferior_thread_state_regcache): New functions.
(inferior_status): Move stop_signal, stop_pc, registers to
inferior_thread_state. Remove restore_stack_info.
(save_inferior_status): Remove arg restore_stack_info.
All callers updated. Remove saving of state now saved by
save_inferior_thread_state.
(restore_inferior_status): Remove restoration of state now done by
restore_inferior_thread_state.
(discard_inferior_status): Remove freeing of registers, now done by
discard_inferior_thread_state.
* gdb.base/break.exp: Update expected gdb output.
* gdb.base/sepdebug.exp: Ditto.
* gdb.mi/mi-syn-frame.exp: Ditto.
* gdb.mi/mi2-syn-frame.exp: Ditto.
* gdb.base/call-signal-resume.exp: New file.
* gdb.base/call-signals.c: New file.
* gdb.base/unwindonsignal.exp: New file.
* gdb.base/unwindonsignal.c: New file.
* gdb.threads/interrupted-hand-call.exp: New file.
* gdb.threads/interrupted-hand-call.c: New file.
* gdb.threads/thread-unwindonsignal.exp: New file.
* gdbthread.h (finish_thread_state, finish_thread_state_cleanup):
Declare.
* thread.c (finish_thread_state, finish_thread_state_cleanup): New.
* infrun.c (wait_for_inferior, fetch_inferior_event): If an error
is thrown while handling an event, finish the thread state.
(normal_stop): Use finish_thread_state cleanup.
* infcmd.c (run_command_1): If an error is thrown while starting
the inferior, finish the thread state.
2009-01-07 Pedro Alves <pedro@codesourcery.com>
Delete ONE_PROCESS_WRITETEXT leftovers.
* breakpoint.c (insert_bp_location): Delete process_warning
argument. Adjust.
(insert_breakpoint_locations): Adjust.
(reattach_breakpoints): Adjust.
* infrun.c (normal_stop): Drop "It might be running in another
process" notice.
gdb/doc/
2009-01-07 Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (Error in Breakpoints): Delete mention of "The same
program may be running in another process" errors.
* gdbint.texinfo (Native Conditionals): Delete
ONE_PROCESS_WRITETEXT description.
PR gdb/8812:
* infrun.c (handle_command): Don't print a header or notify the
target about signal changes if we didn't change any signal.
2008-12-31 Pedro Alves <pedro@codesourcery.com>
PR gdb/8812:
* gdb.base/signal.exp: Change kfail to fail, and update PR number.
TARGET_WAITKIND_SIGNALLED, switch inferior_ptid to the event ptid.
* linux_thread_db.c (thread_db_wait): On a TARGET_WAITKIND_EXITED
or TARGET_WAITKIND_SIGNALLED, return the ptid the beneath target
returned.
* inf-ptrace.c (inf_ptrace_wait): Return inferior_ptid instead of
minus_one_ptid if the inferior disappeared.
* rs6000-nat.c (rs6000_wait): Likewise.
* spu-linux-nat.c (spu_child_wait): Likewise.
* infrun.c (clear_proceed_status_thread): New function.
(clear_proceed_status_callback): New function.
(clear_proceed_status): In all-stop mode, clear per-thread
proceed status of *all* threads, not only the current.
(handle_inferior_event): In all-stop mode, if we're stepping
one thread, but got some inferior event in another thread
that does not cause GDB to break to the user interface,
ensure the interrupted stepping operation continues in the
original thread.
(currently_stepping): Move thread-related tests to ...
(currently_stepping_thread): ... this new function.
(currently_stepping_callback): New function.
(do_all_inferior_continuations)
(discard_all_inferior_continuations): Declare.
* utils.c (add_inferior_continuation)
(do_all_inferior_continuations)
(discard_all_inferior_continuations): New.
* inferior.h (struct inferior) <continuations>: New field.
* inferior.c (free_inferior): Discard all the inferior
continuations.
* inf-loop.c (inferior_event_handler): Do all current inferior
continuations.
* infcmd.c (attach_command): Register an inferior continuation
instead of a thread continuation.
* infrun.c (handle_inferior_event): If stop_soon is
STOP_QUIETLY_NO_SIGSTOP, also expect a TARGET_SIGNAL_0.
Pedro Alves <pedro@codesourcery.com>
* infrun.c (can_use_displaced_stepping): Change type to
const char pointer.
(can_use_displaced_stepping_auto): New string.
(can_use_displaced_stepping_on): New string.
(can_use_displaced_stepping_off): New string.
(can_use_displaced_stepping_enum): New array.
(show_can_use_displaced_stepping): In auto mode, also show
the current effect of the option.
(use_displaced_stepping): Return non-zero if displaced
stepping is auto, and can be used with GDBARCH, and in
non-stop mode. Return non-zero if displaced stepping is on,
and can be used with GDBARCH. Return zero otherwise.
(_initialize_infrun): Make the "set displaced-stepping"
command an enum command. Change its class to class_run.
Place it in the top level set list. Extend help to describe
the auto mode.
2008-10-24 Hui Zhu <teawater@gmail.com>
Pedro Alves <pedro@codesourcery.com>
* gdb.texinfo (displaced-stepping): Describe the auto mode
setting, and say it's the default. This is now a mainstream
setting instead of a maintenance setting.
2008-10-23 Pedro Alves <pedro@codesourcery.com>
* defs.h: Mention ptid_is_pid.
* inferior.h (ptid_is_pid): Declare.
* gdbthread.h (struct thread_info) <stop_requested>: New field.
(set_stop_requested): Declare.
* infcmd.c (interrupt_target_1): Call set_stop_requested.
* infrun.c (clear_proceed_status): Clear stop_requested.
(infrun_thread_stop_requested_callback,
infrun_thread_stop_requested): New.
(handle_inferior_event): If a TARGET_SIGNAL_TRAP is reported on a
thread that had an explicit stop request, pretend we got a
TARGET_SIGNAL_0. Always stop if the thread had an explicit stop
request.
(print_stop_reason): In the SIGNAL_RECEIVED case, if we're not
outputting to MI, and we got a TARGET_SIGNAL_0, print "# Stopped",
instead of mentioning signal 0.
(ptid_is_pid): New.
* thread.c (set_stop_requested): New.
* linux-nat.c (queued_waitpid): Rename to ...
(queued_waitpid_1): ... this. Add `peek' argument. Handle it.
(queued_waitpid): New, as wrapper to queued_waitpid_1.
(push_waitpid): Push the SIGTRAP to the local event queue, to the
kernel's.
(send_sigint_callback): Delete.
(linux_nat_stop_lwp): New.
(linux_nat_stop): Use it.
gdb/doc/
2008-10-23 Pedro Alves <pedro@codesourcery.com>
* observer.texi (thread_stop_requested): New.
gdb/testsuite/
2008-10-23 Pedro Alves <pedro@codesourcery.com>
* lib/mi-support.exp (mi_expect_interrupt): Expect signal 0
instead of SIGINT.
Target interface for reverse debugging.
* target.h (enum target_waitkind):
Add new wait event, TARGET_WAITKIND_NO_HISTORY.
(struct target_ops): New method to_can_execute_reverse.
(target_can_execute_reverse): New macro.
* target.c (update_current_target): Inherit to_can_execute_reverse.
Remote interface for reverse debugging.
* remote.c (remote_can_execute_reverse): New target method.
(remote_resume): Check for reverse exec direction, and send
appropriate command to target.
(remote_wait_as): Check target response for NO_HISTORY status.
Also check for empty reply (target doesn't understand "bs" or "bc).
(remote_vcont_resume): Jump out if attempting reverse execution.
Event handling interface for reverse debugging.
* infrun.c (execution_direction): New state variable.
(enum inferior_stop_reason): Add NO_HISTORY reason.
(handle_inferior_event): Handle TARGET_WAITKIND_NO_HISTORY.
Handle stepping over a function call in reverse.
Handle stepping thru a line range in reverse.
Handle setting a step-resume breakpoint in reverse.
Handle stepping into a function in reverse.
Handle stepping between line ranges in reverse.
(print_stop_reason): Print reason for NO_HISTORY.
(step_into_function): Rename to handle_step_into_function.
(handle_step_into_function_backward): New function.
(set_exec_direction_func, show_exec_direction_func): New funcs.
(proceed): No need to singlestep over a breakpoint
when resuming in reverse.
* inferior.h (enum exec_direction_kind): New enum.
(execution_direction): Export new execution state variable.
* breakpoint.c (make_breakpoint_silent): New function.
* breakpoint.h (make_breakpoint_silent): Export.
* infcmd.c (finish_command): Check for reverse exec direction.
(finish_backward): New function, handle finish cmd in reverse.
User interface for reverse execution.
* Makefile.in (reverse.c): New file.
* reverse.c: New file. User interface for reverse execution.
* breakpoint.c (breakpoint_init_inferior): Clean up the moribund
locations list.
(moribund_breakpoint_here_p): Record the moribund
location in the moribund_locations vector.
* breakpoint.h (moribund_breakpoint_here_p): Declare.
(displaced_step_fixup): Check if the breakpoint the thread was
trying to step over has been removed since having been placed in
the displaced stepping queue.
(adjust_pc_after_break): In non-stop mode, check for a moribund
breakpoint at the stop pc.
(handle_inferior_event): Don't retire moribund breakpoints on
TARGET_WAITKIND_IGNORE.
gdb/testsuite/
* gdb.mi/mi-nsmoribund.exp, gdb.mi/nsmoribund.c: New test.
comments.
(mips_linux_skip_resolver): Also use glibc_skip_solib_resolver.
(mips_linux_init_abi): Do not override skip_trampoline_code.
* configure.tgt (mips*-*-linux*): Add glibc-tdep.o.
* mips-tdep.c (mips32_scan_prologue): Stop scanning at branches.
(mips_stub_frame_sniffer): Use the stub frame sniffer for PIC stubs.
(mips_skip_mips16_trampoline_code): Rename from
mips_skip_trampoline_code.
(mips_skip_pic_trampoline_code, mips_skip_trampoline_code): New.
* infrun.c (handle_inferior_event): Do not pass zero to
in_solib_dynsym_resolve_code.
* infrun.c (wait_for_inferior): Move this ECS->EVENT_THREAD
initialization ...
(fetch_inferior_event): ... and this ECS->EVENT_THREAD initialization
...
(handle_inferior_event): ... here after the add_thread call together
with the local adjust_pc_after_break and reinit_frame_cache calls.
* infrun.c (context_switch): Don't save and load infrun state.
(context_switch_to): Delete.
* infcmd.c (proceed_thread_callback): Replace context_switch_to
calls by switch_to_thread calls.
* gdbthread.h (save_infrun_state, load_infrun_state): Delete.
* thread.c (main_thread_state, main_thread_executing): Delete.
(inferior_thread): Delete references to them.
(add_thread_silent): Fix case where we're adding a thread with the
same ptid as an exited thread. Remove references to
context-switching.
(load_infrun_state, save_infrun_state): Delete.
(thread_alive, is_thread_state, any_running, is_executing)
(set_executing): Remove the special handling for targets that
don't register any thread.
(restore_current_thread, thread_apply_all_command)
(do_captured_thread_select): Unconditionally call
switch_to_thread.
* mi/mi-main.c (mi_cmd_execute): Check for exited threads.
Call switch_to_thread instead of context_switch_to.
* breakpoint.h (bpstat_do_actions): Remove bpstat* argument.
* breakpoint.c (bpstat_do_actions): Rename to ...
(bpstat_do_actions_1): ... this. Make static. Change return type
to int. Return true if a breakpoint proceeded.
(bpstat_do_actions): New, as wrapper around bpstat_do_actions_1.
(delete_breakpoint): Don't reference the global stop_bpstat; it's
gone.
* gdbthread.h (struct thread_info): Add stop_bpstat.
(save_infrun_state, load_infrun_state): Remove stop_bpstat
argument.
* thread.c (load_infrun_state, save_infrun_state): Remove
stop_bpstat argument, and the code referencing it.
* infcall.c: Include "gdbthread.h".
(call_function_by_hand): Adjust.
* exceptions.c: Include "gdbthread.h".
(throw_exception): Adjust.
* infcmd.c (stop_bpstat): Delete.
(continue_command): In all-stop, set the ignore count on the
thread that reported the stop. In non-stop, set it on the current
thread.
(finish_command_continuation): Adjust.
(program_info): Adjust.
* infrun.c (clear_proceed_status): Adjust.
(context_switch): Don't context-switch stop_bpstat.
(handle_inferior_event): Adjust.
(normal_stop): Adjust.
(save_inferior_status, restore_inferior_status): Adjust.
* inf-loop.c (inferior_event_handler): Remove parameter to
bpstat_do_actions call.
* top.c (command_loop): Remove parameter to bpstat_do_actions
call. Call it unconditionally.
* event-top.c (command_handler): Ditto.
* python/python.c (execute_gdb_command): Ditto.
* dummy-frame.c: Include "observer.h".
(dummy_frame_push): Do not check for stale frames.
(dummy_frame_pop): New function.
(cleanup_dummy_frames): New function.
(_initialize_dummy_frame): Install it as inferior_created observer.
* frame.h (struct frame_id): Update comments.
(frame_id_inner): Remove prototype.
* frame.c (frame_id_inner): Make static. Add comments.
(frame_find_by_id): Update frame_id_inner safety net check to avoid
false positives for targets using non-contiguous stack ranges.
(get_prev_frame_1): Update frame_id_inner safety net check.
(frame_pop): Call dummy_frame_pop when popping a dummy frame.
* stack.c (return_command): Directly pop the selected frame.
* infrun.c (handle_inferior_event): Remove dead code.
* i386-tdep.c (i386_push_dummy_call): Update comment.
* infrun.c (struct thread_stepping_state): Delete sal member.
(init_thread_stepping_state): Add local sal. Use it instead of
tss->sal.
(handle_inferior_event): New local stop_pc_sal. Use it instead of
tss->sal.
(step_into_function): Add local stop_func_sal. Use it instead of
tss->sal.
* thread.c (enum thread_state): New.
(thread_state main_thread_running): Delete, in favor of...
(thread_state main_thread_state): ... this. Update throughout.
(clear_thread_inferior_resources): New, split from free_thread.
(free_thread): Call clear_thread_inferior_resources.
(init_thread_list): Set main thread to stopped state.
(add_thread_silent): Take care of PTID reuses.
(delete_thread): If deleting inferior_ptid or a thread with
refcount > 0, mark it as exited, but still keep it in the list.
Only notify of thread exits, if we haven't done so yet.
(iterate_over_threads): Make it safe to delete threads while
iterating over them.
(do_captured_list_thread_ids): Don't account for exited threads.
(thread_alive): Check for the THREAD_EXITED state, and don't set
ptid to -1 on exited threads.
(set_running): Update to account for extra possible states.
(is_thread_state): New.
(is_stopped, is_exited): New.
(is_running): Implement in terms of is_thread_state.
(any_running): Update.
(print_thread_info): Update. Account for exited threads. Don't
warn about missed frame restoring here, its done in the cleanup.
(switch_to_thread): Don't read from a thread that has gone.
(restore_current_thread): In non-stop mode, do a full context
switch.
(restore_selected_frame): Add a frame_level argument. Rewrite.
(struct current_thread_cleanup): Add selected_frame_level and
was_stopped members.
(do_restore_current_thread_cleanup): Check if thread was stopped
and still is, and if the target has registers, stack and memory
before restoring the selected frame. Don't delete the cleanup
argument here.
(restore_current_thread_cleanup_dtor): New.
(make_cleanup_restore_current_thread): Remove all arguments.
Rewrite.
(thread_apply_all_command): Update. Prune threads.
(thread_apply_command): Update.
(thread_command): Account for currently selected exited thread.
(do_captured_thread_select): Check for a running thread. Prune
threads.
(_initialize_thread): Make "info threads", "thread", "thread
apply", and "thread apply all" appliable without a selected thread.
* gdbthread.h (struct thread_info): Replace running_ by state_.
Add refcount.
(is_exited, is_stopped): Declare.
(make_cleanup_restore_current_thread): Remove all arguments.
* infrun.c: Include "event-top.h".
(fetch_inferior_event): In non-stop mode, restore selected thread
and frame after handling the event and running breakpoint
commands. Display GDB prompt if needed.
(normal_stop): In non-stop mode, don't print thread switching
notice.
* cli/cli-decode.c (set_cmd_no_selected_thread_ok)
(get_cmd_no_selected_thread_ok): New.
* cli/cli-decode.h (CMD_NO_SELECTED_THREAD_OK): New.
(set_cmd_no_selected_thread_ok, get_cmd_no_selected_thread_ok):
Declare.
* cli/cli-cmds.c: Set "pwd", "help", "info", "show" as
no-selected-thread ok.
* top.c (execute_command): Check for non no-selected-thread-ok
commands.
* linux-nat.c (struct saved_ptids, threads_to_delete)
(record_dead_thread, prune_lwps): Delete.
(exit_lwp): Unconditionally delete thread.
(linux_nat_resume): Remove prune_lwps call.
* infcmd.c (proceed_thread_callback): Check if !is_stopped instead
of is_running. Adjust to make_cleanup_restore_current_thread
interface change.
* mi/mi-main.c (mi_cmd_execute): Only allow a few commands if the
selected thread has exited.
* inf-loop.c (inferior_event_handler): Don't display the prompt
here.
* varobj.c (c_value_of_root): Update.
* defs.h (make_cleanup_dtor): Declare.
* utils.c (make_cleanup_dtor): New.
* Makefile.in (infrun.o): Depend on $(event_top_h).
* infrun.c (resume): In non-stop mode, always resume just one
thread.
(proceed): Don't call prepare_to_proceed in non-stop mode.
(fetch_inferior_event): In non-stop mode, switch context before
handling the event.
(error_is_running, ensure_not_running): New.
(handle_inferior_event): In non-stop mode: Mark only the event
thread as stopped. Require that the target module manages adding
threads to the thread list. Assert that there isn't a
deferred_step_ptid set. Don't switch to infwait_thread_hop_state.
(normal_stop): Only mark not-running if inferior hasn't exited.
In non-stop mode, only mark the event thread.
* thread.c:Include "cli/cli-decode.h".
(print_thread_info): Don't read from a running thread.
Output "(running)" if thread is running.
(switch_to_thread): Don't read stop_pc if thread is executing.
(do_restore_current_thread_cleanup): Don't write to a running
thread.
(thread_apply_all_command): Don't read from a running thread. In
non-stop mode, do a full context-switch instead of just switching
threads.
(thread_apply_command): In non-stop mode, do a full context-switch
instead of just switching threads.
(do_captured_thread_select): Likewise. Inform user if selected
thread is running.
(_initialize_thread): Mark "info threads" and "thread" and
async_ok.
* inf-loop.c (inferior_event_handler): In non-stop mode, don't
unregister the target from the event loop.
* infcmd.c (continue_command, step_1, jump_command)
(signal_command): Ensure the selected thread isn't running.
(interrupt_target_command): In non-stop mode, interrupt only the
selected thread.
* inferior.h (error_is_running, ensure_not_running): Declare.
* target.h (struct target_ops): Add ptid argument to the to_stop
member.
(target_stop): Add ptid_t argument.
* target.c (update_current_target): Add ptid argument to to_stop's
type.
(debug_to_stop): Add ptid_t argument.
(debug_to_rcmd): Set to_stop_ptid.
* remote.c (remote_stop): Add ptid_t argument.
(async_remote_interrupt): Add inferior_ptid to target_stop.
* inf-ptrace.c (inf_ptrace_stop): Add ptid argument.
* Makefile.in (thread.o): Depend on $(cli_decode_h).
* infrun.c (proceed): Clear the stepping state, set
previous_inferior_ptid and clear infwait state.
(wait_for_inferior): Don't clear the stepping state, set
previous_inferior_ptid, or clear the infwait state here.
(fetch_inferior_event): Don't clear the stepping state, set
previous_inferior_ptid, or clear the infwait state here. Don't
condition on wait_for_more.
* infrun.c (currently_stepping): Take a struct
thread_stepping_state instead of an execution_control_state.
(struct thread_stepping_state): New, split from
execution_control_state.
(gtss, tss): New globals.
(proceed): Clear the stepping state, set previous_inferior_ptid
and clear infwait state.
(init_wait_for_inferior): Clear the stepping state,
previous_inferior_ptid and infwait state.
(waiton_ptid, infwait_state): New, split from
execution_control_state.
(struct execution_control_state): Members that persist through
events moved out to either struct thred_stepping_state or made
global. Deleted unneeded wp, saved_inferior_ptid, tmpstatus.
(wait_for_inferior, fetch_inferior_event): Use local
execution_control_state. Update to execution_control_state split.
(init_execution_control_state): Adjust.
(init_thread_stepping_state): New, extracted from
init_execution_control_state.
(context_switch): Take a ptid instead of an
execution_control_state.
(context_switch_to): Adjust.
(adjust_pc_after_break): Adjust.
(init_infwait_state): New.
(handle_inferior_event): Adjust.
* gdbthread.h: Remove unneeded forward declarations.
Include "inferior.h".
(struct thread_info): Add continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi and stop_signal members.
(save_infrun_state): Add continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat parameters.
(load_infrun_state): Add continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat parameters.
* thread.c (load_infrun_state): In non-stop mode, load
continuations, intermediate_continuations, proceed_to_finish,
step_over_calls, stop_step, step_multi and stop_signal.
(save_infrun_state): Store continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat.
(save_infrun_state): Store continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat.
(free_thread): Clear The thread's stop_bpstat.
* inferior.h (context_switch_to): Declare.
* infrun.c (ecss): New global.
(context_switch): Context switch continuations,
intermediate_continuations, proceed_to_finish, step_over_calls,
stop_step, step_multi, stop_signal and stop_bpstat.
(wait_for_inferior): Use global ecss.
(async_ecss, async_ecs): Delete.
(fetch_inferior_event): Use global ecss.
(context_switch_to): New.
* top.c (execute_command): In non-stop, only check if the current
thread is running, in all-stop, check if there's any thread
running.
* breakpoint.c (bpstat_remove_breakpoint): New.
(bpstat_remove_breakpoint_callback): New.
(delete_breakpoint): Clear the stop_bpstats of all threads.
* mi/mi-main.c (mi_cmd_execute): In non-stop, only check if the
current thread is running, in all-stop, check if there's any
thread running.
* Makefile.in (gdbthread_h): Depend on $(inferior_h).
* target.h (struct target_waitstatus): Store related_pid as a ptid.
(inferior_has_forked, inferior_has_vforked, inferior_has_execd):
Take a ptid_t.
* breakpoint.h (struct breakpoint): Change forked_inferior_pid
type to ptid.
* breakpoint.c (print_it_typical, bpstat_check_location)
(print_one_breakpoint_location, set_raw_breakpoint_without_location)
(create_fork_vfork_event_catchpoint): Adjust.
* infrun.c (fork_event): Change parent_pid and child_pid types to
ptid.
(follow_exec, inferior_has_forked, inferior_has_vforked)
(inferior_has_execd): Take a ptid_t and don't trim it.
* linux-thread-db.c (thread_db_wait): Don't trim the returned ptid.
* linux-nat.c (linux_child_follow_fork): Adjust.
* inf-ptrace.c (inf_ptrace_wait): Adjust.
* inf-ttrace.c (inf_ttrace_wait): Adjust.
* win32-nat.c (get_win32_debug_event): Don't set related_pid.
* inferior.h (target_executing): Delete.
* gdbthread.h (struct thread_info): Add executing_ field.
(set_executing, is_executing): New.
* thread.c (main_thread_executing): New.
(init_thread_list): Clear it and also main_thread_running.
(is_running): Return false if target has no execution.
(any_running, is_executing, set_executing): New.
* top.c: Include "gdbthread.h".
(target_executing): Delete.
(execute_command): Replace target_executing check by any_running.
* event-top.c: Include "gdbthread.h".
(display_gdb_prompt, command_handler): Replace target_executing by
is_running.
* inf-loop.c: Include "gdbthread.h". Don't mark as not executing
here. Replace target_executing by is_running.
* infrun.c (handle_inferior_event): Mark all threads as
not-executing.
* linux-nat.c (linux_nat_resume): Don't mark thread as executing
here.
* stack.c (get_selected_block): Return null if inferior is
executing.
* target.c (target_resume): Mark resumed ptid as executing.
* breakpoint.c (until_break_command): Replace target_executing
check by is_executing.
* remote.c (remote_async_resume): Don't mark inferior as executing
here.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Replace target_executing
by any_running.
* mi/mi-main.c (mi_cmd_exec_interrupt, mi_cmd_execute)
(mi_execute_async_cli_command): Replace target_executing by
is_running.
* frame.c (get_current_frame): Error out if the current thread is
executing.
(has_stack_frames): New.
(get_selected_frame, deprecated_safe_get_selected_frame): Check
has_stack_frames.
* Makefile.in (event-top.o, frame.o, inf-loop.o, top.o): Depend on
$(gdbthread_h).
* monitor.c (monitor_open): Include "gdbthread.h". Clear thread
list here.
* remote.c (record_currthread): Upgrade the main thread and its
entry in the thread list if this is the first time we hear about
threads.
(remote_thread_alive): Consider magic_null_ptid or a ptid without
a tid member always alive.
(remote_find_new_threads): Don't update the main thread here.
(remote_start_remote): Clear thread list here. Always add the
main thread.
(extended_remote_attach_1): Add the main thread here.
(extended_remote_mourn_1): Re-add the main thread here.
(extended_remote_create_inferior_1): Add a main thread.
* Makefile.in (monitor.o): Depend on $(gdbthread_h).
Pedro Alves <pedro@codesourcery.com>
Based on work by Jan Kratochvil <jan.kratochvil@redhat.com> and Jeff
Johnston <jjohnstn@redhat.com>.
* NEWS: Mention attach to stopped process fix.
* infcmd.c (detach_command, disconnect_command): Discard the thread
list.
* infrun.c (handle_inferior_event): Do not ignore non-SIGSTOP while
attaching. Use signal_stop_state.
(signal_stop_state): Check stop_soon.
* linux-nat.c (kill_lwp): Declare earlier.
(pid_is_stopped, linux_nat_post_attach_wait): New.
(lin_lwp_attach_lwp): Use linux_nat_post_attach_wait. Update
comments.
(linux_nat_attach): Use linux_nat_post_attach_wait.
(detach_callback, linux_nat_detach): Improve handling for signalled
processes.
(linux_nat_pid_to_str): Always print out the LWP ID if it differs
from the process ID.
* Makefile.in (infcmd.o): Update.
2008-05-01 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.threads/attach-into-signal.c, gdb.threads/attach-into-signal.exp,
gdb.threads/attach-stopped.c, gdb.threads/attach-stopped.exp,
gdb.threads/attachstop-mt.c, gdb.threads/attachstop-mt.exp: New.
* breakpoint.c (until_break_command_continuation): Add
the 'error' parameter. Directly delete the breakoint as
opposed to running cleanups.
(until_break_command): Install continuation only
after starting the target. Don't use exec cleanups,
use ordinary cleanups. Discard cleanups is successfully
started the target in async mode.
(make_cleanup_delete_breakpoint): Remove.
* breakpoint.h (make_cleanup_delete_breakpoint): Remove
declaration.
* defs.h (do_exec_cleanups, make_exec_cleanup): Remove
declarations.
(struct continations): Add the 'error' parameter to the
continuation_hook field.
(add_continuation, do_all_continuations)
(add_intermediate_continuation)
(do_all_intermediate_continuations): Add the 'error' parameter.
* exceptions.c (throw_exception): Don't call do_exec_cleanups.
* inf-loop.c (inferior_event_handler): Instead of calling
discard_all_continuations, use do_all_continuations with 1 as
'error' parameter. Pass 0 as 'error' parameter in existing uses
of discard_all_continuations.
* infcmd.c (step_1): Do not use exec cleanup. For async case, discard
cleanups.
(step_once): Install continuation only after resuming the target.
(step_1_continuation): Disable longjmp breakpoint on error.
(finish_command_continuation): Add the error parameter. Delete
the finish breakpoint directly, do not use cleanups.
(finish_command): Do not use exec_cleanups. Always setup
continuation. For sync case, immediately run them.
(attach_command_continuation): Add the error parameter.
* infrun.c (fetch_inferior_event): Do not use exec cleanups to
remove step_resume_breakpoint -- adjust delete it directly.
* interps.c (interp_set): Adjust call to do_all_continations.
* mi/mi-interp.c (mi_interpreter_exec_continuation): Do not
do exec cleanups.
* mi/mi-main.c (mi_cmd_target_select): Do not do exec
cleanups.
(mi_cmd_execute): Do not use exec_cleanup.
(mi_execute_async_cli_command): Simplify the string concatenation
logic. Do no use exec cleanup.
(mi_exec_async_cli_cmd_continuation): New parameter error.
Free last_async_command.
* top.c (command_line_handler_continuation): New parameter error.
* utils.c (exec_cleanup_chain, make_exec_cleanup)
(do_exec_cleanups): Remove.
(add_continuation, do_all_continations)
(add_intermediate_continuation)
(do_all_intermediate_continuations): New parameter error.
* infrun.c (normal_stop) Move breakpoint_auto_delete further down
to allow printing to 'see' real reason of stop. This fixes PR 2424.
* breakpoint.c (bpdisp_texst): New function. The function takes over
the role of bpstats static array in print_one_breakpoint_location.
(print_it_typical): Print "Temporary breakpoint" instead
of just "Breakpoint" when breakpoint is, well, temporary. For mi-like
protocols, print disp field.
(print_one_breakpoint_location): Removed bpdisps static definition.
Call new bpstat_text function to get value for 'disp' field.
(mention): Print "Temporary breakpoint" instead of just "Breakpoint".
* fork-child.c (startup_inferior): Do not set
inferior_ignoring_leading_exec_events.
* inf-child.c (inf_child_reported_exec_events_per_exec_call): Remove.
(inf_child_target): Do not set to_reported_exec_events_per_exec_call.
* infrun.c (inferior_ignoring_leading_exec_events): Remove.
(handle_inferior_event): Remove code for ignoring leading exec
events.
* target.c (update_current_target): Do not inherit, or default,
to_reported_exec_events_per_exec_call.
(debug_to_reported_exec_events_per_exec_call): Remove.
(setup_target_debug): Do not set to_reported_exec_events_per_exec_call.
* target.h (target_reported_exec_events_per_exec_call): Remove.
(struct target): Remove the to_reported_exec_events_per_exec_call
field.
* NEWS: Mention exec tracing support.
* inf-ttrace.c (inf_ttrace_wait): Return TARGET_WAITKIND_EXECD for
exec events.
* infcmd.c (kill_if_already_running, detach_command)
(disconnect_command): Replace SOLIB_RESTART with no_shared_libraries.
* infrun.c (MAY_FOLLOW_EXEC, may_follow_exec): Delete.
(follow_exec): Do not check may_follow_exec. Do not mourn and push
targets. Apply the sysroot path to the loaded executable. Use
no_shared_libraries.
* linux-nat.c (linux_child_follow_fork): Print fork following
messages if verbose.
(kill_wait_callback): Kill again before waiting a second time.
* symfile.c (symbol_file_clear): Replace SOLIB_RESTART with
no_shared_libraries.
* gdb.base/foll-exec.exp: Update header. Skip on remote targets.
Run on GNU/Linux.
(do_exec_tests): Check for systems which do not support catchpoints.
Do not match START.
* gdb.base/foll-fork.exp: Update header. Skip on remote targets.
Run on GNU/Linux. Enable verbose output.
(check_fork_catchpoints): New.
(explicit_fork_child_follow, catch_fork_child_follow)
(tcatch_fork_parent_follow): Update expected messages.
(do_fork_tests): Use check_fork_catchpoints.
* gdb.base/foll-vfork.exp: Update header. Skip on remote targets.
Run on GNU/Linux. Enable verbose output.
(check_vfork_catchpoints): New.
(vfork_parent_follow_to_bp, tcatch_vfork_then_child_follow): Update
expected messages.
(do_vfork_and_exec_tests): Use check_fork_catchpoints.
* thread.c (add_thread_silent): Renamed
from add_thread.
(print_thread_events): New variable definition.
(show_print_thread_events): New function.
(_initialize_thread): Add "set print thread-events" and
"show print thread-events" commands.
(add_thread): Announce new thread.
* gdbthread.h (add_thread_silent): Declare.
(print_thread_events): New variable declaration.
* inf-ttrace.c (inf_ttrace_wait): Don't
inform about new thread, as add_thread is always
called too, and will take care of that.
* infrun.c (handle_inferior_event): Likewise.
* procfs.c (procfs_wait): Likewise.
* remote.c (remote_currthread): Likewise.
* sol-thread.c (sol_thread_wait): Likewise.
* win32-nat.c (get_win32_debug_event): Likewise.
* linux-thread-db.c (attach_thread): Likewise.
Remove the verbose parameter.
(check_event): Make detach_thread be verbose
only if print_thread_events is set.
* linux-nat.c (lin_lwp_attach_lwp): Don't inform
about new thread. This is called only from
linux-thread-db.c:attach_thread, which will take care.
Remove the verbose parameter.
* linux-nat.h (lin_lwp_attach_lwp): Adjust prototype.
* infrun.c (handle_inferior_event): Remove
calls to remove_breakpoints, except where needed to
communicate change of breakpoint locations to inferior.
(keep_going): If steppping over breakpoint, remove
breakpoints.
* infrun.c (trap_expected): Rename
to stepping_over_breakpoint. Document.
(stepping_past_breakpoint): Remove.
(stepping_past_breakpoint_ptdi): Renamed
to deferred_step_ptid.
(struct execution_control_state): Rename
the another_trap field to stepping_over_breakpoint.
(struct inferior_status): Rename the trap_expected
field to stepping_over_breakpoint.
(clear_proceed_status, proceed)
(init_execution_control_state, context_switch)
(handle_inferior_event, currently_stepping)
(keep_going, save_inferior_status)
(restore_inferior_status, prepare_to_proceed): Adjust.
* gdbthread.h (struct thread_info): Rename the
trap_expected field to stepping_over_breakpoint.
* thread.c (load_infrun_state, save_infrun_state):
Adjust.
* breakpoint.h (insert_breakpoints): Change
return type to void.
* breakpoint.c (insert_breakpoints): Change
return type to void. Rename local return_val
variable to error.
* infrun.c (keep_going): Instead of checking
return value from insert_breakpoints, catch exception.
The checks of breakpoints_inserted before calling
remove_breakpoints are removed, as remove_breakpoint
won't touch uninserted breakpoints. In a number of places,
we're interested if a breakpoint is inserted at particular
PC, and we now use breakpoint_inserted_here_p. In a few
places, insert_breakpoints can be called unconditionally,
since it won't try to insert already inserted breakpoint.
* breakpoint.h (regular_breakpoint_inserted_here_p): New
declaration.
* breakpoint.c (regular_breakpoint_inserted_here_p): New.
(breakpoint_inserted_here_p): Use
regular_breakpoint_inserted_here_p.
* infrun.c (breakpoints_inserted): Remove.
(resume): Don't check for breakpoints_inserted before
remove_hw_watchpoints. Use breakpoint_inserted_here_p.
(proceed, init_wait_for_inferior): Don't set breakpoints_inserted.
(handle_inferior_event): Don't use breakpoints_inserted.
Use breakpoints_meant_to_be_inserted and
breakpoints_inserted_here_p.
(insert_step_resume_breakpoint_at_sal, keep_going): Use
breakpoints_meant_to_be_inserted. Don't set breakpoints_inserted.
(normal_stop): Don't check for breakpoints_inserted. Don't
set breakpoints_inserted.
(keep_going): Don't check for breakpoints_inserted.
(insert_step_resume_breakpoint_at_sal): Don't insert
breakpoints
* frame.c (frame_id_inner): Add gdbarch parameter. Replace
current_gdbarch by gdbarch.
(frame_find_by_id, get_prev_frame_1): Use get_frame_arch to get at the
current architecture by frame_info.
* frame.h (frame_id_inner): Add gdbarch parameter.
* stack.c (return_command): Use get_frame_arch to get at the current
architecture by frame_info. Update call of frame_id_inner.
* infrun.c (handle_inferior_event): Likewise.
* dummy-frame.c (dummy_frame_push): Use get_regcache_arch to get at the
current architecture by regcache. Update call of frame_id_inner.
Jeff Johnston <jjohnstn@redhat.com>
* breakpoint.c (watchpoints_triggered): New.
(bpstat_stop_status): Remove STOPPED_BY_WATCHPOINT argument.
Check watchpoint_triggered instead. Combine handling for software
and hardware watchpoints. Do not use target_stopped_data_address
here. Always check a watchpoint if its scope breakpoint triggers.
Do not stop for thread or overlay events. Improve check for
triggered watchpoints without a value change.
(watch_command_1): Insert the scope breakpoint first. Link the
scope breakpoint to the watchpoint.
* breakpoint.h (enum watchpoint_triggered): New.
(struct breakpoint): Add watchpoint_triggered.
(bpstat_stop_status): Update prototype.
(watchpoints_triggered): Declare.
* infrun.c (enum infwait_status): Add infwait_step_watch_state.
(stepped_after_stopped_by_watchpoint): Delete.
(handle_inferior_event): Make stepped_after_stopped_by_watchpoint
local. Handle infwait_step_watch_state. Update calls to
bpstat_stop_status. Use watchpoints_triggered to check
watchpoints.
* remote.c (stepped_after_stopped_by_watchpoint): Remove extern.
(remote_stopped_data_address): Do not check it.
* gdb.texinfo (Setting Watchpoints): Adjust warning text about
multi-threaded watchpoints.
* gdbint.texinfo (Watchpoints): Describe how watchpoints are
checked. Describe sticky notification. Expand description
of steppable and continuable watchpoints.
(Watchpoints and Threads): New subsection.
* gdb.threads/watchthreads.c (thread_function): Sleep between
iterations.
* gdb.threads/watchthreads.exp: Allow two watchpoints to trigger
at once for S/390. Generate matching fails and passes.
(resolve_pending_breakpoint): Remove.
(re_enable_breakpoints_in_shlibs): Remove.
(unlink_locations_from_global_list): New.
(update_breakpoint_locations): New.
(breakpoint_re_set_one): Don't bail out on pending breakpoints.
Use parse_condition and update_breakpoint_location to
reset breakpoint. Ignore 'symbol not found' error from
decode_line_1.
(breakpoint_re_set): Don't emit newline before the
reason why breakpoint is not reset.
(do_enable_breakpoint): Don't specially process pending
breakpoints.
(free_bp_location): New.
(break_command_1): For pending breakpoints, initialize
all fields of a sal with zeroes.
* breakpoint.h (re_enable_breakpoints_in_shlibs): Remove.
* infcmd.c (post_create_inferior): Don't call
re_enable_breakpoints_in_shlibs.
* infrun.c (handle_inferior_event): Likewise.
* solib-irix.c (irix_solib_create_inferior_hook): Likewise.
* solib-osf.c (osf_solib_create_inferior_hook): Likewise.
* win32-nat.c (get_win32_debug_event): Likewise.
(stepping_past_breakpoint_ptid): Likewise.
(prepare_to_proceed): Add STEP parameter. Do not check for Ctrl-C.
Only switch threads if we need to single-step over a breakpoint hit
in the previously selected thread. If stepping, remember previous
thread to switch back to in STEPPING_PAST_BREAKPOINT[_PTID]. Call
switch_to_thread instead of copying its contents.
(proceed): Pass STEP to prepare_to_proceed. Always set ONEPROC if
prepare_to_proceed returns true.
(init_wait_for_inferior): Reset STEPPING_PAST_BREAKPOINT.
(context_switch): Call switch_to_thread.
(handle_inferior_event): Switch back to previous thread if requested
in STEPPING_PAST_BREAKPOINT[_PTID] by prepare_to_proceed.
* gdbthread.h (switch_to_thread): Add prototype.
* thread.c (switch_to_thread): Make global.
(start_remote): Use STOP_QUIETLY_REMOTE.
(handle_inferior_event): Do not condition TARGET_WAITKIND_LOADED
support on a SOLIB_ADD definition. Update breakpoints_inserted.
Update to match shared library event breakpoint support. Only
resume if appropriate. Handle STOP_QUIETLY_REMOTE.
(normal_stop): Handle TARGET_WAITKIND_LOADED.
* fork-child.c (startup_inferior): Do not set
inferior_ignoring_startup_exec_events
* inferior.h (inferior_ignoring_startup_exec_events): Delete
declaration.
(enum stop_kind): Improve documentation. Add STOP_QUIETLY_REMOTE.
* config/gdbserver.exp (gdb_reconnect): New.
* gdb.base/so-disc-shr.c, gdb.base/solib-disc.c,
gdb.base/solib-disc.exp: New files.
* lib/gdb.exp (gdb_test_multiple): Allow tests to match "Ending
remote debugging".
(gdb_compile): Add shlib_load flag.
* lib/gdbserver-support.exp (gdbserver_run): Save the protocol and
port.
(gdbserver_reconnect): New.
is always active if SOFTWARE_SINGLE_STEP_P is true.
(resume): Use gdbarch_software_single_step[_p] instead of
SOFTWARE_SINGLE_STEP[_P].
(handle_inferior_event): Do not check for SOFTWARE_SINGLE_STEP_P.
* gdbarch.sh (software_single_step): Remove target macro.
* gdbarch.h, gdbarch.c: Regenerate.
(normal_stop): Allocate regcache for stop_registers.
(struct inferior_status): Remove stop_registers member.
(save_inferior_status): Do not save stop_registers.
(restore_inferior_status): Do not restore stop_registers.
(discard_inferior_status): Do not discard stop_registers.
(build_infrun): Remove.
(_initialize_infrun): Do not swap stop_registers.