aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/gdbthread.h9
-rw-r--r--gdb/infcmd.c37
-rw-r--r--gdb/inferior.h6
-rw-r--r--gdb/infrun.c26
-rw-r--r--gdb/thread.c8
6 files changed, 64 insertions, 41 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b6b451b..9f924d1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,24 @@
2008-09-08 Pedro Alves <pedro@codesourcery.com>
+ Remove the global step_multi in favour of a per-thread
+ step_multi.
+
+ * inferior.h (step_multi): Delete.
+ * gdbthread.h (struct thread_info): Add comments around
+ step_multi.
+ (save_infrun_state, load_infrun_state): Remove step_multi
+ parameter.
+ * thread.c (load_infrun_state, save_infrun_state): Remove
+ step_multi argument, and references to it.
+ * infcmd.c (step_multi): Delete.
+ (step_1): Adjust.
+ (step_1_continuation, until_next_command): Adjust.
+ * infrun.c (fetch_inferior_event): Adjust.
+ (context_switch): Don't context-switch step_multi.
+ (print_stop_reason, normal_stop): Adjust.
+
+2008-09-08 Pedro Alves <pedro@codesourcery.com>
+
Remove the global stop_signal in favour of a per-thread
stop_signal.
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 3082abf..11581e9 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -147,6 +147,9 @@ struct thread_info
enum step_over_calls_kind step_over_calls;
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;
/* Last signal that the inferior received (why it stopped). */
@@ -224,16 +227,14 @@ extern int thread_count (void);
extern void save_infrun_state (ptid_t ptid,
struct continuation *continuations,
struct continuation *intermediate_continuations,
- int stop_step,
- int step_multi);
+ int stop_step);
/* infrun context switch: load the debugger state previously saved
for the given thread. */
extern void load_infrun_state (ptid_t ptid,
struct continuation **continuations,
struct continuation **intermediate_continuations,
- int *stop_step,
- int *step_multi);
+ int *stop_step);
/* Switch from one thread to another. */
extern void switch_to_thread (ptid_t ptid);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 055b228..afe6d55 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -169,12 +169,6 @@ int stop_stack_dummy;
int stopped_by_random_signal;
-/* 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;
-
/* Environment to use for running inferior,
in format described in environ.h. */
@@ -829,7 +823,7 @@ which has no line number information.\n"), name);
if (skip_subroutines)
tp->step_over_calls = STEP_OVER_ALL;
- step_multi = (count > 1);
+ tp->step_multi = (count > 1);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
if (!stop_step)
@@ -870,16 +864,25 @@ step_1_continuation (void *args)
{
struct step_1_continuation_args *a = args;
- if (!step_multi || !stop_step)
+ if (target_has_execution)
{
- /* If we stopped for some reason that is not stepping there are
- no further steps to make. Cleanup. */
- if (!a->single_inst || a->skip_subroutines)
- delete_longjmp_breakpoint (a->thread);
- step_multi = 0;
+ struct thread_info *tp;
+
+ tp = inferior_thread ();
+ if (tp->step_multi && stop_step)
+ {
+ /* There are more steps to make, and we did stop due to
+ ending a stepping range. Do another step. */
+ step_once (a->skip_subroutines, a->single_inst, a->count - 1, a->thread);
+ return;
+ }
+ tp->step_multi = 0;
}
- else
- step_once (a->skip_subroutines, a->single_inst, a->count - 1, a->thread);
+
+ /* We either stopped for some reason that is not stepping, or there
+ are no further steps to make. Cleanup. */
+ if (!a->single_inst || a->skip_subroutines)
+ delete_longjmp_breakpoint (a->thread);
}
/* Do just one step operation. If count >1 we will have to set up a
@@ -947,7 +950,7 @@ which has no line number information.\n"), name);
if (skip_subroutines)
tp->step_over_calls = STEP_OVER_ALL;
- step_multi = (count > 1);
+ inferior_thread ()->step_multi = (count > 1);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
args = xmalloc (sizeof (*args));
@@ -1178,7 +1181,7 @@ until_next_command (int from_tty)
tp->step_over_calls = STEP_OVER_ALL;
tp->step_frame_id = get_frame_id (frame);
- step_multi = 0; /* Only one call to proceed */
+ tp->step_multi = 0; /* Only one call to proceed */
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
}
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 78af8c2..e29ff4e 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -311,12 +311,6 @@ enum step_over_calls_kind
STEP_OVER_UNDEBUGGABLE
};
-/* If stepping, nonzero means step count is > 1
- so don't print frame next time inferior stops
- if it stops due to stepping. */
-
-extern int step_multi;
-
/* Anything but NO_STOP_QUIETLY means we expect a trap and the caller
will handle it themselves. STOP_QUIETLY is used when running in
the shell before the child program has been exec'd and when running
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d34fc20..e0be5be 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1655,7 +1655,11 @@ fetch_inferior_event (void *client_data)
if (stop_soon == NO_STOP_QUIETLY)
normal_stop ();
- if (step_multi && stop_step)
+ if (target_has_execution
+ && ecs->ws.kind != TARGET_WAITKIND_EXITED
+ && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+ && ecs->event_thread->step_multi
+ && stop_step)
inferior_event_handler (INF_EXEC_CONTINUE, NULL);
else
inferior_event_handler (INF_EXEC_COMPLETE, NULL);
@@ -1738,14 +1742,12 @@ context_switch (ptid_t ptid)
/* Save infrun state for the old thread. */
save_infrun_state (inferior_ptid,
cmd_continuation, intermediate_continuation,
- stop_step,
- step_multi);
+ stop_step);
/* Load infrun state for the new thread. */
load_infrun_state (ptid,
&cmd_continuation, &intermediate_continuation,
- &stop_step,
- &step_multi);
+ &stop_step);
}
switch_to_thread (ptid);
@@ -3663,7 +3665,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
/* For now print nothing. */
/* Print a message only if not in the middle of doing a "step n"
operation for n > 1 */
- if (!step_multi || !stop_step)
+ if (!inferior_thread ()->step_multi || !stop_step)
if (ui_out_is_mi_like_p (uiout))
ui_out_field_string
(uiout, "reason",
@@ -3812,7 +3814,11 @@ Further execution is probably impossible.\n"));
/* Don't print a message if in the middle of doing a "step n"
operation for n > 1 */
- if (step_multi && stop_step)
+ if (target_has_execution
+ && last.kind != TARGET_WAITKIND_SIGNALLED
+ && last.kind != TARGET_WAITKIND_EXITED
+ && inferior_thread ()->step_multi
+ && stop_step)
goto done;
target_terminal_ours ();
@@ -3962,7 +3968,11 @@ Further execution is probably impossible.\n"));
done:
annotate_stopped ();
- if (!suppress_stop_observer && !step_multi)
+ if (!suppress_stop_observer
+ && !(target_has_execution
+ && last.kind != TARGET_WAITKIND_SIGNALLED
+ && last.kind != TARGET_WAITKIND_EXITED
+ && inferior_thread ()->step_multi))
{
if (!ptid_equal (inferior_ptid, null_ptid))
observer_notify_normal_stop (inferior_thread ()->stop_bpstat);
diff --git a/gdb/thread.c b/gdb/thread.c
index 33b4795..a3d85f8 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -445,8 +445,7 @@ void
load_infrun_state (ptid_t ptid,
struct continuation **continuations,
struct continuation **intermediate_continuations,
- int *stop_step,
- int *step_multi)
+ int *stop_step)
{
struct thread_info *tp;
@@ -465,7 +464,6 @@ load_infrun_state (ptid_t ptid,
*intermediate_continuations = tp->intermediate_continuations;
tp->intermediate_continuations = NULL;
*stop_step = tp->stop_step;
- *step_multi = tp->step_multi;
}
}
@@ -475,8 +473,7 @@ void
save_infrun_state (ptid_t ptid,
struct continuation *continuations,
struct continuation *intermediate_continuations,
- int stop_step,
- int step_multi)
+ int stop_step)
{
struct thread_info *tp;
@@ -493,7 +490,6 @@ save_infrun_state (ptid_t ptid,
tp->continuations = continuations;
tp->intermediate_continuations = intermediate_continuations;
tp->stop_step = stop_step;
- tp->step_multi = step_multi;
}
}