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.
This commit is contained in:
Jan Kratochvil 2010-11-28 04:31:25 +00:00
parent f0df11bdc9
commit 16c381f058
24 changed files with 553 additions and 467 deletions

View File

@ -1,3 +1,62 @@
2010-11-28 Jan Kratochvil <jan.kratochvil@redhat.com>
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-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* infcall.c (struct inferior_thread_state) <siginfo_gdbarch>: Fix up

View File

@ -992,7 +992,7 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
/* It's not clear to me why we reach this point when stopping quietly,
but with this test, at least we don't print out warnings for every
child forked (eg, on decstation). 22apr93 rich@cygnus.com. */
if (inf->stop_soon == NO_STOP_QUIETLY)
if (inf->control.stop_soon == NO_STOP_QUIETLY)
{
static int blurb_printed = 0;

View File

@ -3008,7 +3008,7 @@ breakpoint_about_to_proceed (void)
interrupt the command list. When the call finishes
successfully, the inferior will be standing at the same
breakpoint as if nothing happened. */
if (tp->in_infcall)
if (tp->control.in_infcall)
return;
}
@ -3127,7 +3127,7 @@ bpstat_do_actions (void)
and only return when it is stopped at the next breakpoint, we
keep doing breakpoint actions until it returns false to
indicate the inferior was not resumed. */
if (!bpstat_do_actions_1 (&inferior_thread ()->stop_bpstat))
if (!bpstat_do_actions_1 (&inferior_thread ()->control.stop_bpstat))
break;
}
@ -9680,7 +9680,7 @@ bpstat_remove_breakpoint_callback (struct thread_info *th, void *data)
{
struct breakpoint *bpt = data;
bpstat_remove_bp_location (th->stop_bpstat, bpt);
bpstat_remove_bp_location (th->control.stop_bpstat, bpt);
return 0;
}

View File

@ -43,7 +43,7 @@ struct dummy_frame
gdbarch_dummy_id. */
struct frame_id id;
/* The caller's state prior to the call. */
struct inferior_thread_state *caller_state;
struct infcall_suspend_state *caller_state;
};
static struct dummy_frame *dummy_frame_stack = NULL;
@ -86,7 +86,7 @@ deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc)
dummy-frame stack. */
void
dummy_frame_push (struct inferior_thread_state *caller_state,
dummy_frame_push (struct infcall_suspend_state *caller_state,
const struct frame_id *dummy_id)
{
struct dummy_frame *dummy_frame;
@ -106,7 +106,7 @@ remove_dummy_frame (struct dummy_frame **dummy_ptr)
struct dummy_frame *dummy = *dummy_ptr;
*dummy_ptr = dummy->next;
discard_inferior_thread_state (dummy->caller_state);
discard_infcall_suspend_state (dummy->caller_state);
xfree (dummy);
}
@ -118,9 +118,9 @@ pop_dummy_frame (struct dummy_frame **dummy_ptr)
{
struct dummy_frame *dummy;
restore_inferior_thread_state ((*dummy_ptr)->caller_state);
restore_infcall_suspend_state ((*dummy_ptr)->caller_state);
/* restore_inferior_status frees inf_state,
/* restore_infcall_control_state frees inf_state,
all that remains is to pop *dummy_ptr */
dummy = *dummy_ptr;
*dummy_ptr = dummy->next;
@ -220,7 +220,8 @@ dummy_frame_sniffer (const struct frame_unwind *self,
struct dummy_frame_cache *cache;
cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache);
cache->prev_regcache = get_inferior_thread_state_regcache (dummyframe->caller_state);
cache->prev_regcache = get_infcall_suspend_state_regcache
(dummyframe->caller_state);
cache->this_id = this_id;
(*this_prologue_cache) = cache;
return 1;

View File

@ -23,7 +23,7 @@
#include "frame.h"
struct inferior_thread_state;
struct infcall_suspend_state;
struct frame_unwind;
/* Push the information needed to identify, and unwind from, a dummy
@ -39,7 +39,7 @@ struct frame_unwind;
be expanded so that it knowns the lower/upper extent of the dummy
frame's code. */
extern void dummy_frame_push (struct inferior_thread_state *caller_state,
extern void dummy_frame_push (struct infcall_suspend_state *caller_state,
const struct frame_id *dummy_id);
/* Pop the dummy frame DUMMY_ID, restoring program state to that before the

View File

@ -226,7 +226,10 @@ throw_exception (struct gdb_exception exception)
/* Perhaps it would be cleaner to do this via the cleanup chain (not sure
I can think of a reason why that is vital, though). */
if (tp != NULL)
bpstat_clear_actions (tp->stop_bpstat); /* Clear queued breakpoint commands */
{
/* Clear queued breakpoint commands */
bpstat_clear_actions (tp->control.stop_bpstat);
}
disable_current_display ();
do_cleanups (ALL_CLEANUPS);

View File

@ -143,7 +143,7 @@ fbsd_find_memory_regions (find_memory_region_ftype func, void *obfd)
static int
find_signalled_thread (struct thread_info *info, void *data)
{
if (info->stop_signal != TARGET_SIGNAL_0
if (info->suspend.stop_signal != TARGET_SIGNAL_0
&& ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
return 1;
@ -157,7 +157,7 @@ find_stop_signal (void)
iterate_over_threads (find_signalled_thread, NULL);
if (info)
return info->stop_signal;
return info->suspend.stop_signal;
else
return TARGET_SIGNAL_0;
}

View File

@ -29,6 +29,88 @@ struct symtab;
#include "ui-out.h"
#include "inferior.h"
/* Inferior thread specific part of `struct infcall_control_state'.
Inferior process counterpart is `struct inferior_control_state'. */
struct thread_control_state
{
/* User/external stepping state. */
/* 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
not.). */
CORE_ADDR step_range_start; /* Inclusive */
CORE_ADDR step_range_end; /* Exclusive */
/* 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;
/* Similarly, the frame ID of the underlying stack frame (skipping
any inlined frames). */
struct frame_id step_stack_frame_id;
/* 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. */
int trap_expected;
/* 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;
};
/* Inferior thread specific part of `struct infcall_suspend_state'.
Inferior process counterpart is `struct inferior_suspend_state'. */
struct thread_suspend_state
{
/* Last signal that the inferior received (why it stopped). */
enum target_signal stop_signal;
};
struct thread_info
{
struct thread_info *next;
@ -61,33 +143,19 @@ struct thread_info
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;
/* User/external stepping state. */
/* Step-resume or longjmp-resume breakpoint. */
struct breakpoint *step_resume_breakpoint;
/* 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
not.). */
CORE_ADDR step_range_start; /* Inclusive */
CORE_ADDR step_range_end; /* Exclusive */
/* 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;
/* Similarly, the frame ID of the underlying stack frame (skipping
any inlined frames). */
struct frame_id step_stack_frame_id;
int current_line;
struct symtab *current_symtab;
@ -99,30 +167,6 @@ struct thread_info
SIGTRAP from a breakpoint SIGTRAP. */
CORE_ADDR prev_pc;
/* 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. */
int trap_expected;
/* Should we step over breakpoint next time keep_going is called? */
int stepping_over_breakpoint;
@ -153,19 +197,6 @@ struct thread_info
command. */
struct continuation *intermediate_continuations;
/* 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;
/* If stepping, nonzero means step count is > 1 so don't print frame
next time inferior stops if it stops due to stepping. */
int step_multi;
@ -175,13 +206,6 @@ struct thread_info
resume of the thread, and not immediately. */
struct target_waitstatus pending_follow;
/* Last signal that the inferior received (why it stopped). */
enum target_signal stop_signal;
/* Chain containing status of breakpoint(s) the thread stopped
at. */
bpstat stop_bpstat;
/* True if this thread has been explicitly requested to stop. */
int stop_requested;

View File

@ -360,16 +360,18 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
{
volatile struct gdb_exception e;
int saved_async = 0;
int saved_in_infcall = call_thread->in_infcall;
int saved_in_infcall = call_thread->control.in_infcall;
ptid_t call_thread_ptid = call_thread->ptid;
char *saved_target_shortname = xstrdup (target_shortname);
call_thread->in_infcall = 1;
call_thread->control.in_infcall = 1;
clear_proceed_status ();
disable_watchpoints_before_interactive_call_start ();
call_thread->proceed_to_finish = 1; /* We want stop_registers, please... */
/* We want stop_registers, please... */
call_thread->control.proceed_to_finish = 1;
if (target_can_async_p ())
saved_async = target_async_mask (0);
@ -397,11 +399,11 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
if (e.reason < 0)
{
if (call_thread != NULL)
breakpoint_auto_delete (call_thread->stop_bpstat);
breakpoint_auto_delete (call_thread->control.stop_bpstat);
}
if (call_thread != NULL)
call_thread->in_infcall = saved_in_infcall;
call_thread->control.in_infcall = saved_in_infcall;
xfree (saved_target_shortname);
@ -440,9 +442,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
struct type *values_type, *target_values_type;
unsigned char struct_return = 0, lang_struct_return = 0;
CORE_ADDR struct_addr = 0;
struct inferior_status *inf_status;
struct infcall_control_state *inf_status;
struct cleanup *inf_status_cleanup;
struct inferior_thread_state *caller_state;
struct infcall_suspend_state *caller_state;
CORE_ADDR funaddr;
CORE_ADDR real_pc;
struct type *ftype = check_typedef (value_type (function));
@ -473,16 +475,17 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
/* A cleanup for the inferior status.
This is only needed while we're preparing the inferior function call. */
inf_status = save_inferior_status ();
inf_status_cleanup = make_cleanup_restore_inferior_status (inf_status);
inf_status = save_infcall_control_state ();
inf_status_cleanup
= make_cleanup_restore_infcall_control_state (inf_status);
/* Save the caller's registers and other state associated with the
inferior itself so that they can be restored once the
callee returns. To allow nested calls the registers are (further
down) pushed onto a dummy frame stack. Include a cleanup (which
is tossed once the regcache has been pushed). */
caller_state = save_inferior_thread_state ();
make_cleanup_restore_inferior_thread_state (caller_state);
caller_state = save_infcall_suspend_state ();
make_cleanup_restore_infcall_suspend_state (caller_state);
/* Ensure that the initial SP is correctly aligned. */
{
@ -810,7 +813,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
const char *name = get_function_name (funaddr,
name_buf, sizeof (name_buf));
discard_inferior_status (inf_status);
discard_infcall_control_state (inf_status);
/* We could discard the dummy frame here if the program exited,
but it will get garbage collected the next time the program is
@ -842,7 +845,7 @@ When the function is done executing, GDB will silently stop."),
/* If we try to restore the inferior status,
we'll crash as the inferior is no longer running. */
discard_inferior_status (inf_status);
discard_infcall_control_state (inf_status);
/* We could discard the dummy frame here given that the program exited,
but it will get garbage collected the next time the program is
@ -864,7 +867,7 @@ Evaluation of the expression containing the function\n\
signal or breakpoint while our thread was running.
There's no point in restoring the inferior status,
we're in a different thread. */
discard_inferior_status (inf_status);
discard_infcall_control_state (inf_status);
/* Keep the dummy frame record, if the user switches back to the
thread with the hand-call, we'll need it. */
if (stopped_by_random_signal)
@ -905,7 +908,7 @@ When the function is done executing, GDB will silently stop."),
/* We also need to restore inferior status to that before the
dummy call. */
restore_inferior_status (inf_status);
restore_infcall_control_state (inf_status);
/* FIXME: Insert a bunch of wrap_here; name can be very
long if it's a C++ name with arguments and stuff. */
@ -923,7 +926,7 @@ Evaluation of the expression containing the function\n\
(default).
Discard inferior status, we're not at the same point
we started at. */
discard_inferior_status (inf_status);
discard_infcall_control_state (inf_status);
/* FIXME: Insert a bunch of wrap_here; name can be very
long if it's a C++ name with arguments and stuff. */
@ -946,7 +949,7 @@ When the function is done executing, GDB will silently stop."),
/* We also need to restore inferior status to that before
the dummy call. */
restore_inferior_status (inf_status);
restore_infcall_control_state (inf_status);
error (_("\
The program being debugged entered a std::terminate call, most likely\n\
@ -965,7 +968,7 @@ will be abandoned."),
Keep the dummy frame, the user may want to examine its state.
Discard inferior status, we're not at the same point
we started at. */
discard_inferior_status (inf_status);
discard_infcall_control_state (inf_status);
/* The following error message used to say "The expression
which contained the function call has been discarded."
@ -1002,7 +1005,7 @@ When the function is done executing, GDB will silently stop."),
/* Inferior call is successful. Restore the inferior status.
At this stage, leave the RETBUF alone. */
restore_inferior_status (inf_status);
restore_infcall_control_state (inf_status);
/* Figure out the value returned by the function. */

View File

@ -753,7 +753,7 @@ Can't resume all threads and specify proceed count simultaneously."));
tp = find_thread_ptid (last_ptid);
}
if (tp != NULL)
bs = tp->stop_bpstat;
bs = tp->control.stop_bpstat;
while ((stat = bpstat_num (&bs, &num)) != 0)
if (stat > 0)
@ -885,7 +885,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
else
tp = NULL;
if (!tp || !tp->stop_step || !tp->step_multi)
if (!tp || !tp->control.stop_step || !tp->step_multi)
{
/* If we stopped for some reason that is not stepping
there are no further steps to make. */
@ -935,7 +935,7 @@ step_1_continuation (void *args)
struct thread_info *tp;
tp = inferior_thread ();
if (tp->step_multi && tp->stop_step)
if (tp->step_multi && tp->control.stop_step)
{
/* There are more steps to make, and we did stop due to
ending a stepping range. Do another step. */
@ -993,18 +993,19 @@ step_once (int skip_subroutines, int single_inst, int count, int thread)
pc = get_frame_pc (frame);
find_pc_line_pc_range (pc,
&tp->step_range_start, &tp->step_range_end);
&tp->control.step_range_start,
&tp->control.step_range_end);
/* If we have no line info, switch to stepi mode. */
if (tp->step_range_end == 0 && step_stop_if_no_debug)
tp->step_range_start = tp->step_range_end = 1;
else if (tp->step_range_end == 0)
if (tp->control.step_range_end == 0 && step_stop_if_no_debug)
tp->control.step_range_start = tp->control.step_range_end = 1;
else if (tp->control.step_range_end == 0)
{
char *name;
if (find_pc_partial_function (pc, &name,
&tp->step_range_start,
&tp->step_range_end) == 0)
&tp->control.step_range_start,
&tp->control.step_range_end) == 0)
error (_("Cannot find bounds of current function"));
target_terminal_ours ();
@ -1016,16 +1017,16 @@ which has no line number information.\n"), name);
else
{
/* Say we are stepping, but stop after one insn whatever it does. */
tp->step_range_start = tp->step_range_end = 1;
tp->control.step_range_start = tp->control.step_range_end = 1;
if (!skip_subroutines)
/* It is stepi.
Don't step over function calls, not even to functions lacking
line numbers. */
tp->step_over_calls = STEP_OVER_NONE;
tp->control.step_over_calls = STEP_OVER_NONE;
}
if (skip_subroutines)
tp->step_over_calls = STEP_OVER_ALL;
tp->control.step_over_calls = STEP_OVER_ALL;
tp->step_multi = (count > 1);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
@ -1255,18 +1256,18 @@ until_next_command (int from_tty)
if (msymbol == NULL)
error (_("Execution is not within a known function."));
tp->step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
tp->step_range_end = pc;
tp->control.step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
tp->control.step_range_end = pc;
}
else
{
sal = find_pc_line (pc, 0);
tp->step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
tp->step_range_end = sal.end;
tp->control.step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
tp->control.step_range_end = sal.end;
}
tp->step_over_calls = STEP_OVER_ALL;
tp->control.step_over_calls = STEP_OVER_ALL;
tp->step_multi = 0; /* Only one call to proceed */
@ -1429,7 +1430,7 @@ finish_command_continuation (void *arg)
&& is_stopped (inferior_ptid))
{
tp = inferior_thread ();
bs = tp->stop_bpstat;
bs = tp->control.stop_bpstat;
}
if (bpstat_find_breakpoint (bs, a->breakpoint) != NULL
@ -1460,7 +1461,7 @@ finish_command_continuation (void *arg)
/* We suppress normal call of normal_stop observer and do it here so
that the *stopped notification includes the return value. */
if (bs != NULL && tp->proceed_to_finish)
if (bs != NULL && tp->control.proceed_to_finish)
observer_notify_normal_stop (bs, 1 /* print frame */);
delete_breakpoint (a->breakpoint);
}
@ -1493,7 +1494,7 @@ finish_backward (struct symbol *function)
sal = find_pc_line (func_addr, 0);
/* We don't need a return value. */
tp->proceed_to_finish = 0;
tp->control.proceed_to_finish = 0;
/* Special case: if we're sitting at the function entry point,
then all we need to do is take a reverse singlestep. We
don't need to set a breakpoint, and indeed it would do us
@ -1519,7 +1520,8 @@ finish_backward (struct symbol *function)
old_chain = make_cleanup_delete_breakpoint (breakpoint);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
/* We will be stopped when proceed returns. */
back_up = bpstat_find_breakpoint (tp->stop_bpstat, breakpoint) != NULL;
back_up = (bpstat_find_breakpoint (tp->control.stop_bpstat, breakpoint)
!= NULL);
do_cleanups (old_chain);
}
else
@ -1529,7 +1531,7 @@ finish_backward (struct symbol *function)
/* If in fact we hit the step-resume breakpoint (and not
some other breakpoint), then we're almost there --
we just need to back up by one more single-step. */
tp->step_range_start = tp->step_range_end = 1;
tp->control.step_range_start = tp->control.step_range_end = 1;
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
}
return;
@ -1556,7 +1558,8 @@ finish_forward (struct symbol *function, struct frame_info *frame)
old_chain = make_cleanup_delete_breakpoint (breakpoint);
tp->proceed_to_finish = 1; /* We want stop_registers, please... */
/* We want stop_registers, please... */
tp->control.proceed_to_finish = 1;
cargs = xmalloc (sizeof (*cargs));
cargs->breakpoint = breakpoint;
@ -1632,8 +1635,9 @@ finish_command (char *arg, int from_tty)
init_sal (&empty_sal);
set_step_info (frame, empty_sal);
tp->step_range_start = tp->step_range_end = get_frame_pc (frame);
tp->step_over_calls = STEP_OVER_ALL;
tp->control.step_range_start = get_frame_pc (frame);
tp->control.step_range_end = tp->control.step_range_start;
tp->control.step_over_calls = STEP_OVER_ALL;
/* Print info on the selected frame, including level number but not
source. */
@ -1699,13 +1703,13 @@ program_info (char *args, int from_tty)
error (_("Selected thread is running."));
tp = find_thread_ptid (ptid);
bs = tp->stop_bpstat;
bs = tp->control.stop_bpstat;
stat = bpstat_num (&bs, &num);
target_files_info ();
printf_filtered (_("Program stopped at %s.\n"),
paddress (target_gdbarch, stop_pc));
if (tp->stop_step)
if (tp->control.stop_step)
printf_filtered (_("It stopped after being stepped.\n"));
else if (stat != 0)
{
@ -1723,11 +1727,11 @@ It stopped at a breakpoint that has since been deleted.\n"));
stat = bpstat_num (&bs, &num);
}
}
else if (tp->stop_signal != TARGET_SIGNAL_0)
else if (tp->suspend.stop_signal != TARGET_SIGNAL_0)
{
printf_filtered (_("It stopped with signal %s, %s.\n"),
target_signal_to_name (tp->stop_signal),
target_signal_to_string (tp->stop_signal));
target_signal_to_name (tp->suspend.stop_signal),
target_signal_to_string (tp->suspend.stop_signal));
}
if (!from_tty)
@ -2206,7 +2210,7 @@ proceed_after_attach_callback (struct thread_info *thread,
&& !is_exited (thread->ptid)
&& !is_executing (thread->ptid)
&& !thread->stop_requested
&& thread->stop_signal == TARGET_SIGNAL_0)
&& thread->suspend.stop_signal == TARGET_SIGNAL_0)
{
switch_to_thread (thread->ptid);
clear_proceed_status ();
@ -2256,7 +2260,7 @@ attach_command_post_wait (char *args, int from_tty, int async_exec)
struct inferior *inferior;
inferior = current_inferior ();
inferior->stop_soon = NO_STOP_QUIETLY;
inferior->control.stop_soon = NO_STOP_QUIETLY;
/* If no exec file is yet known, try to determine it from the
process itself. */
@ -2308,7 +2312,7 @@ attach_command_post_wait (char *args, int from_tty, int async_exec)
proceed_after_attach (inferior->pid);
else
{
if (inferior_thread ()->stop_signal == TARGET_SIGNAL_0)
if (inferior_thread ()->suspend.stop_signal == TARGET_SIGNAL_0)
{
clear_proceed_status ();
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
@ -2447,7 +2451,7 @@ attach_command (char *args, int from_tty)
need a way for handle_inferior_event to reset the stop_signal
variable after an attach, and this is what
STOP_QUIETLY_NO_SIGSTOP is for. */
inferior->stop_soon = STOP_QUIETLY_NO_SIGSTOP;
inferior->control.stop_soon = STOP_QUIETLY_NO_SIGSTOP;
if (target_can_async_p ())
{
@ -2510,7 +2514,7 @@ notice_new_inferior (ptid_t ptid, int leave_running, int from_tty)
that. */
target_stop (inferior_ptid);
inferior->stop_soon = STOP_QUIETLY_REMOTE;
inferior->control.stop_soon = STOP_QUIETLY_REMOTE;
/* Wait for stop before proceeding. */
if (target_can_async_p ())

View File

@ -124,7 +124,7 @@ add_inferior_silent (int pid)
memset (inf, 0, sizeof (*inf));
inf->pid = pid;
inf->stop_soon = NO_STOP_QUIETLY;
inf->control.stop_soon = NO_STOP_QUIETLY;
inf->num = ++highest_inferior_num;
inf->next = inferior_list;

View File

@ -43,37 +43,25 @@ struct terminal_info;
#include "progspace.h"
/* Two structures are used to record inferior state.
struct infcall_suspend_state;
struct infcall_control_state;
inferior_thread_state contains state about the program itself like its
registers and any signal it received when it last stopped.
This state must be restored regardless of how the inferior function call
ends (either successfully, or after it hits a breakpoint or signal)
if the program is to properly continue where it left off.
extern struct infcall_suspend_state *save_infcall_suspend_state (void);
extern struct infcall_control_state *save_infcall_control_state (void);
inferior_status contains state regarding gdb's control of the inferior
itself like stepping control. It also contains session state like the
user's currently selected frame.
extern void restore_infcall_suspend_state (struct infcall_suspend_state *);
extern void restore_infcall_control_state (struct infcall_control_state *);
Call these routines around hand called functions, including function calls
in conditional breakpoints for example. */
extern struct cleanup *make_cleanup_restore_infcall_suspend_state
(struct infcall_suspend_state *);
extern struct cleanup *make_cleanup_restore_infcall_control_state
(struct infcall_control_state *);
struct inferior_thread_state;
struct inferior_status;
extern void discard_infcall_suspend_state (struct infcall_suspend_state *);
extern void discard_infcall_control_state (struct infcall_control_state *);
extern struct inferior_thread_state *save_inferior_thread_state (void);
extern struct inferior_status *save_inferior_status (void);
extern void restore_inferior_thread_state (struct inferior_thread_state *);
extern void restore_inferior_status (struct inferior_status *);
extern struct cleanup *make_cleanup_restore_inferior_thread_state (struct inferior_thread_state *);
extern struct cleanup *make_cleanup_restore_inferior_status (struct inferior_status *);
extern void discard_inferior_thread_state (struct inferior_thread_state *);
extern void discard_inferior_status (struct inferior_status *);
extern struct regcache *get_inferior_thread_state_regcache (struct inferior_thread_state *);
extern struct regcache *
get_infcall_suspend_state_regcache (struct infcall_suspend_state *);
/* The -1 ptid, often used to indicate either an error condition
or a "don't care" condition, i.e, "run all threads." */
@ -405,6 +393,24 @@ void displaced_step_dump_bytes (struct ui_file *file,
struct private_inferior;
/* Inferior process specific part of `struct infcall_control_state'.
Inferior thread counterpart is `struct thread_control_state'. */
struct inferior_control_state
{
/* See the definition of stop_kind above. */
enum stop_kind stop_soon;
};
/* Inferior process specific part of `struct infcall_suspend_state'.
Inferior thread counterpart is `struct thread_suspend_state'. */
struct inferior_suspend_state
{
};
/* GDB represents the state of each program execution with an object
called an inferior. An inferior typically corresponds to a process
but is more general and applies also to targets that do not have a
@ -427,6 +433,14 @@ struct inferior
the ptid_t.pid member of threads of this inferior. */
int pid;
/* State of GDB control of inferior process execution.
See `struct inferior_control_state'. */
struct inferior_control_state control;
/* State of inferior process to restore after GDB is done with an inferior
call. See `struct inferior_suspend_state'. */
struct inferior_suspend_state suspend;
/* True if this was an auto-created inferior, e.g. created from
following a fork; false, if this inferior was manually added by
the user, and we should not attempt to prune it
@ -458,9 +472,6 @@ struct inferior
in format described in environ.h. */
struct gdb_environ *environment;
/* See the definition of stop_kind above. */
enum stop_kind stop_soon;
/* Nonzero if this child process was attached rather than
forked. */
int attach_flag;

File diff suppressed because it is too large Load Diff

View File

@ -1648,7 +1648,7 @@ get_pending_status (struct lwp_info *lp, int *status)
{
struct thread_info *tp = find_thread_ptid (lp->ptid);
signo = tp->stop_signal;
signo = tp->suspend.stop_signal;
}
else if (!non_stop)
{
@ -1661,7 +1661,7 @@ get_pending_status (struct lwp_info *lp, int *status)
{
struct thread_info *tp = find_thread_ptid (lp->ptid);
signo = tp->stop_signal;
signo = tp->suspend.stop_signal;
}
}
@ -1917,7 +1917,7 @@ linux_nat_resume (struct target_ops *ops,
/* Defer to common code if we're gaining control of the
inferior. */
if (inf->stop_soon == NO_STOP_QUIETLY
if (inf->control.stop_soon == NO_STOP_QUIETLY
&& signal_stop_state (saved_signo) == 0
&& signal_print_state (saved_signo) == 0
&& signal_pass_state (saved_signo) == 1)
@ -3580,7 +3580,7 @@ retry:
skip the signal handler, or, if we're gaining control of the
inferior. */
if (!lp->step
&& inf->stop_soon == NO_STOP_QUIETLY
&& inf->control.stop_soon == NO_STOP_QUIETLY
&& signal_stop_state (signo) == 0
&& signal_print_state (signo) == 0
&& signal_pass_state (signo) == 1)
@ -4162,7 +4162,7 @@ linux_nat_find_memory_regions (find_memory_region_ftype func, void *obfd)
static int
find_signalled_thread (struct thread_info *info, void *data)
{
if (info->stop_signal != TARGET_SIGNAL_0
if (info->suspend.stop_signal != TARGET_SIGNAL_0
&& ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
return 1;
@ -4176,7 +4176,7 @@ find_stop_signal (void)
iterate_over_threads (find_signalled_thread, NULL);
if (info)
return info->stop_signal;
return info->suspend.stop_signal;
else
return TARGET_SIGNAL_0;
}

View File

@ -434,7 +434,7 @@ mi_about_to_proceed (void)
{
struct thread_info *tp = inferior_thread ();
if (tp->in_infcall)
if (tp->control.in_infcall)
return;
}
@ -477,7 +477,7 @@ mi_on_resume (ptid_t ptid)
tp = find_thread_ptid (ptid);
/* Suppress output while calling an inferior function. */
if (tp->in_infcall)
if (tp->control.in_infcall)
return;
/* To cater for older frontends, emit ^running, but do it only once

View File

@ -2558,7 +2558,7 @@ heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
stop_soon, but with this test, at least we
don't print out warnings for every child forked (eg, on
decstation). 22apr93 rich@cygnus.com. */
if (inf->stop_soon == NO_STOP_QUIETLY)
if (inf->control.stop_soon == NO_STOP_QUIETLY)
{
static int blurb_printed = 0;

View File

@ -5690,7 +5690,7 @@ procfs_corefile_thread_callback (procinfo *pi, procinfo *thread, void *data)
static int
find_signalled_thread (struct thread_info *info, void *data)
{
if (info->stop_signal != TARGET_SIGNAL_0
if (info->suspend.stop_signal != TARGET_SIGNAL_0
&& ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
return 1;
@ -5704,7 +5704,7 @@ find_stop_signal (void)
iterate_over_threads (find_signalled_thread, NULL);
if (info)
return info->stop_signal;
return info->suspend.stop_signal;
else
return TARGET_SIGNAL_0;
}

View File

@ -469,15 +469,15 @@ irix_solib_create_inferior_hook (int from_tty)
clear_proceed_status ();
inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
inf->control.stop_soon = STOP_QUIETLY;
tp->suspend.stop_signal = TARGET_SIGNAL_0;
do
{
target_resume (pid_to_ptid (-1), 0, tp->stop_signal);
target_resume (pid_to_ptid (-1), 0, tp->suspend.stop_signal);
wait_for_inferior (0);
}
while (tp->stop_signal != TARGET_SIGNAL_TRAP);
while (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP);
/* We are now either at the "mapping complete" breakpoint (or somewhere
else, a condition we aren't prepared to deal with anyway), so adjust
@ -496,7 +496,7 @@ irix_solib_create_inferior_hook (int from_tty)
Delaying the resetting of stop_soon until after symbol loading
suppresses the warning. */
solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
inf->stop_soon = NO_STOP_QUIETLY;
inf->control.stop_soon = NO_STOP_QUIETLY;
}
/* LOCAL FUNCTION

View File

@ -340,14 +340,14 @@ osf_solib_create_inferior_hook (int from_tty)
tp = inferior_thread ();
clear_proceed_status ();
inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
inf->control.stop_soon = STOP_QUIETLY;
tp->suspend.stop_signal = TARGET_SIGNAL_0;
do
{
target_resume (minus_one_ptid, 0, tp->stop_signal);
target_resume (minus_one_ptid, 0, tp->suspend.stop_signal);
wait_for_inferior (0);
}
while (tp->stop_signal != TARGET_SIGNAL_TRAP);
while (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP);
/* solib_add will call reinit_frame_cache.
But we are stopped in the runtime loader and we do not have symbols
@ -356,7 +356,7 @@ osf_solib_create_inferior_hook (int from_tty)
Delaying the resetting of stop_soon until after symbol loading
suppresses the warning. */
solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
inf->stop_soon = NO_STOP_QUIETLY;
inf->control.stop_soon = NO_STOP_QUIETLY;
}
/* target_so_ops callback. Do additional symbol handling, lookup, etc. after

View File

@ -85,13 +85,13 @@ spu_skip_standalone_loader (void)
this will step past the first instruction of the stand-alone SPE
executable loader, but we don't care about that. */
inferior_thread ()->in_infcall = 1; /* Suppress MI messages. */
inferior_thread ()->control.in_infcall = 1; /* Suppress MI messages. */
target_resume (inferior_ptid, 1, TARGET_SIGNAL_0);
target_wait (minus_one_ptid, &ws, 0);
set_executing (minus_one_ptid, 0);
inferior_thread ()->in_infcall = 0;
inferior_thread ()->control.in_infcall = 0;
}
}

View File

@ -772,15 +772,15 @@ sunos_solib_create_inferior_hook (int from_tty)
clear_proceed_status ();
inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
inf->control.stop_soon = STOP_QUIETLY;
tp->suspend.stop_signal = TARGET_SIGNAL_0;
do
{
target_resume (pid_to_ptid (-1), 0, tp->stop_signal);
target_resume (pid_to_ptid (-1), 0, tp->suspend.stop_signal);
wait_for_inferior (0);
}
while (tp->stop_signal != TARGET_SIGNAL_TRAP);
inf->stop_soon = NO_STOP_QUIETLY;
while (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP);
inf->control.stop_soon = NO_STOP_QUIETLY;
/* We are now either at the "mapping complete" breakpoint (or somewhere
else, a condition we aren't prepared to deal with anyway), so adjust

View File

@ -2188,15 +2188,15 @@ svr4_solib_create_inferior_hook (int from_tty)
tp = inferior_thread ();
clear_proceed_status ();
inf->stop_soon = STOP_QUIETLY;
tp->stop_signal = TARGET_SIGNAL_0;
inf->control.stop_soon = STOP_QUIETLY;
tp->suspend.stop_signal = TARGET_SIGNAL_0;
do
{
target_resume (pid_to_ptid (-1), 0, tp->stop_signal);
target_resume (pid_to_ptid (-1), 0, tp->suspend.stop_signal);
wait_for_inferior (0);
}
while (tp->stop_signal != TARGET_SIGNAL_TRAP);
inf->stop_soon = NO_STOP_QUIETLY;
while (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP);
inf->control.stop_soon = NO_STOP_QUIETLY;
#endif /* defined(_SCO_DS) */
}

View File

@ -103,7 +103,7 @@ clear_thread_inferior_resources (struct thread_info *tp)
tp->step_resume_breakpoint = NULL;
}
bpstat_clear (&tp->stop_bpstat);
bpstat_clear (&tp->control.stop_bpstat);
discard_all_intermediate_continuations_thread (tp);
discard_all_continuations_thread (tp);

View File

@ -1704,20 +1704,20 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
target_terminal_inferior ();
windows_initialization_done = 0;
inf->stop_soon = STOP_QUIETLY;
inf->control.stop_soon = STOP_QUIETLY;
while (1)
{
stop_after_trap = 1;
wait_for_inferior (0);
tp = inferior_thread ();
if (tp->stop_signal != TARGET_SIGNAL_TRAP)
resume (0, tp->stop_signal);
if (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP)
resume (0, tp->suspend.stop_signal);
else
break;
}
windows_initialization_done = 1;
inf->stop_soon = NO_STOP_QUIETLY;
inf->control.stop_soon = NO_STOP_QUIETLY;
stop_after_trap = 0;
return;
}