Commit Graph

164 Commits

Author SHA1 Message Date
Daniel Jacobowitz edb3359dff gdb/
* 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.
2009-06-28 00:20:24 +00:00
Michael Snyder a49f981ff4 2009-06-21 Michael Snyder <msnyder@vmware.com>
* inferior.h: Update ancient comment.
2009-06-21 18:00:22 +00:00
Ulrich Weigand 9898f801b4 * gdbarch.sh (pointer_to_address): Change to type 'm'.
(address_to_pointer): Likewise.
	* gdbarch.c, gdbarch.h: Regenerate.

	* inferior.h (unsigned_pointer_to_address): Add GDBARCH argument.
	(signed_pointer_to_address): Likewise.
	(unsigned_address_to_pointer, address_to_signed_pointer): Likewise.
	* findvar.c (unsigned_pointer_to_address): Likewise.
	(signed_pointer_to_address): Likewise.
	(unsigned_address_to_pointer, address_to_signed_pointer): Likewise.

	* avr-tdep.c (avr_address_to_pointer): Likewise.
	(avr_pointer_to_address): Likewise.
	* iq2000-tdep.c (iq2000_pointer_to_address): Likewise.
	(iq2000_address_to_pointer): Likewise.
	* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
	(m32c_m16c_pointer_to_address): Likewise.
	* spu-tdep.c (spu_pointer_to_address): Likewise.
	* xstormy16-tdep.c (xstormy16_pointer_to_address): Likewise.
	(xstormy16_address_to_pointer): Likewise.
2009-06-17 18:50:31 +00:00
Ulrich Weigand bd57a74827 * gdbarch.sh (construct_inferior_arguments): Remove.
* gdbarch.c, gdbarch.h: Regenerate.
	* infcmd.c (get_inferior_args): Call construct_inferior_arguments
	directly instead of gdbarch_construct_inferior_arguments.
	(construct_inferior_arguments): Remove GDBARCH argument.
	* inferior.h (construct_inferior_arguments): Likewise.
2009-06-17 18:35:33 +00:00
Pedro Alves d4db2f362f gdb/
* 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.
2009-06-11 11:57:46 +00:00
Pedro Alves cc35222d22 * inferior.h (procfs_first_available): Move declaration to...
* proc-utils.h: ... here.
	* sol-thread.c: Include procfs.h and proc-utils.h.
2009-06-07 18:41:40 +00:00
Pedro Alves 09d3bde977 * inferior.h (proc_iterate_over_mappings): Delete declaration.
* nto-tdep.h (proc_iterate_over_mappings): Delete declaration.
	* procfs.c (proc_iterate_over_mappings): Delete.
2009-06-07 17:58:24 +00:00
Pedro Alves c35b149212 * target.h (struct target_ops): Make to_has_all_memory,
to_has_memory, to_has_stack, to_has_registers and to_has_execution
	methods instead of variables.
	(target_has_all_memory_1, target_has_memory_1, target_has_stack_1)
	(target_has_registers_1, target_has_execution_1): Declare
	functions.
	(target_has_all_memory): Rewrite to call target_has_all_memory_1.
	(target_has_memory): Rewrite to call target_has_memory_1.
	(target_has_stack): Rewrite to call target_has_all_stack_1.
	(target_has_registers): Rewrite to call target_has_registers_1.
	(target_has_execution): Rewrite to call target_has_execution_1.
	(default_child_has_all_memory, default_child_has_memory)
	(default_child_has_stack, default_child_has_registers)
	(default_child_has_execution): Declare.
	(target_mark_running, target_mark_exited): Delete declarations.
	* target.c (default_child_has_all_memory,
	default_child_has_memory, default_child_has_stack,
	default_child_has_registers, default_child_has_execution): New.
	(target_has_all_memory_1, target_has_memory_1, target_has_stack_1,
	target_has_registers_1, target_has_execution_1): New.
	(add_target): Default the to_has_all_memory, to_has_all_memory,
	to_has_memory, to_has_stack, to_has_registers and to_has_execution
	callbacks to return 0.
	(update_current_target): Do not inherit to_has_all_memory,
	to_has_memory, to_has_stack, to_has_registers or to_has_execution.
	(target_mark_running, target_mark_exited): Delete.
	(memory_xfer_partial): Adjust.
	(target_read_memory, target_write_memory, target_search_memory):
	Dispatch to the the top-most target, not the flattened
	current_target.
	(target_info): Adjust.
	(init_dummy_target): Install return_zero as callback for
	to_has_all_memory, to_has_memory, to_has_stack, to_has_registers,
	to_has_execution.
	(set_maintenance_target_async_permitted): Use have_live_inferiors
	instead of target_has_execution.
	* target-memory.c (target_write_memory_blocks): Dispatch memory
	writes to the the top-most target, not the flattened
	current_target.

	* breakpoint.c (insert_breakpoints): Don't check for
	target_has_execution here.
	(update_global_location_list): Check if there are live inferiors
	to debug instead of target_has_execution.
	* infcmd.c (kill_command, detach_command): Check if there are
	inferiors instead of target_has_execution.
	* inferior.h (have_live_inferiors): Declare.
	* inferior.c (have_live_inferiors): New.
	* infrun.c (normal_stop): Don't check for target_has_execution to
	finish the thread states.
	* thread.c (is_thread_state, is_stopped, is_exited, is_running)
	(any_running, is_executing): Remove checks for
	target_has_execution.
	* top.c (kill_or_detach): Don't try to kill core inferiors.
	(quit_target): Don't check for target_has_execution.

	* corelow.c (core_has_memory, core_has_stack, core_has_registers):
	New.
	(init_core_ops): Install core_has_memory, core_has_stack and
	core_has_registers.
	* exec.c (exec_has_memory): New.
	(init_exec_ops): Install exec_has_memory.
	* remote.c (remote_add_inferior): Don't call target_mark_running.
	(remote_start_remote): Don't call target_mark_exited or call
	target_mark_running.
	(remote_open_1): Use have_inferiors instead of
	target_has_execution.  Don't use target_mark_exited.
	(init_remote_ops): Install deafult_child_has_all_memory,
	default_child_has_memory, default_child_has_stack,
	default_child_has_registers, default_child_has_execution.
	* bsd-kvm.c (bsd_kvm_return_one): New.
	(bsd_kvm_add_target): Register bsd_kvm_return_one as
	to_has_memory, to_has_stack and to_has_registers callbacks.
	* remote-m32r-sdi.c (m32r_return_one): New.
	(init_m32r_ops): Register it.
	* inf-child.c (inf_child_target): Adjust to register
	default_child_has_all_memory, default_child_has_memory,
	default_child_has_stack, default_child_has_registers,
	default_child_has_execution callbacks.
	* gnu-nat.c (init_gnu_ops): Likewise.
	* go32-nat.c (init_go32_ops): Likewise.
	* hpux-thread.c (init_hpux_thread_ops): Likewise.
	* monitor.c (init_base_monitor_ops): Likewise.
	* nto-procfs.c (init_procfs_ops): Likewise.
	* remote-mips.c (_initialize_remote_mips): Likewise.
	* windows-nat.c (init_windows_ops): Likewise.
	* remote-sim.c (gdbsim_create_inferior): Don't use
	target_mark_running or target_mark_exited.
	(gdbsim_mourn_inferior): Don't call target_mark_exited.
	(init_gdbsim_ops): Adjust to register
	default_child_has_all_memory, default_child_has_memory,
	default_child_has_stack, default_child_has_registers,
	default_child_has_execution callbacks.

	* linux-nat.c (linux_nat_xfer_partial): If reading memory, and
	there's no inferior selected, defer to a lower stratum.
2009-06-07 16:46:48 +00:00
Pedro Alves 191c4426c1 * fork-child.c: Don't include frame.h. Include terminal.h.
(fork_inferior): Call new_tty_postfork after forking adn adding
	the child to the inferior list.
	* inferior.h (new_tty_prefork, gdb_has_a_terminal): Don't declare
	here.
	* inflow.c (struct terminal_info): Remove const qualifier from
	`run_terminal' field.
	(inferior_thisrun_terminal): Tweak comment.
	(inflow_inferior_exit): Release the `run_terminal' field.
	(copy_terminal_info): New function.
	(new_tty_postfork): New function.
	* terminal.h (new_tty_prefork, new_tty, new_tty_postfork,
	(copy_terminal_info, gdb_has_a_terminal, gdb_setpgid): Declare.
	* inf-ptrace.c: Include terminal.h.
	(inf_ptrace_follow_fork): Copy the parent's terminal info to the
	child.
	* linux-nat.c: Include terminal.h.
	(linux_child_follow_fork): Copy the parent's terminal info to the
	child.
	* inf-ttrace.c: Include terminal.h.
	(inf_ttrace_follow_fork): Copy the parent's terminal info to the
	child.
2009-05-19 02:46:45 +00:00
Pedro Alves 7e1789f556 * inflow.h (our_process_group): Remove declaration.
(inferior_process_group): Delete global variable declaration.
	(inferior_process_group): New function declaration.
	* inflow.c: Include observer.h.
	(inferior_ttystate, our_ttystate, tflags_inferior, tflags_ours):
	Delete.
	(struct terminal_info): New struct.
	(our_terminal_info): New global.
	(inferior_process_group): New function.
	(inferior_thisrun_terminal): Extend description comment.
	(gdb_has_a_terminal): Adjust to write to our_terminal_info fields
	instead of globals.
	(terminal_init_inferior_with_pgrp): Adjust to per-inferior
	terminal settings.
	(terminal_inferior): Ditto.
	(terminal_ours_1): Ditto.
	(inflow_new_inferior, inflow_inferior_exit): New functions.
	(child_terminal_info): Adjust to per-inferior terminal settings.
	(osig_set): New global.
	(set_sigint_trap): Adjust to per-inferior terminal settings.  Set
	or clear `osig_set' accordingly.
	(clear_sigint_trap): Check `osig_set' to decide wheater to restore
	SIGINT handler, instead of checking the current inferior (which
	may be none).
	(_initialize_inflow): Attach inflow_new_inferior and
	inflow_inferior_exit to the "new_inferior" and "inferior_exit"
	notifications, respectively.
	* inferior.h (struct terminal_info): Forward declare.
	(struct inferior): Add `terminal_info' field.
	* inferior.c (delete_inferior_1): Notify the inferior_exit
	observers before removing the inferior from the lists and deleting
	it.
	* inf-ptrace.c (inf_ptrace_stop): `inferior_process_group' is now
	a function instead of a variable.  Adjust.
	* procfs.c (procfs_stop): Ditto.
2009-05-18 00:58:38 +00:00
Ulrich Weigand fb14de7bbd * inferior.h (read_pc, write_pc): Remove.
* regcache.c (read_pc, write_pc): Remove.

	* infrun.c (displaced_step_fixup): Use regcache_read_pc instead
	of read_pc.
	(handle_inferior_event): Use regcache_read_pc instead of read_pc
	when determining value of stop_pc.  Replace subsequent uses of
	read_pc by inspecting already-retrieved stop_pc value.
	(keep_going): Use regcache_read_pc instead of read_pc.

	* breakpoint.c (watchpoint_check): Use current frame architecture
	and PC instead of current_gdbarch and read_pc ().
	* tracepoint.c (set_traceframe_context): Replace PC argument
	with FRAME argument.
	(trace_start_command, finish_tfind_command): Update calls.
	(finish_tfind_command): Compare frame IDs to identify transitions
	between frames.
	(trace_find_pc_command): Use regcache_read_pc instead of read_pc.
	* rs6000-nat.c (exec_one_dummy_insn): Pass in regcache instead
	of gdbarch.  Use regcache_read_pc and regcache_write_pc instead
	of read_pc and write_pc.
	(store_register): Make regcache argument non-const.  Update call
	to exec_one_dummy_insn.

	* thread.c (switch_to_thread): Use regcache_read_pc instead of read_pc.
	* infcmd.c (post_create_inferior): Likewise.
	* solib-darwin.c (darwin_solib_create_inferior_hook): Likewise.
	* solib-pa64.c (pa64_solib_create_inferior_hook): Likewise.
	* solib-sunos.c (sunos_solib_create_inferior_hook): Likewise.
	* solib-svr4.c (enable_break, svr4_relocate_main_executable): Likewise.
	* linux-fork.c (fork_load_infrun_state): Likewise.
	* hppa-hpux-tdep.c (hppa_hpux_push_dummy_code): Likewise.
	* record.c (record_wait): Likewise.
	* procfs.c (procfs_wait): Likewise.
	* remote-mips.c (common_open, mips_wait): Likewise.
	* remote-m32r-sdi.c (m32r_resume): Likewise.

	* symfile.c (generic_load): Use regcache_write_pc instead of write_pc.
	* monitor.c (monitor_create_inferior, monitor_load): Likewise.
	* m32r-rom.c (m32r_load, m32r_upload_command): Likewise.
	* remote-m32r-sdi.c (m32r_create_inferior, m32r_load): Likewise.
	* remote-mips.c (mips_create_inferior, mips_load): Likewise.

	* solib-darwin.c: Include "regcache.h".
	* solib-pa64.c: Include "regcache.h".
	* solib-svr4.c: Include "regcache.h.".

	* symfile.c: Do not mention read_pc or write_pc in comments.
	* dink32-rom.c: Likewise.
	* m32r-rom.c: Likewise.
	* mips-tdep.c: Likewise.
2009-05-05 13:24:49 +00:00
Pedro Alves f3b1572e1a gdb/
* 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.
2009-03-22 18:06:07 +00:00
Pedro Alves c5a4d20bb9 * gdbthread.h (struct thread_info): Add in_infcall member.
* infcall.c (run_inferior_call): Save, set and restore in_infcall.
	Remove reverences to suppress_resume_observer.  Refresh
	`call_thread' after returning from `proceed'.
	* infcmd.c (suppress_resume_observer): Delete.
	* inferior.h (suppress_resume_observer): Delete declaration.
	* mi/mi-interp.c (mi_on_resume): Suppress output while calling an
	inferior function.
	* thread.c (set_running): Remove references to
	suppress_resume_observer.
	* infrun.c (struct inferior_status): Add in_infcall member.
	(save_inferior_status): Save it.
	(restore_inferior_status): Restore it.
2009-03-22 17:59:59 +00:00
Pedro Alves 41d2bdb467 * infcall.c (run_inferior_call): Remove references to
suppress_stop_observer.
	* infcmd.c (suppress_stop_observer): Delete.
	(finish_command_continuation): Remove NOTE.  Don't clear
	suppress_stop_observer anymore.
	(finish_command_continuation_free_arg): Likewise.
	(finish_forward): Remove references to suppress_stop_observer.
	Call normal_stop observer if we haven't already.
	* inferior.h (suppress_stop_observer): Delete.
	* infrun.c (normal_stop): When deciding to suppress the
	normal_stop observer, check for proceed_to_finish instead of
	suppress_stop_observer.
2009-03-22 17:57:11 +00:00
Pedro Alves 1941c569e4 * inferior.h (notice_new_inferior): Declare.
* infcmd.c (notice_new_inferior): New.
	* remote.c (remote_add_inferior, remote_add_thread): New.
	(notice_new_inferiors): Rename to...
	(remote_notice_new_inferior): ... this.  Add RUNNING argument.
	Use remote_add_thread instead of add_thread, passing it the
	RUNNING argument.  Add an inferior with remote_add_inferior.  If
	we just learned about an inferior, call notice_new_inferior.
	(record_currthread): Adjust.
	(remote_threads_info): Adjust to use remote_notice_new_inferior.
	(remote_start_remote, extended_remote_attach_1): Use remote_add_inferior.
	(process_stop_reply): Adjust.  Call remote_notice_new_inferior
	after handling expedited registers and watchpoint state.
	(extended_remote_create_inferior_1): Use remote_add_inferior.
2009-03-04 22:50:59 +00:00
Pedro Alves 2c0b251b29 2008-02-21 Pedro Alves <pedro@codesorcery.com>
Silence a few -Wmissing-prototypes warnings.

	PR build/9877:
	* amd64-nat.c: Include "amd64-nat.h".
	* fork-child.c (_initialize_fork_child): Ditto.
	* gcore.c (_initialize_gcore): Ditto.
	* inf-ptrace.c: Include "inf-ptrace.h".
	(inf_ptrace_store_registers): Make it static.
	* linux-nat.c (linux_nat_terminal_ours): Make it static.
	(_initialize_linux_nat): Declare before definition.
	* linux-tdep.c: Include "linux-tdep.h".
	* linux-thread-db.c (_initialize_thread_db): Declare before
	definition.
	* proc-service.c (_initialize_proc_service): Ditto.
	* remote.c (remote_send_printf): Make it static.
	* solib.c: Include "solib.h".
	* symfile-mem.c (_initialize_symfile_mem): Declare before
	definition.
	* ada-lang.c (ada_la_decode, ada_match_name)
	(ada_suppress_symbol_printing, ada_is_array_type)
	(ada_value_ptr_subscript, ada_array_length)
	(ada_to_static_fixed_value): Make them static.
	(_initialize_ada_language): Declare before definition.
	* ada-tasks.c (ada_get_task_number, ada_get_environment_task)
	(ada_task_list_changed, ada_new_objfile_observer): Make them
	static.
	(_initialize_tasks): Declare before definition.
	* addrmap.c (_initialize_addrmap): Declare before definition.
	* auxv.c (default_auxv_parse): Make it static.
	* bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make
	them static.
	* breakpoint.c (remove_sal): Add line break.
	(expand_line_sal_maybe): Make it static.
	* cp-name-parser.y: Include "cp-support.h".
	* cp-valprint.c (cp_find_class_member): Make it static.
	* eval.c (value_f90_subarray): Ditto.
	* exceptions.c (print_any_exception): Ditto.
	* findcmd.c (_initialize_mem_search): Declare before definition.
	* frame.c (frame_observer_target_changed): Make it static.
	* gnu-v3-abi.c (gnuv3_find_method_in): Make it static.
	* inf-child.c: Include "inf-child.h".
	* inferior.h (valid_inferior_id): Rename to ...
	(valid_gdb_inferior_id): ... this.
	* infrun.c (infrun_thread_stop_requested, siginfo_make_value):
	Make them static.
	* jv-lang.c (java_language_arch_info): Make it static.
	* m2-typeprint.c (m2_get_discrete_bounds): Ditto.
	* osdata.c (info_osdata_command): Make it static.
	* regcache.c (regcache_observer_target_changed): Make it static.
	* reverse.c (_initialize_reverse): Declare before definition.
	* stabsread.c (cleanup_undefined_types_noname)
	(cleanup_undefined_types_1): Make them static.
	* symfile.c (place_section): Make it static.
	* symtab.c (find_pc_sect_psymtab_closer): Make it static.
	* target-descriptions.c (_initialize_target_descriptions): Declare
	before definition.
	* target.c (default_get_ada_task_ptid, find_default_can_async_p)
	(find_default_is_async_p, find_default_supports_non_stop): Make
	them static.
	(target_supports_non_stop): Add prototype.
	(dummy_pid_to_str): Make it static.
	* utils.c (_initialize_utils): Declare before definition.
	* ada-exp.y (_initialize_ada_exp): Declare before definition.
	* solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype.
	* target.h (struct target_ops): Add a prototype to the
	to_can_execute_reverse callback.
	* macroscope.c (_initialize_macroscope): Declare before definition.
	* cp-namespace.c (_initialize_cp_namespace): Declare before definition.
	* python/python.c (_initialize_python): Declare before definition.
	* tui/tui-command.c: Include "tui/tui-command.h".
	* tui/tui-data.c (init_content_element, init_win_info): Make them
	static.
	* tui/tui-disasm.c: Include "tui/tui-disasm.h".
	* tui/tui-interp.c (_initialize_tui_interp): Declare before
	definition.
	* tui/tui-layout.c: Include "tui/tui-layout.h".
	(_initialize_tui_layout): Declare before definition.
	* tui/tui-regs.c: Include "tui/tui-regs.h".
	(tui_display_reg_element_at_line): Make it static.
	(_initialize_tui_regs): Declare before definition.
	* tui/tui-stack.c (_initialize_tui_stack): Declare before
	definition.
	* tui/tui-win.c: Include "tui/tui-win.h".
	(_initialize_tui_win): Declare before definition.
	(tui_sigwinch_handler): Make it static.  Wrap in ifdef SIGWINCH.
	* tui/tui-win.h (tui_sigwinch_handler): Delete declaration.
	(tui_get_cmd_list): Add a prototype.
	* tui/tui-windata.c: Include tui-windata.h.
	* tui/tui-wingeneral.c (box_win): Make it static.
	* cli/cli-logging.c (show_logging_command): Make it static.
	(_initialize_cli_logging): Declare before definition.
	* mi/mi-common.c (_initialize_gdb_mi_common): Declare before
	definition.
2009-02-21 16:14:50 +00:00
Doug Evans b89667ebd4 * dummy-frame.c (dummy_frame): Replace regcache member with
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.
2009-01-19 19:05:01 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Tristan Gingold d26b535418 2008-12-16 Tristan Gingold <gingold@adacore.com>
* inflow.c: Remove old_sigio, handle_sigio, old_fcntl_flags,
	set_sigio_trap, clear_sigio_trap definitions.
	* inferior.h: Remove set_sigio_trap and clear_sigio_trap declarations.
	* inf-ptrace.c (inf_ptrace_wait): Remove call to set_sigio_trap
	and clear_sigio_trap.
	* inf-ttrace.c (inf_ttrace_wait): Ditto.
	* linux-nat.c (linux_nat_wait): Ditto.
	* spu-linux-nat.c (spu_child_wait): Ditto.
	* rs6000-nat.c (rs6000_wait): Ditto.
	* target.c: Remove target_activity_function and target_activity_fd.
	* target.h: Remove target_activity_function and target_activity_fd
	declarations.
2008-12-16 11:15:58 +00:00
Doug Evans 642fd10146 * inferior.h (proceed_to_finish): Delete, unused.
(stop_registers): Tweak comment.
	* infrun.c (stop_registers): Tweak comment.
2008-11-20 00:35:23 +00:00
Vladimir Prus 6418d433f1 Implement '-target-detach pid'.
* infcmd.c (detach_command): Make nonstatic.
        * inferior.h (detach_command): Declare.
        * mi/mi-cmds.c (mi_cmds): Don't route -target-detach via CLI.
        * mi/mi-cmds.h (mi_cmd_target_detach): Declare.
        * mi/mi-main.c (find_thread_of_process, mi_cmd_target_detach): New.
2008-11-17 16:37:35 +00:00
Vladimir Prus 136d6dae62 Kill pthread_ops_hack
* target.h (struct target_ops): Make to_attach, to_detach,
	to_create_inferior and to_mourn_inferior accept a pointer
    	to struct target_ops.
	(target_attach, target_create_inferior, target_create_inferior):
	Convert from macros to function.  Find the right target to
	invoke a method of.
	(find_default_attach, find_default_create_inferior): New parameter
	ops.
	* corefile.c (core_file_command): Pass target to to_detach.
	* corelow.c (core_detach): Add 'ops' parameter.
	* fork-child.c (fork_inferior): Return the pid.  Allow
	init_trace_fun to be NULL.
	* inf-ptrace (ptrace_ops_hack): Remove.
	(inf_ptrace_him): Remove, moving all logic into....
	(inf_ptrace_create_inferior): ... here.  Push the target
	passed as parameter.
	(inf_ptrace_mourn_inferior, inf_ptrace_attach, inf_ptrace_detach):
	Push/pop target passed as parameter, no ptrace_ops_hack.
	(inf_ptrace_target): Don't remember result.
	* inferior.h (fork_inferior): Adjust prototype.
	* linux-nat.c (linux_nat_create_inferior, linux_nat_attach)
	(linux_nat_detach, linux_nat_mourn_inferior): New parameter ops.
	Pass it to linux_ops target.
	* linux-thread-db.c (thread_db_detach, thread_db_mourn_inferior):
	New parameter ops. Pass it to the target beneath.
	* remote.c (remote_mourn, extended_remote_mourn, remote_detach)
	(extended_remote_create_inferior): New parameter ops. Pass it
	further.
	* target.c (debug_to_attach, debug_to_detach)
	(debug_to_mourn_inferior): New parameter ops.
	(target_create_inferior): New.
	(update_current_target): Do not inherit to_attach, to_detach,
	to_create_inferiour, to_mourn_inferior.  Do not default
	to_detach and to_mourn_inferior.
	(target_detach): Find the right target to use.
	(target_mourn_inferior): New.
	(find_default_attach, find_default_create_inferior): New parameter
	ops.  Pass the found target when calling its method.
	(init_dummy_target): Provide fallback definition of to_detach.
	(target_attach): New.
	(debug_to_attach, debug_to_detach, debug_to_create_inferior)
	(debug_to_mourn_inferiour): New parameter ops.
        * aix-thread.c: Adjust.
        * bsd-uthread.c: Adjust.
        * gnu-nat.c: Adjust.
        * go32-nat.c: Adjust.
        * hpux-thread.c: Adjust.
        * inf-ttrace.c: Ajust.
        * monitor.c: Adjust.
        * nto-procfs.c: Adjust.
        * procfs.c: Adjust.
        * remote-m32r-sdi.c: Adjust.
        * remote-mips.c: Adjust.
        * remote-sim.c: Adjust.
        * rs6000-nat.c: Adjust.
        * sol-thread.c: Adjust.
        * win32-nat.c: Adjust.
	* dec-thread.c: Adjust.
2008-11-09 11:27:18 +00:00
Pedro Alves e0ba674611 * defs.h (add_inferior_continuation)
(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.
2008-11-05 20:23:07 +00:00
Pedro Alves 2fdf0e429d * inferior.h (inferior_ignoring_leading_exec_events): Delete
declaration.
2008-10-31 20:02:04 +00:00
Pedro Alves 3990c31b8a * inferior.h (write_inferior_status_register): Delete.
* infrun.c (write_inferior_status_register): Delete.
2008-10-31 19:41:37 +00:00
Pedro Alves 252fbfc86a gdb/
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.
2008-10-23 23:11:21 +00:00
Michael Snyder b2175913c5 2008-10-17 Michael Snyder <msnyder@vmware.com>
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.
2008-10-17 19:43:47 +00:00
Pedro Alves 181e7f9393 Remove the attach_flag global, and make it per-inferior.
* inferior.h (attach_flag): Delete.
	(inferior_process): Declare.
	* solib.c (update_solib_list): Adjust.
	* gnu-nat.c (gnu_create_inferior, gnu_attach): Adjust.
	* inf-ptrace.c (inf_ptrace_detach): Adjust.
	(inf_ptrace_files_info): Get it from the current inferior.
	* inf-ttrace.c (inf_ttrace_attach): Adjust.
	(inf_ttrace_files_info): Get it from the current
	inferior.
	* inflow.c (terminal_inferior, terminal_ours_1, set_sigint_trap)
	(clear_sigint_trap): Get it from the current process.
	* remote.c (extended_remote_attach_1)
	(extended_remote_create_inferior_1): Adjust.
	* top.c (quit_confirm, quit_target): Get it from the current inferior.
	* procfs.c (do_detach): Adjust.
	(procfs_wait): Get it from the event inferior.
	(procfs_files_info): Get it from the current inferior.
	* nto-procfs.c (procfs_files_info): Likewise.
	(procfs_attach): Adjust.  Set the attach_flag here.
	(do_attach): Don't set it here.
	(procfs_detach): Don't clear it.
	(procfs_mourn_inferior): Don't clear it.
	* solib-osf.c (osf_solib_create_inferior_hook): Adjust.
	* target.c (attach_flag): Delete.
	(generic_mourn_inferior): Don't clear it.
	* win32-nat.c (get_win32_debug_event): Get it from the event
	process.
	(do_initial_win32_stuff): Add attaching argument.  Set attach_flag
	in the inferior accordingly.
	(win32_attach): Don't set the attach_flag here.  Pass 1 to
	do_intial_win32_stuff.
	(win32_files_info): Get it from the current inferior.
	(win32_create_inferior): Dont clear attach_flag here.  Pass 0 to
	do_intial_win32_stuff.
2008-09-22 15:21:30 +00:00
Pedro Alves d6b48e9c8b Make the stop_soon global be per-inferior instead.
* infcmd.c (attach_command_post_wait): Adjust.
	(attach_command): Likewise.

	* inferior.h (stop_soon): Delete.
	(struct inferior): Add stop_soon member.

	* infrun.c (stop_soon): Delete.
	(clear_proceed_status, start_remote)
	(fetch_inferior_event, handle_inferior_event): Adjust.
	(signal_stop_state): Don't check stop_soon here.  Check in callers
	instead.
	(save_inferior_status, restore_inferior_status): Adjust.

	* linux-nat.c (linux_nat_resume, linux_nat_wait): Always pass
	signals to common code if starting up the inferior.

	* inferior.h (struct inferior_info): Added stop_soon member.
	* inferior.c (add_inferior) Clear stop_soon.

	* mips-tdep.c (heuristic_proc_start): Adjust.
	* nto-procfs.c (procfs_create_inferior): Adjust.
	* solib-irix.c (irix_solib_create_inferior_hook): Adjust.
	* solib-osf.c (osf_solib_create_inferior_hook): Adjust.
	* solib-sunos.c (sunos_solib_create_inferior_hook): Adjust.
	* solib-svr4.c (svr4_solib_create_inferior_hook): Adjust.

	* win32-nat.c (do_initial_win32_stuff): Adjust.

	* alpha-tdep.c (alpha_heuristic_proc_start): Adjust.
2008-09-22 15:20:08 +00:00
Pedro Alves 82f7388440 Implement remote multi-process extensions.
* remote.c (struct remote_state): Add extended and
	multi_process_aware fields.
	(remote_multi_process_p): New.
	(PACKET_vKill): New.
	(record_currthread): Use thread_change_ptid.  Notice new
	inferiors.
	(set_thread, remote_thread_alive): Use write_ptid.
	(write_ptid, read_ptid): New.
	(remote_current_thread, remote_threads_extra_info): Use them.
	(remote_threads_info): Likewise.  Detect new inferiors.
	(remote_start_remote): Add inferior to inferior list.
	(remote_multi_process_feature): New.
	(remote_protocol_features): Add "multiprocess" feature.
	(remote_query_supported): Pass "multiprocess+" as supported
	features.
	(remote_open_1): Clear multi_process_aware.  Set extended
	accordingly.
	(remote_detach_1): Detach current process.  Use extended packet
	format for extended-remote multi-process.  Detach process from the
	inferior list.  Only mourn after printing output.
	(extended_remote_attach_1): Add process to the inferior list.
	(remote_vcont_resume): Use write_ptid to pass the thread ids.
	(remote_wait): Use read_ptid.  Implement the extended
	multi-process extension format of the 'W' and 'X' reply packets.
	Remove exited inferiors from inferior list.
	(remote_xfer_memory): Set general thread.
	(remote_vkill): New.
	(extended_remote_kill): New.
	(remote_mourn_1): Discard all inferiors.
	(select_new_thread_callback): New.
	(extended_remote_mourn_1): If there are more processes to debug,
	switch to a thread in another process, and don't pop the target.
	(extended_remote_create_inferior_1): Add the new process to the
	inferior list.
	(remote_stopped_by_watchpoint): Indenting.
	(remote_xfer_partial): Set the general thread.
	(remote_pid_to_str): If the remote is multi-process aware, print
	the process id as well as the thread id.
	(remote_get_thread_local_address): Use write_ptid.
	(init_extended_remote_ops): Register extended_remote_kill.
	(_initialize_remote): Register new packets.  Change
	magic_null_ptid's, not_sent_ptid's and any_thread_ptid's pid
	member to 42000.

	* thread.c (thread_change_ptid): Also account for the inferior pid
	changing.

	* inferior.h (discard_all_inferiors): Declare.
	* inferior.c (discard_all_inferiors): New.
2008-09-22 15:18:30 +00:00
Pedro Alves b77209e000 gdb/
* inferior.h: Forward declare struct ui_out.
	Forward declare struct private_inferior.
	(struct inferior): New.
	(init_inferior_list, add_inferior, add_inferior_silent)
	(delete_inferior, delete_inferior_silent, detach_inferior)
	(gdb_inferior_id_to_pid, pid_to_gdb_inferior_id, in_inferior_list)
	(valid_inferior_id, find_inferior_pid): New functions.
	(inferior_callback_func): New typedef.
	(iterate_over_inferiors, print_inferior, have_inferiors)
	(current_inferior): New functions.
	* inferior.c: New file.

	* Makefile.in (SFILES): Add inferior.c.
	(COMMON_OBS): Add inferior.o.

gdb/doc/
	* gdb.texinfo (Inferiors): New section.
2008-09-22 15:12:19 +00:00
Pedro Alves dcf4fbde10 * inferior.h (context_switch_to): Delete.
* 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.
2008-09-08 22:10:20 +00:00
Pedro Alves 414c69f7a7 Remove the global stop_step in favour of a per-thread
stop_step.

	* inferior.h (stop_step): Delete.

	* gdbthread.h (struct thread_info): Add comments to stop_step.
	(save_infrun_state, load_infrun_state): Remove stop_step argument.
	* thread.c (load_infrun_state, save_infrun_state): Remove
	stop_step argument, and references to it.

	* infrun.c (clear_proceed_status): Clear stop_step.
	(fetch_inferior_event): Adjust.
	(context_switch): Don't context-switch stop_step.
	(handle_inferior_event): Adjust.
	(normal_stop): Adjust.
	(save_inferior_status, restore_inferior_status): Adjust.

	* infcmd.c (stop_step): Delete.
	(step_1, step_1_continuation, step_once, until_next_command):
	Adjust.
2008-09-08 21:55:16 +00:00
Pedro Alves af679fd003 Remove the global step_multi in favour of a per-thread
step_multi.

	* inferior.h (step_multi): Delete.
	* gdbthread.h (struct thread_info): Add comments around
	step_multi.
	(save_infrun_state, load_infrun_state): Remove step_multi
	parameter.
	* thread.c (load_infrun_state, save_infrun_state): Remove
	step_multi argument, and references to it.
	* infcmd.c (step_multi): Delete.
	(step_1): Adjust.
	(step_1_continuation, until_next_command): Adjust.
	* infrun.c (fetch_inferior_event): Adjust.
	(context_switch): Don't context-switch step_multi.
	(print_stop_reason, normal_stop): Adjust.
2008-09-08 21:52:25 +00:00
Pedro Alves 2020b7abd8 Remove the global stop_signal in favour of a per-thread
stop_signal.

	* inferior.h (stop_signal): Delete.
	* gdbthread.h (save_infrun_state, load_infrun_state): Remove
	stop_signal argument.
	* thread.c (load_infrun_state, save_infrun_state): Remove
	stop_signal argument.  Don't reference it.

	* infcmd.c (stop_signal): Delete.
	(program_info): Adjust.
	* infrun.c (resume): Clear stop_signal.
	(proceed): Adjust.  Pass the last stop_signal to the thread we're
	resuming.
	(context_switch): Don't context-switch stop_signal.
	(handle_inferior_event, keep_going): Adjust.
	(save_inferior_status, restore_inferior_status): Adjust.

	* fbsd-nat.c: Include "gdbthread.h".
	(find_signalled_thread, find_stop_signal): New.
	(fbsd_make_corefile_notes): Use it.
	* fork-child.c (startup_inferior): Adjust.

	* linux-nat.c (get_pending_status): Adjust.
	(linux_nat_do_thread_registers): Adjust.
	(find_signalled_thread, find_stop_signal): New.
	(linux_nat_do_thread_registers): Add stop_signal parameter.
	(struct linux_nat_corefile_thread_data): Add stop_signal member.
	(linux_nat_corefile_thread_callback): Pass stop_signal.
	(linux_nat_do_registers): Delete.
	(linux_nat_make_corefile_notes): Use find_stop_signal.  Assume
	there's always a thread.

	* procfs.c (find_signalled_thread, find_stop_signal): New.
	(find_stop_signal): New.
	(procfs_do_thread_registers): Add stop_signal parameter.
	(struct procfs_corefile_thread_data): Add stop_signal member.
	(procfs_corefile_thread_callback): Pass args->stop_signal.
	(procfs_make_note_section): Find the last stop_signal.

	* solib-irix.c: Include gdbthread.h.
	(irix_solib_create_inferior_hook): Adjust.
	* solib-osf.c: Include gdbthread.h.
	(osf_solib_create_inferior_hook): Adjust.
	* solib-sunos.c: Include gdbthread.h.
	(sunos_solib_create_inferior_hook): Adjust.
	* solib-svr4.c: Include gdbthread.h.
	(svr4_solib_create_inferior_hook): Adjust.

	* win32-nat.c (do_initial_win32_stuff): Adjust.
2008-09-08 21:51:18 +00:00
Pedro Alves 347bddb745 * inferior.h (stop_bpstat): Delete.
* 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.
2008-09-08 21:46:21 +00:00
Pedro Alves 078130d0ca * inferior.h (step_over_calls): Delete.
* gdbthread.h (save_infrun_state, load_infrun_state): Remove
	step_over_calls argument.
	* thread.c (save_infrun_state, load_infrun_state): Remove
	step_over_calls argument.  Adjust.

	* infcmd.c (step_over_calls): Delete.
	(step_1): Adjust.
	* infrun.c (clear_proceed_status): Adjust.
	(context_switch): Don't context-switch step_over_calls.
	(handle_inferior_event, save_inferior_status)
	(restore_inferior_status): Adjust.
2008-09-08 21:43:00 +00:00
Pedro Alves 4e1c45eac7 Remove context switching in favour of accessing thread_info fields
directly.

	* infrun.c (stepping_over_breakpoint, step_resume_breakpoint):
	Delete.
	(struct thread_stepping_state): Delete.
	(gtss, tss): Delete.
	(follow_inferior_reset_breakpoints, follow_exec)
	(resume, clear_proceed_status): Adjust.
	(prev_pc): Delete.
	(proceed, start_remote, init_wait_for_inferior): Adjust.
	(struct execution_control_state): Add event_thread member.
	(delete_step_resume_breakpoint_callback)
	(delete_step_thread_step_resume_breakpoint)
	(delete_step_thread_step_resume_breakpoint_cleanup)
	(delete_step_thread_step_resume_breakpoint): New.
	(wait_for_inferior, init_execution_control_state): Use
	delete_step_thread_step_resume_breakpoint_cleanup.
	(wait_for_inferior): Set the event_thread.
	(fetch_inferior_event): Ditto.  Delete the step-resume breakpoint
	with delete_step_thread_step_resume_breakpoint.
	(init_thread_stepping_state): Change parameter type to
	thread_info.  Adjust.
	(context_switch): Don't context switch prev_pc,
	stepping_over_breakpoint, step_resume_breakpoint,
	step_range_start, step_range_end, step_frame_id,
	tss->stepping_over_breakpoint,
	tss->stepping_through_solib_after_catch,
	tss->stepping_through_solib_catchpoints, tss->current_line, or
	tss->current_symtab.
	(adjust_pc_after_break, handle_inferior_event)
	(currently_stepping, step_into_function)
	(insert_step_resume_breakpoint_at_sal)
	(insert_longjmp_resume_breakpoint, keep_going): Adjust.
	(clear_stepping_state): New.
	(normal_stop): Adjust.
	(save_inferior_status, restore_inferior_status): Adjust.

	* gdbthread.h (struct thread_info): Comments describing the
	members moved here.  Add step_after_step_resume_breakpoint.
	(delete_step_resume_breakpoint): Add thread_info argument.
	(save_infrun_state, load_infrun_state): Remove prev_pc,
	trap_expected, step_resume_breakpoint, step_range_start,
	step_range_end, step_frame_id, another_trap,
	stepping_through_solib_after_catch,
	stepping_through_solib_catchpoints, current_line and
	current_symtab function arguments.
	(inferior_thread): Declare.

	* thread.c (inferior_thread): New.
	(delete_step_resume_breakpoint): Add a thread_info parameter and
	rewrite.
	(load_infrun_state, save_infrun_state): Remove prev_pc,
	trap_expected, step_resume_breakpoint, step_range_start,
	step_range_end, step_frame_id, stepping_over_breakpoint,
	stepping_through_solib_after_catch,
	stepping_through_solib_catchpoints, current_line and
	current_symtab args.  Remove code referencing them.

	* infcmd.c (step_range_start, step_range_end, step_frame_id):
	Delete.
	(step_1, step_once, until_next_command): Adjust.

	* inferior.h (step_range_start, step_range_end, step_frame_id):
	Delete.

	* linux-nat.c (linux_child_follow_fork): If following the child,
	move the step state to it.  Adjust.
	* inf-ptrace.c (inf_ptrace_follow_fork): Ditto.
	* inf-ttrace.c (inf_ttrace_follow_fork): Ditto.
2008-09-08 21:40:39 +00:00
Vladimir Prus 77ebaa5ad3 Implement -exec-continue/-exec-interrupt --all.
* infcmd.c (continue_1): New, extracted from
        (continue_command): ...here.
        (interrupt_target_1): New, extracted from
        (interrupt_target_command): ...here.
        * inferior.h (continue_1, interrupt_target_1): New.
        * mi/mi-main.c (mi_cmd_exec_continue)
        (mi_cmd_exec_interrupt): Handle --all.
2008-07-12 17:10:59 +00:00
Pedro Alves 94cc34afe2 Non-stop inferior control.
* 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).
2008-07-09 22:42:43 +00:00
Pedro Alves a474d7c2a3 Per-thread commands.
* 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).
2008-07-09 22:30:46 +00:00
Pedro Alves ad52ddc6a4 Add non_stop global.
* inferior.h (non_stop): Declare.
	* infrun.c (non_stop, non_stop_1): New.
	(set_non_stop, show_non_stop): New.
	(_initialize_infrun): Add "set/show non-stop" command.
2008-07-09 22:27:13 +00:00
Pedro Alves 8ea051c51f Add "executing" property to threads.
* 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).
2008-07-09 22:16:15 +00:00
Vladimir Prus 8f6a8e8417 Don't suppress *running when doing finish.
* infcall.c (call_function_by_hand): Set both
        suppress_resume_observer and suppress_stop_observer.
        * infcmd.c (suppress_run_stop_observers): Split into...
        (suppress_resume_observer, suppress_stop_observer): ...those.
        (finish_command_continuation): Clear suppress_stop_observer.
        (finish_command): Set suppress_stop_observer.
        * inferior.h (suppress_run_stop_observers): Split into...
        (suppress_resume_observer, suppress_stop_observer): ...those.
        * infrun.c (normal_stop): Check for suppress_stop_observer.
        * thread.c (set_running): Check for suppress_resume_observer.
2008-06-13 20:19:19 +00:00
Vladimir Prus e1ac332873 Implement *running.
* Makefile.in: Update dependencies.
        * gdbthread.h (struct thread_info): New field
        running_.
        (set_running, is_running): New.
        * thread.c (set_running, is_running): New.
        * inferior.h (suppress_normal_stop_observer): Rename to...
        (suppress_run_stop_observers): ..this.
        * infcmd.c (suppress_normal_stop_observer): Rename to...
        (suppress_run_stop_observers): ..this.
        (finish_command_continuation, finish_command): Adjust.
        * infcall.c (call_function_by_hand): Adjust.
        * infrun.c (normal_stop): Call set_running.
        * target.c (target_resume): New.  Call set_running.
        * target.h (target_resume): Convert from macro to
        a function.

        * mi/mi-interp.c (mi_on_resume): New.
        (mi_interpreter_init): Register mi_on_resume.
2008-06-10 10:23:54 +00:00
Vladimir Prus f5871ec07b Suppress normal stop observer when it's problematic.
* inferior.h (suppress_normal_stop_observer): New.
        * infcall.c (call_function_by_hand): Disable stop events when
        doing function calls.
        * infmcd.c (suppress_normal_stop_observer): New.
        (finish_command_continuation): Call normal_stop observer
        explicitly.
        (finish_command): Disable stop events inside proceed.
        * infrun.c (normal_stop): Don't call normal stop observer if
        suppressed of if multi-step is in progress.
2008-06-10 09:32:05 +00:00
Ulrich Weigand 515630c5e5 * inferior.h (read_pc_pid, write_pc_pid): Remove.
* regcache.h (regcache_read_pc, regcache_write_pc): Add prototypes.

	* regcache.c (read_pc_pid): Remove, replace by ...
	(regcache_read_pc): ... this function.
	(write_pc_pid): Remove, replace by ...
	(regcache_write_pc): ... this function.
	(read_pc, write_pc): Update.

	* infrun.c (displaced_step_prepare): Replace read_pc_pid and
	write_pc_pid by regcache_read_pc and regcache_write_pc.
	(displaced_step_fixup): Likewise.
	(resume): Likewise.  Use regcache arch instead of current_gdbarch.
	(prepare_to_proceed): Likewise.
	(proceed): Likewise.
	(adjust_pc_after_break): Likewise.
	(handle_inferior_event): Likewise.

	* linux-nat.c (cancel_breakpoint): Likewise.
	* linux-thread-db.c (check_event): Likewise.
	* aix-thread.c (aix_thread_wait): Likewise.
	* tracepoint.c (trace_dump_command): Likewise.
2008-05-04 14:12:34 +00:00
Pedro Alves 237fc4c9cd Implement displaced stepping.
gdb/
	* gdbarch.sh (max_insn_length): New 'variable'.
	(displaced_step_copy, displaced_step_fixup)
	(displaced_step_free_closure, displaced_step_location): New
	functions.
	(struct displaced_step_closure): Add forward declaration.
	* gdbarch.c, gdbarch.h: Regenerated.

	* arch-utils.c: #include "objfiles.h".
	(simple_displaced_step_copy_insn)
	(simple_displaced_step_free_closure)
	(displaced_step_at_entry_point): New functions.
	* arch-utils.h (simple_displaced_step_copy_insn)
	(simple_displaced_step_free_closure)
	(displaced_step_at_entry_point): New prototypes.

	* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
	(I386_MAX_MATCHED_INSN_LEN): ... this.
	(i386_absolute_jmp_p, i386_absolute_call_p)
	(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
	(i386_displaced_step_fixup): New functions.
	(struct i386_insn, i386_match_insn): Update.
	(i386_gdbarch_init): Set gdbarch_max_insn_length.
	* i386-tdep.h (I386_MAX_INSN_LEN): New.
	(i386_displaced_step_fixup): New prototype.
	* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
	Register gdbarch_displaced_step_copy,
	gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
	and gdbarch_displaced_step_location functions.

	* infrun.c (debug_displaced): New variable.
	(show_debug_displaced): New function.
	(struct displaced_step_request): New struct.
	(displaced_step_request_queue, displaced_step_ptid)
	(displaced_step_gdbarch, displaced_step_closure)
	(displaced_step_original, displaced_step_copy)
	(displaced_step_saved_copy, can_use_displaced_stepping): New
	variables.
	(show_can_use_displaced_stepping, use_displaced_stepping)
	(displaced_step_clear, cleanup_displaced_step_closure)
	(displaced_step_dump_bytes, displaced_step_prepare)
	(displaced_step_clear_cleanup, write_memory_ptid)
	(displaced_step_fixup): New functions.
	(resume): Call displaced_step_prepare.
	(proceed): Call read_pc once, and remember the value.  If using
	displaced stepping, don't remove breakpoints.
	(handle_inferior_event): Call displaced_step_fixup.  Add some
	debugging output.  When we try to step over a breakpoint, but get
	a signal to deliver to the thread instead, ensure the step-resume
	breakpoint is actually inserted.  If a thread hop is needed, and
	displaced stepping is enabled, don't remove breakpoints.
	(init_wait_for_inferior): Call displaced_step_clear.
	(_initialize_infrun): Add "set debug displaced" command.  Add
	"maint set can-use-displaced-stepping" command.  Clear
	displaced_step_ptid.
	* inferior.h (debug_displaced): Declare variable.
	(displaced_step_dump_bytes): Declare function.

	* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
	dependencies.

	gdb/testsuite/
	* gdb.asm/asmsrc1.s: Add scratch space.

	gdb/doc/
	* gdb.texinfo (Debugging Output): Document "set/show debug
	displaced".
	(Maintenance Commands): Document "maint set/show
	can-use-displaced-stepping".
2008-05-02 16:49:54 +00:00
Joel Brobecker ae123ec613 * infrun.c (wait_for_inferior): Add treat_exec_as_sigtrap parameter
and use it.
        (proceed, start_remote): Update call to wait_for_inferior.
        * inferior.h (wait_for_inferior): Update declaration.
        * fork-child.c, infcmd.c, solib-irix.c, solib-osf.c, solib-sunos.c,
        solib-svr4.c, win32-nat.c: Update calls to wait_for_inferior.
        * inf-ttrace.c (inf_ttrace_wait): Report TTEVT_EXEC events as
        TARGET_WAITKIND_EXECD instead of TARGET_WAITKIND_STOPPED.
2008-01-29 21:11:24 +00:00
Daniel Jacobowitz 9b254dd1ce Updated copyright notices for most files. 2008-01-01 22:53:26 +00:00