binutils-gdb/gdb/gdbthread.h

429 lines
16 KiB
C
Raw Normal View History

/* Multi-process/thread control defs for GDB, the GNU debugger.
Copyright (C) 1987-2014 Free Software Foundation, Inc.
2001-03-06 09:22:02 +01:00
Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
1999-07-07 22:19:36 +02:00
This file is part of GDB.
1999-07-07 22:19:36 +02:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
1999-07-07 22:19:36 +02:00
(at your option) any later version.
1999-07-07 22:19:36 +02:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1999-07-07 22:19:36 +02:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef GDBTHREAD_H
#define GDBTHREAD_H
struct symtab;
#include "breakpoint.h"
#include "frame.h"
#include "ui-out.h"
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-10 00:30:46 +02:00
#include "inferior.h"
#include "btrace.h"
/* Frontend view of the thread state. Possible extensions: stepping,
finishing, until(ling),... */
enum thread_state
{
THREAD_STOPPED,
THREAD_RUNNING,
THREAD_EXITED,
};
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
/* Inferior thread specific part of `struct infcall_control_state'.
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-10 00:16:15 +02:00
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
Inferior process counterpart is `struct inferior_control_state'. */
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-10 00:16:15 +02:00
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
struct thread_control_state
{
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 23:40:39 +02:00
/* User/external stepping state. */
/* Step-resume or longjmp-resume breakpoint. */
struct breakpoint *step_resume_breakpoint;
gdb PR c++/9593: * thread.c (clear_thread_inferior_resources): Call delete_longjmp_breakpoint. * infrun.c (handle_inferior_event): Handle exception breakpoints. (handle_inferior_event): Likewise. (insert_exception_resume_breakpoint): New function. (check_exception_resume): Likewise. * inferior.h (delete_longjmp_breakpoint_cleanup): Declare. * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static. (step_1): Set thread's initiating frame. (until_next_continuation): New function. (until_next_command): Support exception breakpoints. (finish_command_continuation): Delete longjmp breakpoint. (finish_forward): Support exception breakpoints. * gdbthread.h (struct thread_info) <initiating_frame>: New field. * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume, bp_exception_master>: New constants. (struct bpstat_what) <is_longjmp>: New field. (set_longjmp_breakpoint): Update. * breakpoint.c (create_exception_master_breakpoint): New function. (update_breakpoints_after_exec): Handle bp_exception_master. Call create_exception_master_breakpoint. (print_it_typical): Handle bp_exception_master, bp_exception. (bpstat_stop_status): Handle bp_exception_master. (bpstat_what): Handle bp_exception_master, bp_exception, bp_exception_resume. (bptype_string): Likewise. (print_one_breakpoint_location): Likewise. (allocate_bp_location): Likewise. (set_longjmp_breakpoint): Handle exception breakpoints. Change interface. (delete_longjmp_breakpoint): Handle exception breakpoints. (mention): Likewise. (struct until_break_command_continuation_args) <thread_num>: New field. (until_break_command_continuation): Call delete_longjmp_breakpoint. (until_break_command): Support exception breakpoints. (delete_command): Likewise. (breakpoint_re_set_one): Likewise. (breakpoint_re_set): Likewise. gdb/testuite * gdb.java/jnpe.java: New file. * gdb.java/jnpe.exp: New file. * gdb.cp/nextoverthrow.exp: New file. * gdb.cp/nextoverthrow.cc: New file.
2010-12-09 17:09:54 +01:00
/* Exception-resume breakpoint. */
struct breakpoint *exception_resume_breakpoint;
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 23:40:39 +02:00
/* Range to single step within.
If this is nonzero, respond to a single-step signal by continuing
to step if the pc is in this range.
If step_range_start and step_range_end are both 1, it means to
step for a single instruction (FIXME: it might clean up
wait_for_inferior in a minor way if this were changed to the
address of the instruction and that address plus one. But maybe
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
not). */
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 23:40:39 +02:00
CORE_ADDR step_range_start; /* Inclusive */
CORE_ADDR step_range_end; /* Exclusive */
range stepping: gdb This patch teaches GDB to take advantage of target-assisted range stepping. It adds a new 'r ADDR1,ADDR2' action to vCont (vCont;r), meaning, "step once, and keep stepping as long as the thread is in the [ADDR1,ADDR2) range". Rationale: When user issues the "step" command on the following line of source, a = b + c + d * e - a; GDB single-steps every single instruction until the program reaches a new different line. E.g., on x86_64, that line compiles to: 0x08048434 <+65>: mov 0x1c(%esp),%eax 0x08048438 <+69>: mov 0x30(%esp),%edx 0x0804843c <+73>: add %eax,%edx 0x0804843e <+75>: mov 0x18(%esp),%eax 0x08048442 <+79>: imul 0x2c(%esp),%eax 0x08048447 <+84>: add %edx,%eax 0x08048449 <+86>: sub 0x34(%esp),%eax 0x0804844d <+90>: mov %eax,0x34(%esp) 0x08048451 <+94>: mov 0x1c(%esp),%eax and the following is the RSP traffic between GDB and GDBserver: --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:3c840408;thread:p2e13.2e13;core:1; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:3e840408;thread:p2e13.2e13;core:2; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:42840408;thread:p2e13.2e13;core:2; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:47840408;thread:p2e13.2e13;core:0; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:49840408;thread:p2e13.2e13;core:0; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:4d840408;thread:p2e13.2e13;core:0; --> vCont;s:p2e13.2e13;c <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2e13.2e13;core:0; IOW, a lot of roundtrips between GDB and GDBserver. If we add a new command to the RSP, meaning "keep stepping and don't report a stop until the program goes out of the [0x08048434, 0x08048451) address range", then the RSP traffic can be reduced down to: --> vCont;r8048434,8048451:p2db0.2db0;c <-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2db0.2db0;core:1; As number of packets is reduced dramatically, the performance of stepping source lines is much improved. In case something is wrong with range stepping on the stub side, the debug info or even gdb, this adds a "set/show range-stepping" command to be able to turn range stepping off. gdb/ 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * gdbthread.h (struct thread_control_state) <may_range_step>: New field. * infcmd.c (step_once, until_next_command): Enable range stepping. * infrun.c (displaced_step_prepare): Disable range stepping. (resume): Disable range stepping if stepping over a breakpoint or we have software watchpoints. If range stepping is enabled, assert the thread is in the stepping range. (clear_proceed_status_thread): Clear may_range_step. (handle_inferior_event): Disable range stepping as soon as we know the thread that hit the event. Re-enable it whenever we're going to step with a step range. * remote.c (struct vCont_action_support) <r>: New field. (use_range_stepping): New global. (remote_vcont_probe): Handle 'r' action. (append_resumption): Append an 'r' action if the thread may range step. (show_range_stepping): New function. (set_range_stepping): New function. (_initialize_remote): Call add_setshow_boolean_cmd to register the 'set range-stepping' and 'show range-stepping' commands. * NEWS: Mention range stepping, the new vCont;r action, and the new "set/show range-stepping" commands. gdb/doc/ 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * gdb.texinfo (Packets): Document 'vCont;r'. (Continuing and Stepping): Document target-assisted range stepping, and the 'set range-stepping' and 'show range-stepping' commands.
2013-05-23 19:15:35 +02:00
/* If GDB issues a target step request, and this is nonzero, the
target should single-step this thread once, and then continue
single-stepping it without GDB core involvement as long as the
thread stops in the step range above. If this is zero, the
target should ignore the step range, and only issue one single
step. */
int may_range_step;
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 23:40:39 +02:00
/* Stack frame address as of when stepping command was issued.
This is how we know when we step into a subroutine call, and how
to set the frame for the breakpoint used to step out. */
struct frame_id step_frame_id;
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 02:20:24 +02:00
/* Similarly, the frame ID of the underlying stack frame (skipping
any inlined frames). */
struct frame_id step_stack_frame_id;
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 23:40:39 +02:00
/* Nonzero if we are presently stepping over a breakpoint.
If we hit a breakpoint or watchpoint, and then continue, we need
to single step the current thread with breakpoints disabled, to
avoid hitting the same breakpoint or watchpoint again. And we
should step just a single thread and keep other threads stopped,
so that other threads don't miss breakpoints while they are
removed.
So, this variable simultaneously means that we need to single
step the current thread, keep other threads stopped, and that
breakpoints should be removed while we step.
This variable is set either:
- in proceed, when we resume inferior on user's explicit request
- in keep_going, if handle_inferior_event decides we need to
step over breakpoint.
The variable is cleared in normal_stop. The proceed calls
wait_for_inferior, which calls handle_inferior_event in a loop,
and until wait_for_inferior exits, this variable is changed only
by keep_going. */
2000-01-11 04:07:37 +01:00
int trap_expected;
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 23:40:39 +02:00
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
/* Nonzero if the thread is being proceeded for a "finish" command
or a similar situation when stop_registers should be saved. */
int proceed_to_finish;
/* Nonzero if the thread is being proceeded for an inferior function
call. */
int in_infcall;
enum step_over_calls_kind step_over_calls;
/* Nonzero if stopped due to a step command. */
int stop_step;
/* Chain containing status of breakpoint(s) the thread stopped
at. */
bpstat stop_bpstat;
PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode. The other part of PR gdb/13860 is about console execution commands in MI getting their output half lost. E.g., take the finish command, executed on a frontend's GDB console: sync: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) ~"0x00000000004004d7 in foo () at stepinf.c:6\n" ~"6\t usleep (10);\n" ~"Value returned is $1 = 0\n" *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1" async: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0" Note how all the "Value returned" etc. output is missing in async mode. The same happens with e.g., catchpoints: =breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"} ~"\nCatchpoint " ~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n" ~"131\t pid = ARCH_FORK ();\n" *stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0" where all those ~ lines are missing in async mode, or just the "step" current line indication: s &"s\n" ^running *running,thread-id="all" (gdb) ~"13\t foo ();\n" *stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3" (gdb) Or in the case of the PRs example, the "Stopped due to shared library event" note: start &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="21990" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3" (gdb) IMO, if you're typing execution commands in a frontend's console, you expect to see their output. Indeed it's what you get in sync mode. I think async mode should do the same. Deciding what to mirror to the console wrt to breakpoints and random stops gets messy real fast. E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the event to the console in this case. But what about more complicated cases like "s&; thread n; s&", and one of those steps spawning a new thread, and that thread hitting a breakpoint? It's impossible in general to track whether the thread had any relation to the commands that had been executed. So I think we should just simplify and always mirror breakpoints and random events to the console. Notes: - mi->out is the same as gdb_stdout when MI is the current interpreter. I think that referring to that directly is cleaner. An earlier revision of this patch made the changes that are now done in mi_on_normal_stop directly in infrun.c:normal_stop, and so not having an obvious place to put the new uiout by then, and not wanting to abuse CLI's uiout, I made a temporary uiout when necessary. - Hopefuly the rest of the patch is more or less obvious given the comments added. Tested on x86_64 Fedora 20, no regressions. 2014-05-21 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdbthread.h (struct thread_control_state): New field `command_interp'. * infrun.c (follow_fork): Copy the new thread control field to the child fork thread. (clear_proceed_status_thread): Clear the new thread control field. (proceed): Set the new thread control field. * interps.h (command_interp): Declare. * interps.c (command_interpreter): New global. (command_interp): New function. (interp_exec): Set `command_interpreter' while here. * cli-out.c (cli_uiout_dtor): New function. (cli_ui_out_impl): Install it. * mi/mi-interp.c: Include cli-out.h. (mi_cmd_interpreter_exec): Add comment. (restore_current_uiout_cleanup): New function. (ui_out_free_cleanup): New function. (mi_on_normal_stop): If finishing an execution command started by a CLI command, or any kind of breakpoint-like event triggered, print the stop event to the output (CLI) stream. * mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler. 2014-05-21 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdb.mi/mi-cli.exp (line_callee4_next_step): New global. (top level): Test that output related to execution commands is sent to the console with CLI commands, but not with MI commands. Test that breakpoint events are always mirrored to the console. Also expect the new source line to be output after a "next" in async mode too. Make it a pass/fail test. * gdb.mi/mi-solib.exp: Test that the CLI solib event note is output. * lib/mi-support.exp (mi_gdb_expect_cli_output): New procedure.
2014-03-11 21:31:36 +01:00
/* The interpreter that issued the execution command. NULL if the
thread was resumed as a result of a command applied to some other
thread (e.g., "next" with scheduler-locking off). */
struct interp *command_interp;
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
};
/* Inferior thread specific part of `struct infcall_suspend_state'.
Inferior process counterpart is `struct inferior_suspend_state'. */
struct thread_suspend_state
{
Always pass signals to the right thread Currently, GDB can pass a signal to the wrong thread in several different but related scenarios. E.g., if thread 1 stops for signal SIGFOO, the user switches to thread 2, and then issues "continue", SIGFOO is actually delivered to thread 2, not thread 1. This obviously messes up programs that use pthread_kill to send signals to specific threads. This has been a known issue for a long while. Back in 2008 when I made stop_signal be per-thread (2020b7ab), I kept the behavior -- see code in 'proceed' being removed -- wanting to come back to it later. The time has finally come now. The patch fixes this -- on resumption, intercepted signals are always delivered to the thread that had intercepted them. Another example: if thread 1 stops for a breakpoint, the user switches to thread 2, and then issues "signal SIGFOO", SIGFOO is actually delivered to thread 1, not thread 2, because 'proceed' first switches to thread 1 to step over its breakpoint... If the user deletes the breakpoint before issuing "signal FOO", then the signal is delivered to thread 2 (the current thread). "signal SIGFOO" can be used for two things: inject a signal in the program while the program/thread had stopped for none, bypassing "handle nopass"; or changing/suppressing a signal the program had stopped for. These scenarios are really two faces of the same coin, and GDB can't really guess what the user is trying to do. GDB might have intercepted signals in more than one thread even (see the new signal-command-multiple-signals-pending.exp test). At least in the inject case, it's obviously clear to me that the user means to deliver the signal to the currently selected thread, so best is to make the command's behavior consistent and easy to explain. Then, if the user is trying to suppress/change a signal the program had stopped for instead of injecting a new signal, but, the user had changed threads meanwhile, then she will be surprised that with: (gdb) continue Thread 1 stopped for signal SIGFOO. (gdb) thread 2 (gdb) signal SIGBAR ... GDB actually delivers SIGFOO to thread 1, and SIGBAR to thread 2 (with scheduler-locking off, which is the default, because then "signal" or any other resumption command resumes all threads). So the patch makes GDB detect that, and ask for confirmation: (gdb) thread 1 [Switching to thread 1 (Thread 10979)] (gdb) signal SIGUSR2 Note: Thread 3 previously stopped with signal SIGUSR2, User defined signal 2. Thread 2 previously stopped with signal SIGUSR1, User defined signal 1. Continuing thread 1 (the current thread) with specified signal will still deliver the signals noted above to their respective threads. Continue anyway? (y or n) All these scenarios are covered by the new tests. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-07-25 Pedro Alves <palves@redhat.com> * NEWS: Mention signal passing and "signal" command changes. * gdbthread.h (struct thread_suspend_state) <stop_signal>: Extend comment. * breakpoint.c (until_break_command): Adjust clear_proceed_status call. * infcall.c (run_inferior_call): Adjust clear_proceed_status call. * infcmd.c (proceed_thread_callback, continue_1, step_once) (jump_command): Adjust clear_proceed_status call. (signal_command): Warn if other thread that are resumed have signals that will be delivered. Adjust clear_proceed_status call. (until_next_command, finish_command) (proceed_after_attach_callback, attach_command_post_wait) (attach_command): Adjust clear_proceed_status call. * infrun.c (proceed_after_vfork_done): Likewise. (proceed_after_attach_callback): Adjust comment. (clear_proceed_status_thread): Clear stop_signal if not in pass state. (clear_proceed_status_callback): Delete. (clear_proceed_status): New 'step' parameter. Only clear the proceed status of threads the command being prepared is about to resume. (proceed): If passed in an explicit signal, override stop_signal with it. Don't pass the last stop signal to the thread we're resuming. (init_wait_for_inferior): Adjust clear_proceed_status call. (switch_back_to_stepped_thread): Clear the signal if it should not be passed. * infrun.h (clear_proceed_status): New 'step' parameter. (user_visible_resume_ptid): Add comment. * linux-nat.c (linux_nat_resume_callback): Don't check whether the signal is in pass state. * remote.c (append_pending_thread_resumptions): Likewise. * mi/mi-main.c (proceed_thread): Adjust clear_proceed_status call. gdb/doc/ 2014-07-25 Pedro Alves <palves@redhat.com> Eli Zaretskii <eliz@gnu.org> * gdb.texinfo (Signaling) <signal command>: Explain what happens with multi-threaded programs. gdb/testsuite/ 2014-07-25 Pedro Alves <palves@redhat.com> * gdb.threads/signal-command-handle-nopass.c: New file. * gdb.threads/signal-command-handle-nopass.exp: New file. * gdb.threads/signal-command-multiple-signals-pending.c: New file. * gdb.threads/signal-command-multiple-signals-pending.exp: New file. * gdb.threads/signal-delivered-right-thread.c: New file. * gdb.threads/signal-delivered-right-thread.exp: New file.
2014-07-25 17:57:31 +02:00
/* Last signal that the inferior received (why it stopped). When
the thread is resumed, this signal is delivered. Note: the
target should not check whether the signal is in pass state,
because the signal may have been explicitly passed with the
"signal" command, which overrides "handle nopass". If the signal
should be suppressed, the core will take care of clearing this
before the target is resumed. */
enum gdb_signal stop_signal;
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
};
struct thread_info
{
struct thread_info *next;
ptid_t ptid; /* "Actual process id";
In fact, this may be overloaded with
kernel thread id, etc. */
int num; /* Convenient handle (GDB thread id) */
/* The name of the thread, as specified by the user. This is NULL
if the thread does not have a user-given name. */
char *name;
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
/* Non-zero means the thread is executing. Note: this is different
from saying that there is an active target and we are stopped at
a breakpoint, for instance. This is a real indicator whether the
thread is off and running. */
int executing;
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
/* Frontend view of the thread state. Note that the THREAD_RUNNING/
THREAD_STOPPED states are different from EXECUTING. When the
thread is stopped internally while handling an internal event,
like a software single-step breakpoint, EXECUTING will be false,
but STATE will still be THREAD_RUNNING. */
enum thread_state state;
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 05:31:25 +01:00
/* If this is > 0, then it means there's code out there that relies
on this thread being listed. Don't delete it from the lists even
if we detect it exiting. */
int refcount;
/* State of GDB control of inferior thread execution.
See `struct thread_control_state'. */
struct thread_control_state control;
/* State of inferior thread to restore after GDB is done with an inferior
call. See `struct thread_suspend_state'. */
struct thread_suspend_state suspend;
int current_line;
struct symtab *current_symtab;
/* Internal stepping state. */
/* Record the pc of the thread the last time it stopped. This is
maintained by proceed and keep_going, and used in
adjust_pc_after_break to distinguish a hardware single-step
SIGTRAP from a breakpoint SIGTRAP. */
CORE_ADDR prev_pc;
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 23:40:39 +02:00
/* Should we step over breakpoint next time keep_going is called? */
int stepping_over_breakpoint;
2000-01-11 04:07:37 +01:00
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 23:40:39 +02:00
/* Set to TRUE if we should finish single-stepping over a breakpoint
after hitting the current step-resume breakpoint. The context here
is that GDB is to do `next' or `step' while signal arrives.
When stepping over a breakpoint and signal arrives, GDB will attempt
to skip signal handler, so it inserts a step_resume_breakpoint at the
signal return address, and resume inferior.
step_after_step_resume_breakpoint is set to TRUE at this moment in
order to keep GDB in mind that there is still a breakpoint to step over
when GDB gets back SIGTRAP from step_resume_breakpoint. */
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 23:40:39 +02:00
int step_after_step_resume_breakpoint;
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-10 00:30:46 +02:00
/* Per-thread command support. */
Remove global continuations in favour of a per-thread continuations. * gdbthread.h (struct thread_info): Add comments around continuations and intermediate_continuations. (save_infrun_state, load_infrun_state): Delete continuations and intermediate_continuations arguments. * infrun.c (fetch_inferior_event): Only call normal_stop if stop_soon is NO_STOP_QUIETLY. (context_switch): Don't context-switch the continuations. * thread.c (clear_thread_inferior_resources): Discard all continuations of the thread we're clearing. (save_infrun_state, load_infrun_state): Delete continuations and intermediate_continuations arguments, and the code referencing them. * utils.c: Include "gdbthread.h". (cmd_continuation, intermediate_continuation): Delete. (add_continuation): Add thread_info* argument. Install the continuation on it. (restore_thread_cleanup): New. (do_all_continuations_ptid, do_all_continuations_thread_callback): New. (do_all_continuations): Reimplement. (discard_all_continuations_thread_callback, discard_all_continuations_thread): New. (discard_all_continuations): Reimplement. (add_intermediate_continuation): Add thread_info* argument. Install the continuation on it. (do_all_intermediate_continuations_thread_callback) (do_all_intermediate_continuations_thread): New. (do_all_intermediate_continuations): Reimplement. (discard_all_intermediate_continuations_thread_callback): New. (discard_all_intermediate_continuations_thread): New. (discard_all_intermediate_continuations): Reimplement. * breakpoint.c (until_break_command): Install the continuation on the current thread. * defs.h (cmd_continuation, intermediate_continuation): Delete. (struct thread_info): Forward declare. (add_continuation, add_intermediate_continuation): Add thread_info* argument. (do_all_continuations_thread, discard_all_continuations_thread) (do_all_intermediate_continuations_thread) (discard_all_intermediate_continuations_thread): Declare. * inf-loop.c (inferior_event_handler): In non-stop only run continuations on the thread that stopped. In all-stop, run continuations on all threads. * infcmd.c (step_once, finish_command): Adjust.
2008-09-08 23:57:42 +02:00
/* Pointer to what is left to do for an execution command after the
target stops. Used only in asynchronous mode, by targets that
support async execution. Several execution commands use it. */
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-10 00:30:46 +02:00
struct continuation *continuations;
Remove global continuations in favour of a per-thread continuations. * gdbthread.h (struct thread_info): Add comments around continuations and intermediate_continuations. (save_infrun_state, load_infrun_state): Delete continuations and intermediate_continuations arguments. * infrun.c (fetch_inferior_event): Only call normal_stop if stop_soon is NO_STOP_QUIETLY. (context_switch): Don't context-switch the continuations. * thread.c (clear_thread_inferior_resources): Discard all continuations of the thread we're clearing. (save_infrun_state, load_infrun_state): Delete continuations and intermediate_continuations arguments, and the code referencing them. * utils.c: Include "gdbthread.h". (cmd_continuation, intermediate_continuation): Delete. (add_continuation): Add thread_info* argument. Install the continuation on it. (restore_thread_cleanup): New. (do_all_continuations_ptid, do_all_continuations_thread_callback): New. (do_all_continuations): Reimplement. (discard_all_continuations_thread_callback, discard_all_continuations_thread): New. (discard_all_continuations): Reimplement. (add_intermediate_continuation): Add thread_info* argument. Install the continuation on it. (do_all_intermediate_continuations_thread_callback) (do_all_intermediate_continuations_thread): New. (do_all_intermediate_continuations): Reimplement. (discard_all_intermediate_continuations_thread_callback): New. (discard_all_intermediate_continuations_thread): New. (discard_all_intermediate_continuations): Reimplement. * breakpoint.c (until_break_command): Install the continuation on the current thread. * defs.h (cmd_continuation, intermediate_continuation): Delete. (struct thread_info): Forward declare. (add_continuation, add_intermediate_continuation): Add thread_info* argument. (do_all_continuations_thread, discard_all_continuations_thread) (do_all_intermediate_continuations_thread) (discard_all_intermediate_continuations_thread): Declare. * inf-loop.c (inferior_event_handler): In non-stop only run continuations on the thread that stopped. In all-stop, run continuations on all threads. * infcmd.c (step_once, finish_command): Adjust.
2008-09-08 23:57:42 +02:00
/* Similar to the above, but used when a single execution command
requires several resume/stop iterations. Used by the step
command. */
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-10 00:30:46 +02:00
struct continuation *intermediate_continuations;
/* If stepping, nonzero means step count is > 1 so don't print frame
next time inferior stops if it stops due to stepping. */
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-10 00:30:46 +02:00
int step_multi;
/* This is used to remember when a fork or vfork event was caught by
a catchpoint, and thus the event is to be followed at the next
resume of the thread, and not immediately. */
struct target_waitstatus pending_follow;
/* True if this thread has been explicitly requested to stop. */
int stop_requested;
gdb PR c++/9593: * thread.c (clear_thread_inferior_resources): Call delete_longjmp_breakpoint. * infrun.c (handle_inferior_event): Handle exception breakpoints. (handle_inferior_event): Likewise. (insert_exception_resume_breakpoint): New function. (check_exception_resume): Likewise. * inferior.h (delete_longjmp_breakpoint_cleanup): Declare. * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static. (step_1): Set thread's initiating frame. (until_next_continuation): New function. (until_next_command): Support exception breakpoints. (finish_command_continuation): Delete longjmp breakpoint. (finish_forward): Support exception breakpoints. * gdbthread.h (struct thread_info) <initiating_frame>: New field. * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume, bp_exception_master>: New constants. (struct bpstat_what) <is_longjmp>: New field. (set_longjmp_breakpoint): Update. * breakpoint.c (create_exception_master_breakpoint): New function. (update_breakpoints_after_exec): Handle bp_exception_master. Call create_exception_master_breakpoint. (print_it_typical): Handle bp_exception_master, bp_exception. (bpstat_stop_status): Handle bp_exception_master. (bpstat_what): Handle bp_exception_master, bp_exception, bp_exception_resume. (bptype_string): Likewise. (print_one_breakpoint_location): Likewise. (allocate_bp_location): Likewise. (set_longjmp_breakpoint): Handle exception breakpoints. Change interface. (delete_longjmp_breakpoint): Handle exception breakpoints. (mention): Likewise. (struct until_break_command_continuation_args) <thread_num>: New field. (until_break_command_continuation): Call delete_longjmp_breakpoint. (until_break_command): Support exception breakpoints. (delete_command): Likewise. (breakpoint_re_set_one): Likewise. (breakpoint_re_set): Likewise. gdb/testuite * gdb.java/jnpe.java: New file. * gdb.java/jnpe.exp: New file. * gdb.cp/nextoverthrow.exp: New file. * gdb.cp/nextoverthrow.cc: New file.
2010-12-09 17:09:54 +01:00
/* The initiating frame of a nexting operation, used for deciding
gdb/ Remove stale dummy frames. * breakpoint.c: Include dummy-frame.h. (longjmp_breakpoint_ops): New variable. (update_breakpoints_after_exec, breakpoint_init_inferior): Delete also bp_longjmp_call_dummy. (bpstat_what, bptype_string, print_one_breakpoint_location) (init_bp_location): Support bp_longjmp_call_dummy. (set_longjmp_breakpoint): Use longjmp_breakpoint_ops. Comment why. (set_longjmp_breakpoint_for_call_dummy) (check_longjmp_breakpoint_for_call_dummy, longjmp_bkpt_dtor): New functions. (initialize_breakpoint_ops): Initialize longjmp_breakpoint_ops. * breakpoint.h (enum bptype): New item bp_longjmp_call_dummy. Delete FIXME comment and extend the other comment for bp_call_dummy. (set_longjmp_breakpoint_for_call_dummy) (check_longjmp_breakpoint_for_call_dummy): New declarations. * dummy-frame.c: Include gdbthread.h. (pop_dummy_frame_bpt): New function. (pop_dummy_frame): Call pop_dummy_frame_bpt. (dummy_frame_discard): New function. (cleanup_dummy_frames): Update the comment about longjmps. * dummy-frame.h (dummy_frame_discard): New declaration. * gdbthread.h (struct thread_info): Extend initiating_frame comment. * infcall.c (call_function_by_hand): New variable longjmp_b. Call set_longjmp_breakpoint_for_call_dummy. Chain its breakpoints with BPT. * infrun.c (handle_inferior_event) <BPSTAT_WHAT_CLEAR_LONGJMP_RESUME>: Add case 4 comment. Call check_longjmp_breakpoint_for_call_dummy and keep_going if IS_LONGJMP and there is no other reason to stop. gdb/testsuite/ Remove stale dummy frames. * gdb.base/call-signal-resume.exp (maintenance print dummy-frames) (maintenance info breakpoints): New tests. * gdb.base/stale-infcall.c: New file. * gdb.base/stale-infcall.exp: New file.
2012-06-18 19:28:38 +02:00
which exceptions to intercept. If it is null_frame_id no
bp_longjmp or bp_exception but longjmp has been caught just for
bp_longjmp_call_dummy. */
gdb PR c++/9593: * thread.c (clear_thread_inferior_resources): Call delete_longjmp_breakpoint. * infrun.c (handle_inferior_event): Handle exception breakpoints. (handle_inferior_event): Likewise. (insert_exception_resume_breakpoint): New function. (check_exception_resume): Likewise. * inferior.h (delete_longjmp_breakpoint_cleanup): Declare. * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static. (step_1): Set thread's initiating frame. (until_next_continuation): New function. (until_next_command): Support exception breakpoints. (finish_command_continuation): Delete longjmp breakpoint. (finish_forward): Support exception breakpoints. * gdbthread.h (struct thread_info) <initiating_frame>: New field. * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume, bp_exception_master>: New constants. (struct bpstat_what) <is_longjmp>: New field. (set_longjmp_breakpoint): Update. * breakpoint.c (create_exception_master_breakpoint): New function. (update_breakpoints_after_exec): Handle bp_exception_master. Call create_exception_master_breakpoint. (print_it_typical): Handle bp_exception_master, bp_exception. (bpstat_stop_status): Handle bp_exception_master. (bpstat_what): Handle bp_exception_master, bp_exception, bp_exception_resume. (bptype_string): Likewise. (print_one_breakpoint_location): Likewise. (allocate_bp_location): Likewise. (set_longjmp_breakpoint): Handle exception breakpoints. Change interface. (delete_longjmp_breakpoint): Handle exception breakpoints. (mention): Likewise. (struct until_break_command_continuation_args) <thread_num>: New field. (until_break_command_continuation): Call delete_longjmp_breakpoint. (until_break_command): Support exception breakpoints. (delete_command): Likewise. (breakpoint_re_set_one): Likewise. (breakpoint_re_set): Likewise. gdb/testuite * gdb.java/jnpe.java: New file. * gdb.java/jnpe.exp: New file. * gdb.cp/nextoverthrow.exp: New file. * gdb.cp/nextoverthrow.cc: New file.
2010-12-09 17:09:54 +01:00
struct frame_id initiating_frame;
2000-01-11 04:07:37 +01:00
/* Private data used by the target vector implementation. */
struct private_thread_info *private;
Implement core awareness. * bcache.c (compare_ints): Remove (print_percentage): Use compare_positive_ints. * defs.h (compare_positive_ints): Declare. * linux-nat.h (struct lin_lwp): New field core. (linux_nat_core_of_thread_1): Declare. * linux-nat.c (add_lwp): Init the 'core' field. (linux_nat_wait_1): Record the core. (linux_nat_core_of_thread_1, linux_nat_core_of_thread): New. (linux_nat_add_target): Register the above. * linux-thread-db.c (update_thread_core): New. (thread_db_find_new_threads): Update core information for every thread. * remote.c (struct private_thread_info): New. (free_private_thread_info, demand_private_info): New. (PACKET_qXfer_threads, use_osdata_threads): New. (struct thread_item, threads_parsing_context (start_thread, end_thread, thread_attributes) (thread_children, threads_children, threads_elements): New. (remote_threads_info): Try qXfer:threads before anything else. (remote_protocol_packets): Register qXfer:threads. (remote_open_1): Init use_osdata_threads. (struct stop_reply): New field 'core'. (remote_parse_stop_reply): Parse core number. (process_stop_reply): Record core number. (remote_xfer_partial): Handle qXfer:threads. (remote_core_of_thread): New. (init_remote_ops): Register remote_core_of_thread. (_initialize_remote): Register qXfer:read. * target.c (target_core_of_thread): New * target.h (enum target_object): New value TARGET_OBJECT_THREADS. (struct target_ops): New field to_core_of_threads. (target_core_of_thread): Declare. * gdbthread.h (struct thread_info): New field private_dtor. * thread.c (print_thread_info): Report the core. * ui-out.c (MAX_UI_OUT_LEVELS): Increase. * utils.c (compare_positive_ints): New. * features/threads.dtd: New. * mi/mi-interp.c (mi_on_normal_stop): Report the core. * mi/mi-main.c (struct collect_cores_data, collect_cores) (do_nothing, free_vector_of_osdata_items) (splay_tree_int_comparator, free_splay_tree): New. (print_one_inferior_data): Implemented printing of selected inferiors. Collect and print cores. (output_cores): New. (mi_cmd_list_thread_groups): Support --recurse. Permit specifying thread groups together with --available.
2010-01-12 22:40:25 +01:00
/* Function that is called to free PRIVATE. If this is NULL, then
xfree will be called on PRIVATE. */
void (*private_dtor) (struct private_thread_info *);
/* Branch trace information for this thread. */
struct btrace_thread_info btrace;
2000-01-11 04:07:37 +01:00
};
/* Create an empty thread list, or empty the existing one. */
extern void init_thread_list (void);
/* Add a thread to the thread list, print a message
that a new thread is found, and return the pointer to
the new thread. Caller my use this pointer to
initialize the private thread data. */
2001-05-04 06:15:33 +02:00
extern struct thread_info *add_thread (ptid_t ptid);
2000-01-11 04:07:37 +01:00
/* Same as add_thread, but does not print a message
about new thread. */
extern struct thread_info *add_thread_silent (ptid_t ptid);
2008-03-21 Daniel Jacobowitz <dan@codesourcery.com> * gdbthread.h (add_thread_with_info): New. * linux-thread-db.c: Add some documentation. (GET_LWP, GET_PID, GET_THREAD, is_lwp, is_thread, BUILD_LWP): Delete. (struct private_thread_info): Remove th_valid and ti_valid. Replace ti with tid. (thread_get_info_callback): Do not add TID to the new ptid. Do not cache th or ti. (thread_db_map_id2thr, lwp_from_thread): Delete functions. (thread_from_lwp): Assert that the LWP is set. Do not add TID to the new PTID. (attach_thread): Handle an already-existing thread. Use add_thread_with_info. Cache the th and tid. (detach_thread): Verify that private was set. Remove verbose argument and printing. Update caller. (thread_db_detach): Do not adjust inferior_ptid. (clear_lwpid_callback, thread_db_resume, thread_db_kill): Delete. (check_event, find_new_threads_callback): Do not add TID to the new PTID. (thread_db_wait): Do not use lwp_from_thread. (thread_db_pid_to_str): Use the cached TID. (thread_db_extra_thread_info): Check that private is set. (same_ptid_callback): Delete. (thread_db_get_thread_local_address): Do not use it or check is_thread. Check that private is set. Assume that the thread handle is already cached. (init_thread_db_ops): Remove to_resume and to_kill. * thread.c (add_thread_with_info): New. (add_thread): Use it. * linux-nat.c (find_thread_from_lwp): Delete. (exit_lwp): Do not use it. Check print_thread_events. Print before deleting the thread. (GET_PID, GET_LWP, BUILD_LWP, is_lwp): Move to... * linux-nat.h (GET_PID, GET_LWP, BUILD_LWP, is_lwp): ...here. * inf-ttrace.c (inf_ttrace_wait): Use print_thread_events and printf_unfiltered for thread exits. * procfs.c (procfs_wait): Likewise. 2008-03-21 Pedro Alves <pedro@codesourcery.com> * gdb.threads/fork-child-threads.exp: Test next over fork.
2008-03-21 16:44:53 +01:00
/* Same as add_thread, and sets the private info. */
extern struct thread_info *add_thread_with_info (ptid_t ptid,
struct private_thread_info *);
2000-01-11 04:07:37 +01:00
/* Delete an existing thread list entry. */
2001-05-04 06:15:33 +02:00
extern void delete_thread (ptid_t);
2000-01-11 04:07:37 +01:00
/* Delete an existing thread list entry, and be quiet about it. Used
after the process this thread having belonged to having already
exited, for example. */
extern void delete_thread_silent (ptid_t);
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Delete a step_resume_breakpoint from the thread database. */
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 23:40:39 +02:00
extern void delete_step_resume_breakpoint (struct thread_info *);
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Delete an exception_resume_breakpoint from the thread database. */
gdb PR c++/9593: * thread.c (clear_thread_inferior_resources): Call delete_longjmp_breakpoint. * infrun.c (handle_inferior_event): Handle exception breakpoints. (handle_inferior_event): Likewise. (insert_exception_resume_breakpoint): New function. (check_exception_resume): Likewise. * inferior.h (delete_longjmp_breakpoint_cleanup): Declare. * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static. (step_1): Set thread's initiating frame. (until_next_continuation): New function. (until_next_command): Support exception breakpoints. (finish_command_continuation): Delete longjmp breakpoint. (finish_forward): Support exception breakpoints. * gdbthread.h (struct thread_info) <initiating_frame>: New field. * breakpoint.h (enum bptype) <bp_exception, bp_exception_resume, bp_exception_master>: New constants. (struct bpstat_what) <is_longjmp>: New field. (set_longjmp_breakpoint): Update. * breakpoint.c (create_exception_master_breakpoint): New function. (update_breakpoints_after_exec): Handle bp_exception_master. Call create_exception_master_breakpoint. (print_it_typical): Handle bp_exception_master, bp_exception. (bpstat_stop_status): Handle bp_exception_master. (bpstat_what): Handle bp_exception_master, bp_exception, bp_exception_resume. (bptype_string): Likewise. (print_one_breakpoint_location): Likewise. (allocate_bp_location): Likewise. (set_longjmp_breakpoint): Handle exception breakpoints. Change interface. (delete_longjmp_breakpoint): Handle exception breakpoints. (mention): Likewise. (struct until_break_command_continuation_args) <thread_num>: New field. (until_break_command_continuation): Call delete_longjmp_breakpoint. (until_break_command): Support exception breakpoints. (delete_command): Likewise. (breakpoint_re_set_one): Likewise. (breakpoint_re_set): Likewise. gdb/testuite * gdb.java/jnpe.java: New file. * gdb.java/jnpe.exp: New file. * gdb.cp/nextoverthrow.exp: New file. * gdb.cp/nextoverthrow.cc: New file.
2010-12-09 17:09:54 +01:00
extern void delete_exception_resume_breakpoint (struct thread_info *);
2000-01-11 04:07:37 +01:00
/* Translate the integer thread id (GDB's homegrown id, not the system's)
into a "pid" (which may be overloaded with extra thread information). */
2001-05-04 06:15:33 +02:00
extern ptid_t thread_id_to_pid (int);
2000-01-11 04:07:37 +01:00
/* Translate a 'pid' (which may be overloaded with extra thread information)
into the integer thread id (GDB's homegrown id, not the system's). */
2001-05-04 06:15:33 +02:00
extern int pid_to_thread_id (ptid_t ptid);
2000-01-11 04:07:37 +01:00
/* Boolean test for an already-known pid (which may be overloaded with
extra thread information). */
2001-05-04 06:15:33 +02:00
extern int in_thread_list (ptid_t ptid);
2000-01-11 04:07:37 +01:00
/* Boolean test for an already-known thread id (GDB's homegrown id,
not the system's). */
extern int valid_thread_id (int thread);
/* Search function to lookup a thread by 'pid'. */
extern struct thread_info *find_thread_ptid (ptid_t ptid);
2000-01-11 04:07:37 +01:00
/* Find thread by GDB user-visible thread number. */
struct thread_info *find_thread_id (int num);
/* Finds the first thread of the inferior given by PID. If PID is -1,
returns the first thread in the list. */
struct thread_info *first_thread_of_process (int pid);
Reduce Hg packet (select remote general thread) bouncing A patch I wrote made GDB pull the thread list sooner when debugging with target remote, and I noticed an intended consequence. GDB started bouncing around the currently selected remote/general thread more frequently. E.g.: Sending packet: $qTMinFTPILen#3b...Packet received: 5 +Sending packet: $Hgp726d.726d#53...Packet received: OK Sending packet: $m400680,40#2f...Packet received: 85c0741455bff00d60004889e5ffd05de97bffffff0f1f00e973ffffff0f1f00554889e5c745fc00000000c745fc01000000e900000000c745fc02000000b800 +Sending packet: $Hgp726d.7278#28...Packet received: OK Sending packet: $m4006b2,1#28...Packet received: e9 Fast tracepoint 2 at 0x4006b2: file gdb/testsuite/gdb.trace/range-stepping.c, line 53. Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes:: This ended up breaking "tstart" when one has fast tracepoints set, because gdbserver isn't expecting an Hg packet in response to qRelocInsn: (gdb) ftrace *set_point Fast tracepoint 3 at 0x4006b2: file gdb/testsuite/gdb.trace/range-stepping.c, line 53. (gdb) PASS: gdb.trace/range-stepping.exp: ftrace: ftrace *set_point tstart gdbserver: Malformed response to qRelocInsn, ignoring: Hgp2783.2783 Target does not support this command. (gdb) FAIL: gdb.trace/range-stepping.exp: ftrace: tstart remote_trace_start should probably start by making sure the remote current thread matches inferior_ptid (calling set_general_thread), but still, reducing unnecessary bouncing is a good idea. It happens because the memory/symbol/breakpoint routines use switch_to_program_space_and_thread to do something in the right context and then revert back to the previously current thread. The fix is to simply make any_thread_of_process, find_inferior_for_program_space, etc. give preference to the current thread/inferior it if matches. gdb/ 2014-10-02 Pedro Alves <palves@redhat.com> * gdbthread.h (any_thread_of_process, any_live_thread_of_process): Adjust comments. * inferior.c (find_inferior_for_program_space): Give preference to the current inferior. * inferior.h (find_inferior_for_program_space): Update comment. * progspace.c (switch_to_program_space_and_thread): Prefer the current inferior if it's bound to the program space requested. If the inferior found doesn't have a PID yet, don't bother looking up a thread. * progspace.h (switch_to_program_space_and_thread): Adjust comment. * thread.c (any_thread_of_process, any_live_thread_of_process): Give preference to the current thread.
2014-10-02 10:55:38 +02:00
/* Returns any thread of process PID, giving preference to the current
thread. */
gdb/ 2009-07-02 Pedro Alves <pedro@codesourcery.com> * linux-nat.c (linux_child_follow_fork): If we're staying attached to the child process, enable event reporting on it. Don't handle checkpoints here. Instead, add the child fork to the lwp thread and inferior lists without clobbering the previous inferior. Let the thread_db layer learn about a new child process, even if following the parent. (linux_nat_switch_fork): Delete lwps of the current inferior only, instead of clearing the whole list. Use thread_change_ptid to give the core the illusion the new checkpoint is still the same inferior. Clear the register cache. (linux_handle_extended_wait): Handle checkpoints here. (linux_multi_process): Turn on. * linux-fork.c (struct fork_info) <pc>: Remove field. (init_fork_list): Do not delete the checkpoint from the inferior list (it is not there). (fork_load_infrun_state): Don't switch inferior_ptid here. Pass the new checkpoint's ptid to linux_nat_switch_fork. (fork_save_infrun_state): Make static. Don't stop the pc field of fork_info, it's gone. (linux_fork_mourn_inferior): Don't delete the checkpoint from the inferior list, it's not there. (linux_fork_detach): Ditto. (delete_fork_command): Replace mention of fork/checkpoint by checkpoint only. (detach_fork_command): Likewise. Don't delete the checkpoint from the inferior list. (info_forks_command): Adjust. (restore_detach_fork): Delete. (checkpointing_pid): New. (linux_fork_checkpointing_p): New. (save_detach_fork): Delete. (checkpoint_command): Delete temp_detach_fork. Don't remove breakpoints, that's a nop. Store the pid of the process we're checkpointing, and use make_cleanup_restore_integer to restore it. Don't reinsert breakpoints here. (process_command, fork_command): Delete. (restart_command): Update comments to only mention checkpoints, not forks. (_initialize_linux_fork): Delete "fork", "process", "info forks" commands. * linux-fork.h (fork_save_infrun_state, fork_list): Delete declarations. (linux_fork_checkpointing_p): Declare. * cli/cli-cmds.c (killlist): New. * cli/cli-cmds.h (killlist): Declare. * gdbcmd.h (killlist): Declare. * inferior.c: Include "gdbthread.h". (detach_inferior_command, kill_inferior_command) (inferior_command): New. (info_inferiors_command): Allow specifying a specific inferior id. (_initialize_inferiors): Register "inferior", "kill inferior" and "detach inferior" commands. * infcmd.c (_initialize_infcmd): Make "kill" a prefix command. * gdbthread.h (any_thread_of_process): Declare. * thread.c (any_thread_of_process): New. * NEWS: Mention multi-inferior debugging. Mention 'info inferiors', 'inferior', 'detach inferior' and 'kill inferior' as new commands. (Removed commands): New section, mentioning that 'info forks', 'fork', 'process', 'delete fork' and 'detach fork' are now gone. gdb/testsuite/ 2009-07-02 Pedro Alves <pedro@codesourcery.com> * gdb.base/multi-forks.exp: Only run detach-on-fork tests on linux. Adjust to use "inferior", "info inferiors", "detach inferior" and "kill inferior" instead of "restart", "info fork", "detach fork" and "delete fork". * gdb.base/ending-run.exp: Spell out "info". * gdb.base/help.exp: Adjust to use test_prefix_command_help for the "kill" command. gdb/doc/ 2009-07-02 Pedro Alves <pedro@codesourcery.com> * gdb.texinfo (Debugging multiple inferiors): Document the "inferior", "detach inferior" and "kill inferior" commands. (Debugging Programs with Multiple Processes): Adjust to mention generic "inferior" commands. Delete mention of "detach fork" and "delete fork". Cross reference to "Debugging multiple inferiors" section.
2009-07-02 23:57:28 +02:00
extern struct thread_info *any_thread_of_process (int pid);
Reduce Hg packet (select remote general thread) bouncing A patch I wrote made GDB pull the thread list sooner when debugging with target remote, and I noticed an intended consequence. GDB started bouncing around the currently selected remote/general thread more frequently. E.g.: Sending packet: $qTMinFTPILen#3b...Packet received: 5 +Sending packet: $Hgp726d.726d#53...Packet received: OK Sending packet: $m400680,40#2f...Packet received: 85c0741455bff00d60004889e5ffd05de97bffffff0f1f00e973ffffff0f1f00554889e5c745fc00000000c745fc01000000e900000000c745fc02000000b800 +Sending packet: $Hgp726d.7278#28...Packet received: OK Sending packet: $m4006b2,1#28...Packet received: e9 Fast tracepoint 2 at 0x4006b2: file gdb/testsuite/gdb.trace/range-stepping.c, line 53. Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes:: This ended up breaking "tstart" when one has fast tracepoints set, because gdbserver isn't expecting an Hg packet in response to qRelocInsn: (gdb) ftrace *set_point Fast tracepoint 3 at 0x4006b2: file gdb/testsuite/gdb.trace/range-stepping.c, line 53. (gdb) PASS: gdb.trace/range-stepping.exp: ftrace: ftrace *set_point tstart gdbserver: Malformed response to qRelocInsn, ignoring: Hgp2783.2783 Target does not support this command. (gdb) FAIL: gdb.trace/range-stepping.exp: ftrace: tstart remote_trace_start should probably start by making sure the remote current thread matches inferior_ptid (calling set_general_thread), but still, reducing unnecessary bouncing is a good idea. It happens because the memory/symbol/breakpoint routines use switch_to_program_space_and_thread to do something in the right context and then revert back to the previously current thread. The fix is to simply make any_thread_of_process, find_inferior_for_program_space, etc. give preference to the current thread/inferior it if matches. gdb/ 2014-10-02 Pedro Alves <palves@redhat.com> * gdbthread.h (any_thread_of_process, any_live_thread_of_process): Adjust comments. * inferior.c (find_inferior_for_program_space): Give preference to the current inferior. * inferior.h (find_inferior_for_program_space): Update comment. * progspace.c (switch_to_program_space_and_thread): Prefer the current inferior if it's bound to the program space requested. If the inferior found doesn't have a PID yet, don't bother looking up a thread. * progspace.h (switch_to_program_space_and_thread): Adjust comment. * thread.c (any_thread_of_process, any_live_thread_of_process): Give preference to the current thread.
2014-10-02 10:55:38 +02:00
/* Returns any non-exited thread of process PID, giving preference to
the current thread, and to not executing threads. */
2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> Add base multi-executable/process support to GDB. gdb/ * Makefile.in (SFILES): Add progspace.c. (COMMON_OBS): Add progspace.o. * progspace.h: New. * progspace.c: New. * breakpoint.h (struct bp_target_info) <placed_address_space>: New field. (struct bp_location) <pspace>: New field. (struct breakpoint) <pspace>: New field. (bpstat_stop_status, breakpoint_here_p) (moribund_breakpoint_here_p, breakpoint_inserted_here_p) (regular_breakpoint_inserted_here_p) (software_breakpoint_inserted_here_p, breakpoint_thread_match) (set_default_breakpoint): Adjust prototypes. (remove_breakpoints_pid, breakpoint_program_space_exit): Declare. (insert_single_step_breakpoint, deprecated_insert_raw_breakpoint): Adjust prototypes. * breakpoint.c (executing_startup): Delete. (default_breakpoint_sspace): New. (breakpoint_restore_shadows): Skip if the address space doesn't match. (update_watchpoint): Record the frame's program space in the breakpoint location. (insert_bp_location): Record the address space in target_info. Adjust to pass the symbol space to solib_name_from_address. (breakpoint_program_space_exit): New. (insert_breakpoint_locations): Switch the symbol space and thread when inserting breakpoints. Don't insert breakpoints in a vfork parent waiting for vfork done if we're not attached to the vfork child. (remove_breakpoints_pid): New. (reattach_breakpoints): Switch to a thread of PID. Ignore breakpoints of other symbol spaces. (create_internal_breakpoint): Store the symbol space in the sal. (create_longjmp_master_breakpoint): Iterate over all symbol spaces. (update_breakpoints_after_exec): Ignore breakpoints for other symbol spaces. (remove_breakpoint): Rename to ... (remove_breakpoint_1): ... this. Pass the breakpoints symbol space to solib_name_from_address. (remove_breakpoint): New. (mark_breakpoints_out): Ignore breakpoints from other symbol spaces. (breakpoint_init_inferior): Ditto. (breakpoint_here_p): Add an address space argument and adjust to use breakpoint_address_match. (moribund_breakpoint_here_p): Ditto. (regular_breakpoint_inserted_here_p): Ditto. (breakpoint_inserted_here_p): Ditto. (software_breakpoint_inserted_here_p): Ditto. (breakpoint_thread_match): Ditto. (bpstat_check_location): Ditto. (bpstat_stop_status): Ditto. (print_breakpoint_location): If there's a location to print, switch the current symbol space. (print_one_breakpoint_location): Add `allflag' argument. (print_one_breakpoint): Ditto. Adjust. (do_captured_breakpoint_query): Adjust. (breakpoint_1): Adjust. (breakpoint_has_pc): Also match the symbol space. (describe_other_breakpoints): Add a symbol space argument and adjust. (set_default_breakpoint): Add a symbol space argument. Set default_breakpoint_sspace. (breakpoint_address_match): New. (check_duplicates_for): Add an address space argument, and adjust. (set_raw_breakpoint): Record the symbol space in the location and in the breakpoint. (set_longjmp_breakpoint): Skip longjmp master breakpoints from other symbol spaces. (remove_thread_event_breakpoints, remove_solib_event_breakpoints) (disable_breakpoints_in_shlibs): Skip breakpoints from other symbol spaces. (disable_breakpoints_in_unloaded_shlib): Match symbol spaces. (create_catchpoint): Set the symbol space in the sal. (disable_breakpoints_before_startup): Skip breakpoints from other symbol spaces. Set executing_startup in the current symbol space. (enable_breakpoints_after_startup): Clear executing_startup in the current symbol space. Skip breakpoints from other symbol spaces. (clone_momentary_breakpoint): Also copy the symbol space. (add_location_to_breakpoint): Set the location's symbol space. (bp_loc_is_permanent): Switch thread and symbol space. (create_breakpoint): Adjust. (expand_line_sal_maybe): Expand comment to mention symbol spaces. Switch thread and symbol space when reading memory. (parse_breakpoint_sals): Set the symbol space in the sal. (break_command_really): Ditto. (skip_prologue_sal): Switch and space. (resolve_sal_pc): Ditto. (watch_command_1): Record the symbol space in the sal. (create_ada_exception_breakpoint): Adjust. (clear_command): Adjust. Match symbol spaces. (update_global_location_list): Use breakpoint_address_match. (breakpoint_re_set_one): Switch thread and space. (breakpoint_re_set): Save symbol space. (breakpoint_re_set_thread): Also reset the symbol space. (deprecated_insert_raw_breakpoint): Add an address space argument. Adjust. (insert_single_step_breakpoint): Ditto. (single_step_breakpoint_inserted_here_p): Ditto. (clear_syscall_counts): New. (_initialize_breakpoint): Install it as inferior_exit observer. * exec.h: Include "progspace.h". (exec_bfd, exec_bfd_mtime): New defines. (exec_close): Declare. * exec.c: Include "gdbthread.h" and "progspace.h". (exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete. (using_exec_ops): New. (exec_close_1): Rename to exec_close, and make public. (exec_close): Rename to exec_close_1, and adjust all callers. Add description. Remove target sections and close executables from all program spaces. (exec_file_attach): Add comment. (add_target_sections): Check on `using_exec_ops' to check if the target should be pushed. (remove_target_sections): Only unpush the target if there are no more target sections in any symbol space. * gdbcore.h: Include "exec.h". (exec_bfd, exec_bfd_mtime): Remove declarations. * frame.h (get_frame_program_space, get_frame_address_space) (frame_unwind_program_space): Declare. * frame.c (struct frame_info) <pspace, aspace>: New fields. (create_sentinel_frame): Add program space argument. Set the pspace and aspace fields of the frame object. (get_current_frame, create_new_frame): Adjust. (get_frame_program_space): New. (frame_unwind_program_space): New. (get_frame_address_space): New. * stack.c (print_frame_info): Adjust. (print_frame): Use the frame's program space. * gdbthread.h (any_live_thread_of_process): Declare. * thread.c (any_live_thread_of_process): New. (switch_to_thread): Switch the program space as well. (restore_selected_frame): Don't warn if trying to restore frame level 0. * inferior.h: Include "progspace.h". (detach_fork): Declare. (struct inferior) <removable, aspace, pspace> <vfork_parent, vfork_child, pending_detach> <waiting_for_vfork_done>: New fields. <terminal_info>: Remove field. <data, num_data>: New fields. (register_inferior_data, register_inferior_data_with_cleanup) (clear_inferior_data, set_inferior_data, inferior_data): Declare. (exit_inferior, exit_inferior_silent, exit_inferior_num_silent) (inferior_appeared): Declare. (find_inferior_pid): Typo. (find_inferior_id, find_inferior_for_program_space): Declare. (set_current_inferior, save_current_inferior, prune_inferiors) (number_of_inferiors): Declare. (inferior_list): Declare. * inferior.c: Include "gdbcore.h" and "symfile.h". (inferior_list): Make public. (delete_inferior_1): Always delete thread silently. (find_inferior_id): Make public. (current_inferior_): New. (current_inferior): Use it. (set_current_inferior): New. (restore_inferior): New. (save_current_inferior): New. (free_inferior): Free the per-inferior data. (add_inferior_silent): Allocate per-inferior data. Call inferior_appeared. (delete_threads_of_inferior): New. (delete_inferior_1): Adjust interface to take an inferior pointer. (delete_inferior): Adjust. (delete_inferior_silent): Adjust. (exit_inferior_1): New. (exit_inferior): New. (exit_inferior_silent): New. (exit_inferior_num_silent): New. (detach_inferior): Adjust. (inferior_appeared): New. (discard_all_inferiors): Adjust. (find_inferior_id): Make public. Assert pid is not zero. (find_inferior_for_program_space): New. (have_inferiors): Check if we have any inferior with pid not zero. (have_live_inferiors): Go over all pushed targets looking for process_stratum. (prune_inferiors): New. (number_of_inferiors): New. (print_inferior): Add executable column. Print vfork parent/child relationships. (inferior_command): Adjust to cope with not running inferiors. (remove_inferior_command): New. (add_inferior_command): New. (clone_inferior_command): New. (struct inferior_data): New. (struct inferior_data_registration): New. (struct inferior_data_registry): New. (inferior_data_registry): New. (register_inferior_data_with_cleanup): New. (register_inferior_data): New. (inferior_alloc_data): New. (inferior_free_data): New. (clear_inferior_data): New. (set_inferior_data): New. (inferior_data): New. (initialize_inferiors): New. (_initialize_inferiors): Register "add-inferior", "remove-inferior" and "clone-inferior" commands. * objfiles.h: Include "progspace.h". (struct objfile) <pspace>: New field. (symfile_objfile, object_files): Don't declare. (ALL_PSPACE_OBJFILES): New. (ALL_PSPACE_OBJFILES_SAFE): New. (ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust. (ALL_PSPACE_SYMTABS): New. (ALL_PRIMARY_SYMTABS): Adjust. (ALL_PSPACE_PRIMARY_SYMTABS): New. (ALL_PSYMTABS): Adjust. (ALL_PSPACE_PSYMTABS): New. * objfiles.c (object_files, symfile_objfile): Delete. (struct objfile_sspace_info): New. (objfiles_pspace_data): New. (objfiles_pspace_data_cleanup): New. (get_objfile_pspace_data): New. (objfiles_changed_p): Delete. (allocate_objfile): Set the objfile's program space. Adjust to reference objfiles_changed_p in pspace data. (free_objfile): Adjust to reference objfiles_changed_p in pspace data. (objfile_relocate): Ditto. (update_section_map): Add pspace argument. Adjust to iterate over objfiles in the passed in pspace. (find_pc_section): Delete sections and num_sections statics. Adjust to refer to program space's objfiles_changed_p. Adjust to refer to sections and num_sections store in the objfile's pspace data. (objfiles_changed): Adjust to reference objfiles_changed_p in pspace data. (_initialize_objfiles): New. * linespec.c (decode_all_digits, decode_dollar): Set the sal's program space. * source.c (current_source_pspace): New. (get_current_source_symtab_and_line): Set the sal's program space. (set_current_source_symtab_and_line): Set current_source_pspace. (select_source_symtab): Ditto. Use ALL_OBJFILES. (forget_cached_source_info): Iterate over all program spaces. * symfile.c (clear_symtab_users): Adjust. * symmisc.c (print_symbol_bcache_statistics): Iterate over all program spaces. (print_objfile_statistics): Ditto. (maintenance_print_msymbols): Ditto. (maintenance_print_objfiles): Ditto. (maintenance_info_symtabs): Ditto. (maintenance_info_psymtabs): Ditto. * symtab.h (SYMTAB_PSPACE): New. (struct symtab_and_line) <pspace>: New field. * symtab.c (init_sal): Clear the sal's program space. (find_pc_sect_symtab): Set the sal's program space. Switch thread and space. (append_expanded_sal): Add program space argument. Iterate over all program spaces. (expand_line_sal): Iterate over all program spaces. Switch program space. * target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New. (struct target_ops) <to_thread_address_space>: New field. (target_thread_address_space): Define. * target.c (target_detach): Only remove breakpoints from the inferior we're detaching. (target_thread_address_space): New. * defs.h (initialize_progspace): Declare. * top.c (gdb_init): Call it. * solist.h (struct so_list) <sspace>: New field. * solib.h (struct program_space): Forward declare. (solib_name_from_address): Adjust prototype. * solib.c (so_list_head): Replace with a macro referencing the program space. (update_solib_list): Set the so's program space. (solib_name_from_address): Add a program space argument and adjust. * solib-svr4.c (struct svr4_info) <pid>: Delete field. <interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low> <interp_plt_sect_high>: New fields. (svr4_info_p, svr4_info): Delete. (solib_svr4_sspace_data): New. (get_svr4_info): Rewrite. (svr4_sspace_data_cleanup): New. (open_symbol_file_object): Adjust. (svr4_default_sos): Adjust. (svr4_fetch_objfile_link_map): Adjust. (interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low) (interp_plt_sect_high): Delete. (svr4_in_dynsym_resolve_code): Adjust. (enable_break): Adjust. (svr4_clear_solib): Revert bit that removed the svr4_info here, and reinstate clearing debug_base, debug_loader_offset_p, debug_loader_offset and debug_loader_name. (_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't install an inferior_exit observer anymore. * printcmd.c (struct display) <pspace>: New field. (display_command): Set the display's sspace. (do_one_display): Match the display's sspace. (display_uses_solib_p): Ditto. * linux-fork.c (detach_fork): Moved to infrun.c. (_initialize_linux_fork): Moved "detach-on-fork" command to infrun.c. * infrun.c (detach_fork): Moved from linux-fork.c. (proceed_after_vfork_done): New. (handle_vfork_child_exec_or_exit): New. (follow_exec_mode_replace, follow_exec_mode_keep) (follow_exec_mode_names, follow_exec_mode_string) (show_follow_exec_mode_string): New. (follow_exec): New. Reinstate the mark_breakpoints_out call. Remove shared libraries before attaching new executable. If user wants to keep the inferior, keep it. (displaced_step_fixup): Adjust to pass an address space to the breakpoints module. (resume): Ditto. (clear_proceed_status): In all-stop mode, always clear the proceed status of all threads. (prepare_to_proceed): Adjust to pass an address space to the breakpoints module. (proceed): Ditto. (adjust_pc_after_break): Ditto. (handle_inferior_event): When handling a process exit, switch the program space to the inferior's that had exited. Call handle_vfork_child_exec_or_exit. Adjust to pass an address space to the breakpoints module. In non-stop mode, when following a fork and detach-fork is off, also resume the other branch. Handle TARGET_WAITKIND_VFORK_DONE. Set the program space in sals. (normal_stop): Prune inferiors. (_initialize_infrun): Install the new "follow-exec-mode" command. "detach-on-fork" moved here. * regcache.h (get_regcache_aspace): Declare. * regcache.c (struct regcache) <aspace>: New field. (regcache_xmalloc): Clear the aspace. (get_regcache_aspace): New. (regcache_cpy): Copy the aspace field. (regcache_cpy_no_passthrough): Ditto. (get_thread_regcache): Fetch the thread's address space from the target, and store it in the regcache. * infcall.c (call_function_by_hand): Set the sal's pspace. * arch-utils.c (default_has_shared_address_space): New. * arch-utils.h (default_has_shared_address_space): Declare. * gdbarch.sh (has_shared_address_space): New. * gdbarch.h, gdbarch.c: Regenerate. * linux-tdep.c: Include auxv.h, target.h, elf/common.h. (linux_has_shared_address_space): New. (_initialize_linux_tdep): Declare. * arm-tdep.c (arm_software_single_step): Pass the frame's address space to insert_single_step_breakpoint. * arm-linux-tdep.c (arm_linux_software_single_step): Pass the frame's pspace to breakpoint functions. * cris-tdep.c (crisv32_single_step_through_delay): Ditto. (cris_software_single_step): Ditto. * mips-tdep.c (deal_with_atomic_sequence): Add frame argument. Pass the frame's pspace to breakpoint functions. (mips_software_single_step): Adjust. (mips_single_step_through_delay): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * solib-irix.c (enable_break): Adjust to pass the current frame's address space to breakpoint functions. * sparc-tdep.c (sparc_software_single_step): Ditto. * spu-tdep.c (spu_software_single_step): Ditto. * alpha-tdep.c (alpha_software_single_step): Ditto. * record.c (record_wait): Adjust to pass an address space to the breakpoints module. * fork-child.c (fork_inferior): Set the new inferior's program and address spaces. * inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program and address spaces. (inf_ptrace_attach): Set the inferior's program and address spaces. * linux-nat.c: Include "solib.h". (linux_child_follow_fork): Manage parent and child's program and address spaces. Clone the parent's program space if necessary. Don't wait for the vfork to be done here. Refuse to resume if following the vfork parent while leaving the child stopped. (resume_callback): Don't resume a vfork parent. (linux_nat_resume): Also check for pending events in the lp->waitstatus field. (linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE events to the core. (stop_wait_callback): Don't wait for SIGSTOP on vfork parents. (cancel_breakpoint): Adjust. * linux-thread-db.c (thread_db_wait): Don't remove thread event breakpoints here. (thread_db_mourn_inferior): Don't mark breakpoints out here. Remove thread event breakpoints after mourning. * corelow.c: Include progspace.h. (core_open): Set the inferior's program and address spaces. * remote.c (remote_add_inferior): Set the new inferior's program and address spaces. (remote_start_remote): Update address spaces. (extended_remote_create_inferior_1): Don't init the thread list if we already debugging other inferiors. * darwin-nat.c (darwin_attach): Set the new inferior's program and address spaces. * gnu-nat.c (gnu_attach): Ditto. * go32-nat.c (go32_create_inferior): Ditto. * inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto. * monitor.c (monitor_open): Ditto. * nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto. * procfs.c (do_attach): Ditto. * windows-nat.c (do_initial_windows_stuff): Ditto. * inflow.c (inferior_process_group) (terminal_init_inferior_with_pgrp, terminal_inferior, (terminal_ours_1, inflow_inferior_exit, copy_terminal_info) (child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust to use per-inferior data instead of inferior->terminal_info. (inflow_inferior_data): New. (inflow_new_inferior): Delete. (inflow_inferior_data_cleanup): New. (get_inflow_inferior_data): New. * mi/mi-interp.c (mi_new_inferior): Rename to... (mi_inferior_appeared): ... this. (mi_interpreter_init): Adjust. * tui/tui-disasm.c: Include "progspace.h". (tui_set_disassem_content): Pass an address space to breakpoint_here_p. * NEWS: Mention multi-program debugging support. Mention new commands "add-inferior", "clone-inferior", "remove-inferior", "maint info program-spaces", and new option "set follow-exec-mode". 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/doc/ * observer.texi (new_inferior): Rename to... (inferior_appeared): ... this. 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/testsuite/ * gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork". * gdb.base/foll-exec.exp: Adjust to expect a process id before "Executing new program". * gdb.base/foll-fork.exp: Adjust to spell out "follow-fork". * gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being left listed after having been killed. * gdb.base/attach.exp: Adjust to spell out "symbol-file". * gdb.base/maint.exp: Adjust test. * Makefile.in (ALL_SUBDIRS): Add gdb.multi. * gdb.multi/Makefile.in: New. * gdb.multi/base.exp: New. * gdb.multi/goodbye.c: New. * gdb.multi/hangout.c: New. * gdb.multi/hello.c: New. * gdb.multi/bkpt-multi-exec.c: New. * gdb.multi/bkpt-multi-exec.exp: New. * gdb.multi/crashme.c: New. 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/doc/ * gdb.texinfo (Inferiors): Rename node to ... (Inferiors and Programs): ... this. Mention running multiple programs in the same debug session. <info inferiors>: Mention the new 'Executable' column if "info inferiors". Update examples. Document the "add-inferior", "clone-inferior", "remove-inferior" and "maint info program-spaces" commands. (Process): Rename node to... (Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
extern struct thread_info *any_live_thread_of_process (int pid);
/* Change the ptid of thread OLD_PTID to NEW_PTID. */
void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid);
2000-01-11 04:07:37 +01:00
/* Iterator function to call a user-provided callback function
once for each known thread. */
typedef int (*thread_callback_func) (struct thread_info *, void *);
extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
Fix next over threaded execl with "set scheduler-locking step". Running gdb.threads/thread-execl.exp with scheduler-locking set to "step" reveals a problem: (gdb) next^M [Thread 0x7ffff7fda700 (LWP 27168) exited]^M [New LWP 27168]^M [Thread 0x7ffff74ee700 (LWP 27174) exited]^M process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M [Thread debugging using libthread_db enabled]^M Using host libthread_db library "/lib64/libthread_db.so.1".^M infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M A problem internal to GDB has been detected,^M further debugging may prove unreliable.^M Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: schedlock step: get to main in new image (GDB internal error) The assertion is correct. The issue is that GDB is mistakenly trying to switch back to an exited thread, that was previously stepping when it exited. This is exactly the sort of thing the test wants to make sure doesn't happen: # Now set a breakpoint at `main', and step over the execl call. The # breakpoint at main should be reached. GDB should not try to revert # back to the old thread from the old image and resume stepping it We don't see this bug with schedlock off only because a different sequence of events makes GDB manage to delete the thread instead of marking it exited. This particular internal error can be fixed by making the loop over all threads in switch_back_to_stepped_thread skip exited threads. But, looking over other ALL_THREADS users, all either can or should be skipping exited threads too. So for simplicity, this patch replaces ALL_THREADS with a new macro that skips exited threads itself, and updates everything to use it. Tested on x86_64 Fedora 20. gdb/ 2014-06-19 Pedro Alves <palves@redhat.com> * gdbthread.h (ALL_THREADS): Delete. (ALL_NON_EXITED_THREADS): New macro. * btrace.c (btrace_free_objfile): Use ALL_NON_EXITED_THREADS instead of ALL_THREADS. * infrun.c (find_thread_needs_step_over) (switch_back_to_stepped_thread): Use ALL_NON_EXITED_THREADS instead of ALL_THREADS. * record-btrace.c (record_btrace_open) (record_btrace_stop_recording, record_btrace_close) (record_btrace_is_replaying, record_btrace_resume) (record_btrace_find_thread_to_move, record_btrace_wait): Likewise. * remote.c (append_pending_thread_resumptions): Likewise. * thread.c (thread_apply_all_command): Likewise. gdb/testsuite/ 2014-06-19 Pedro Alves <palves@redhat.com> * gdb.threads/thread-execl.exp (do_test): New procedure, factored out from ... (top level): ... here. Iterate running tests under different scheduler-locking settings.
2014-06-19 12:59:03 +02:00
/* Traverse all threads, except those that have THREAD_EXITED
state. */
Fix next over threaded execl with "set scheduler-locking step". Running gdb.threads/thread-execl.exp with scheduler-locking set to "step" reveals a problem: (gdb) next^M [Thread 0x7ffff7fda700 (LWP 27168) exited]^M [New LWP 27168]^M [Thread 0x7ffff74ee700 (LWP 27174) exited]^M process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M [Thread debugging using libthread_db enabled]^M Using host libthread_db library "/lib64/libthread_db.so.1".^M infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M A problem internal to GDB has been detected,^M further debugging may prove unreliable.^M Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: schedlock step: get to main in new image (GDB internal error) The assertion is correct. The issue is that GDB is mistakenly trying to switch back to an exited thread, that was previously stepping when it exited. This is exactly the sort of thing the test wants to make sure doesn't happen: # Now set a breakpoint at `main', and step over the execl call. The # breakpoint at main should be reached. GDB should not try to revert # back to the old thread from the old image and resume stepping it We don't see this bug with schedlock off only because a different sequence of events makes GDB manage to delete the thread instead of marking it exited. This particular internal error can be fixed by making the loop over all threads in switch_back_to_stepped_thread skip exited threads. But, looking over other ALL_THREADS users, all either can or should be skipping exited threads too. So for simplicity, this patch replaces ALL_THREADS with a new macro that skips exited threads itself, and updates everything to use it. Tested on x86_64 Fedora 20. gdb/ 2014-06-19 Pedro Alves <palves@redhat.com> * gdbthread.h (ALL_THREADS): Delete. (ALL_NON_EXITED_THREADS): New macro. * btrace.c (btrace_free_objfile): Use ALL_NON_EXITED_THREADS instead of ALL_THREADS. * infrun.c (find_thread_needs_step_over) (switch_back_to_stepped_thread): Use ALL_NON_EXITED_THREADS instead of ALL_THREADS. * record-btrace.c (record_btrace_open) (record_btrace_stop_recording, record_btrace_close) (record_btrace_is_replaying, record_btrace_resume) (record_btrace_find_thread_to_move, record_btrace_wait): Likewise. * remote.c (append_pending_thread_resumptions): Likewise. * thread.c (thread_apply_all_command): Likewise. gdb/testsuite/ 2014-06-19 Pedro Alves <palves@redhat.com> * gdb.threads/thread-execl.exp (do_test): New procedure, factored out from ... (top level): ... here. Iterate running tests under different scheduler-locking settings.
2014-06-19 12:59:03 +02:00
#define ALL_NON_EXITED_THREADS(T) \
for (T = thread_list; T; T = T->next) \
if ((T)->state != THREAD_EXITED)
extern int thread_count (void);
/* Switch from one thread to another. */
extern void switch_to_thread (ptid_t ptid);
/* Marks thread PTID is running, or stopped.
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
If ptid_get_pid (PTID) is -1, marks all threads. */
extern void set_running (ptid_t ptid, int running);
/* Marks or clears thread(s) PTID as having been requested to stop.
If PTID is MINUS_ONE_PTID, applies to all threads. If
ptid_is_pid(PTID) is true, applies to all threads of the process
pointed at by PTID. If STOP, then the THREAD_STOP_REQUESTED
observer is called with PTID as argument. */
extern void set_stop_requested (ptid_t ptid, int stop);
/* NOTE: Since the thread state is not a boolean, most times, you do
not want to check it with negation. If you really want to check if
the thread is stopped,
use (good):
if (is_stopped (ptid))
instead of (bad):
if (!is_running (ptid))
The latter also returns true on exited threads, most likelly not
what you want. */
/* Reports if in the frontend's perpective, thread PTID is running. */
extern int is_running (ptid_t ptid);
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-10 00:16:15 +02:00
Exited threads. * 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).
2008-07-11 13:07:39 +02:00
/* Is this thread listed, but known to have exited? We keep it listed
(but not visible) until it's safe to delete. */
extern int is_exited (ptid_t ptid);
/* In the frontend's perpective, is this thread stopped? */
Exited threads. * 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).
2008-07-11 13:07:39 +02:00
extern int is_stopped (ptid_t ptid);
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
/* Marks thread PTID as executing, or not. If ptid_get_pid (PTID) is -1,
marks all threads.
Note that this is different from the running state. See the
description of state and executing fields of struct
thread_info. */
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-10 00:16:15 +02:00
extern void set_executing (ptid_t ptid, int executing);
/* Reports if thread PTID is executing. */
extern int is_executing (ptid_t ptid);
Fix non-stop regressions caused by "breakpoints always-inserted off" changes Commit a25a5a45 (Fix "breakpoint always-inserted off"; remove "breakpoint always-inserted auto") regressed non-stop remote debugging. This was exposed by mi-nsintrall.exp intermittently failing with a spurious SIGTRAP. The problem is that when debugging with "target remote", new threads the target has spawned but have never reported a stop aren't visible to GDB until it explicitly resyncs its thread list with the target's. For example, in a program like this: int main (void) { pthread_t child_thread; pthread_create (&child_thread, NULL, child_function, NULL); return 0; <<<< set breakpoint here } If the user sets a breakpoint at the "return" statement, and runs the program, when that breakpoint hit is reported, GDB is only aware of the main thread. So if we base the decision to remove or insert breakpoints from the target based on whether all the threads we know about are stopped, we'll miss that child_thread is running, and thus we'll remove breakpoints from the target, even through they should still remain inserted, otherwise child_thread will miss them. The break-while-running.exp test actually should also be exposing this thread-list-out-of-synch problem. That test sets a breakpoint while the main thread is stopped, but other threads are running. Because other threads are running, the breakpoint is supposed to be inserted immediately. But, unless something forces a refetch of the thread list, like, e.g., "info threads", GDB won't be aware of the other threads that had been spawned by the main thread, and so won't insert new or old breakpoints in the target. And it turns out that the test is exactly doing an explicit "info threads", masking out the problem... This commit adjust the test to exercise the case of not issuing "info threads". The test then fails without the GDB fix. In the ni-nsintrall.exp case, what happens is that several threads hit the same breakpoint, and when the first thread reports the stop, because GDB wasn't aware other threads exist, all threads known to GDB are found stopped, so GDB removes the breakpoints from the target. The other threads follow up with SIGTRAPs too for that same breakpoint, which has already been removed. For the first few threads, the moribund breakpoints machinery suppresses the SIGTRAPs, but after a few events (precisely '3 * thread_count () + 1' at the time the breakpoint was removed, see update_global_location_list), the moribund breakpoint machinery is no longer aware of the removed breakpoint, and the SIGTRAP is reported as a spurious stop. The fix is naturally then to stop assuming that if no thread in the list is executing, then the target is fully stopped. We can't know that until we fully sync the thread list. Because updating the thread list on every stop would be too much RSP traffic, I chose instead to update it whenever we're about to present a stop to the user. Actually updating the thread list at that point happens to be an item I had added to the local/remote parity wiki page a while ago: Native GNU/Linux debugging adds new threads to the thread list as the program creates them "The [New Thread foo] messages". Remote debugging can't do that, and it's arguable whether we shouldn't even stop native debugging from doing that, as it hinders inferior performance. However, a related issue is that with remote targets (and gdbserver), even after the program stops, the user still needs to do "info threads" to pull an updated thread list. This, should most likely be addressed, so that GDB pulls the list itself, perhaps just before presenting a stop to the user. With that in place, the need to delay "Program received signal FOO" was actually caught by the manythreads.exp test. Without that bit, I was getting: [Thread 0x7ffff7f13700 (LWP 4499) exited] [New Thread 0x7ffff7f0b700 (LWP 4500)] ^C Program received signal SIGINT, Interrupt. [New Thread 0x7ffff7f03700 (LWP 4501)] <<< new output [Switching to Thread 0x7ffff7f0b700 (LWP 4500)] __GI___nptl_death_event () at events.c:31 31 { (gdb) FAIL: gdb.threads/manythreads.exp: stop threads 1 That is, I was now getting "New Thread" lines after the "Program received signal" line, and the test doesn't expect them. As the number of new threads discovered before and after the "Program received signal" output is unbounded, it's much nicer to defer "Program received signal" until after synching the thread list, thus close to the "switching to thread" output and "current frame/source" info: [Thread 0x7ffff7863700 (LWP 7647) exited] ^C[New Thread 0x7ffff786b700 (LWP 7648)] Program received signal SIGINT, Interrupt. [Switching to Thread 0x7ffff7fc4740 (LWP 6243)] __GI___nptl_create_event () at events.c:25 25 { (gdb) PASS: gdb.threads/manythreads.exp: stop threads 1 Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-10-02 Pedro Alves <palves@redhat.com> * breakpoint.c (breakpoints_should_be_inserted_now): Use threads_are_executing. * breakpoint.h (breakpoints_should_be_inserted_now): Add describing comment. * gdbthread.h (threads_are_executing): Declare. (handle_signal_stop) <random signals>: Don't print about the signal here if stopping. (end_stepping_range): Don't notify observers here. (normal_stop): Update the thread list. If stopped by a random signal or a stepping range ended, notify observers. * thread.c (threads_executing): New global. (init_thread_list): Clear 'threads_executing'. (set_executing): Set or clear 'threads_executing'. (threads_are_executing): New function. (update_threads_executing): New function. (update_thread_list): Use it. gdb/testsuite/ 2014-10-02 Pedro Alves <palves@redhat.com> * gdb.threads/break-while-running.exp (test): Add new 'update_thread_list' argument. Skip "info threads" if false. (top level): Add new 'update_thread_list' axis.
2014-10-02 10:55:38 +02:00
/* True if any (known or unknown) thread is or may be executing. */
extern int threads_are_executing (void);
/* Merge the executing property of thread PTID over to its thread
state property (frontend running/stopped view).
"not executing" -> "stopped"
"executing" -> "running"
"exited" -> "exited"
* aarch64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * aix-thread.c (BUILD_THREAD, BUILD_LWP): Remove. Replace BUILD_THREAD with ptid_build. Replace BUILD_LWP with ptid_build. Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * alphabsd-nat.c: Replace PIDGET with ptid_get_pid. * amd64-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * amd64bsd-nat.c: Replace PIDGET with ptid_get_pid. * arm-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. Replace GET_LWP with ptid_get_lwp. * armnbsd-nat.c: Replace PIDGET with ptid_get_pid. * auxv.c: Likewise. * breakpoint.c: Likewise. * common/ptid.c (ptid_is_pid): Condense check for null_ptid and minus_one_ptid. (ptid_lwp_p): New function. (ptid_tid_p): New function. * common/ptid.h: Update comments for accessors. (ptid_lwp_p): New prototype. (ptid_tid_p): New prototype. * defs.h (PIDGET, TIDGET, MERGEPID): Do not define. * gcore.c: Replace PIDGET with ptid_get_pid. * gdbthread.h: Likewise. * gnu-nat.c: Likewise. * hppa-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * hppabsd-nat.c: Replace PIDGET with ptid_get_pid. * hppanbsd-nat.c: Likewise. * i386-linux-nat.c: Replace PIDGET with ptid_get_pid. Replace TIDGET with ptid_get_lwp. * i386bsd-nat.c: Replace PIDGET with ptid_get_pid. * ia64-linux-nat.c: Replace PIDGET with ptid_get_pid. * infcmd.c: Likewise. * inferior.h: Likewise. * inflow.c: Likewise. * infrun.c: Likewise. * linux-fork.c: Likewise. * linux-nat.c: Replace PIDGET with ptid_get_pid. Replace GET_PID with ptid_get_pid. Replace is_lwp with ptid_lwp_p. Replace GET_LWP with ptid_get_lwp. Replace BUILD_LWP with ptid_build.
2013-09-30 13:50:12 +02:00
If ptid_get_pid (PTID) is -1, go over all threads.
Notifications are only emitted if the thread state did change. */
extern void finish_thread_state (ptid_t ptid);
/* Same as FINISH_THREAD_STATE, but with an interface suitable to be
registered as a cleanup. PTID_P points to the ptid_t that is
passed to FINISH_THREAD_STATE. */
extern void finish_thread_state_cleanup (void *ptid_p);
/* Commands with a prefix of `thread'. */
extern struct cmd_list_element *thread_cmd_list;
/* Print notices on thread events (attach, detach, etc.), set with
`set print thread-events'. */
extern int print_thread_events;
extern void print_thread_info (struct ui_out *uiout, char *threads,
int pid);
Exited threads. * 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).
2008-07-11 13:07:39 +02:00
extern struct cleanup *make_cleanup_restore_current_thread (void);
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 23:40:39 +02:00
/* Returns a pointer into the thread_info corresponding to
INFERIOR_PTID. INFERIOR_PTID *must* be in the thread list. */
extern struct thread_info* inferior_thread (void);
Implement core awareness. * bcache.c (compare_ints): Remove (print_percentage): Use compare_positive_ints. * defs.h (compare_positive_ints): Declare. * linux-nat.h (struct lin_lwp): New field core. (linux_nat_core_of_thread_1): Declare. * linux-nat.c (add_lwp): Init the 'core' field. (linux_nat_wait_1): Record the core. (linux_nat_core_of_thread_1, linux_nat_core_of_thread): New. (linux_nat_add_target): Register the above. * linux-thread-db.c (update_thread_core): New. (thread_db_find_new_threads): Update core information for every thread. * remote.c (struct private_thread_info): New. (free_private_thread_info, demand_private_info): New. (PACKET_qXfer_threads, use_osdata_threads): New. (struct thread_item, threads_parsing_context (start_thread, end_thread, thread_attributes) (thread_children, threads_children, threads_elements): New. (remote_threads_info): Try qXfer:threads before anything else. (remote_protocol_packets): Register qXfer:threads. (remote_open_1): Init use_osdata_threads. (struct stop_reply): New field 'core'. (remote_parse_stop_reply): Parse core number. (process_stop_reply): Record core number. (remote_xfer_partial): Handle qXfer:threads. (remote_core_of_thread): New. (init_remote_ops): Register remote_core_of_thread. (_initialize_remote): Register qXfer:read. * target.c (target_core_of_thread): New * target.h (enum target_object): New value TARGET_OBJECT_THREADS. (struct target_ops): New field to_core_of_threads. (target_core_of_thread): Declare. * gdbthread.h (struct thread_info): New field private_dtor. * thread.c (print_thread_info): Report the core. * ui-out.c (MAX_UI_OUT_LEVELS): Increase. * utils.c (compare_positive_ints): New. * features/threads.dtd: New. * mi/mi-interp.c (mi_on_normal_stop): Report the core. * mi/mi-main.c (struct collect_cores_data, collect_cores) (do_nothing, free_vector_of_osdata_items) (splay_tree_int_comparator, free_splay_tree): New. (print_one_inferior_data): Implemented printing of selected inferiors. Collect and print cores. (output_cores): New. (mi_cmd_list_thread_groups): Support --recurse. Permit specifying thread groups together with --available.
2010-01-12 22:40:25 +01:00
extern void update_thread_list (void);
/* Return true if PC is in the stepping range of THREAD. */
int pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread);
extern struct thread_info *thread_list;
1999-07-07 22:19:36 +02:00
#endif /* GDBTHREAD_H */