2007-06-26 04:37:05 +00:00
|
|
|
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
* inferior.h (enum resume_step): New definition.
|
|
|
|
(resume): Change STEP parameter type to ENUM RESUME_STEP.
|
|
|
|
* infrun.c (resume): Likewise. Extend debug printing of the STEP
|
|
|
|
parameter. Lock the scheduler only for intentional stepping.
|
|
|
|
(proceed): Replace the variable ONESTEP with tristate RESUME_STEP.
|
|
|
|
Set the third RESUME_STEP state according to BPSTAT_SHOULD_STEP.
|
|
|
|
(currently_stepping): Change the return type to ENUM RESUME_STEP.
|
|
|
|
Return RESUME_STEP_NEEDED if it is just due to BPSTAT_SHOULD_STEP.
|
|
|
|
* linux-nat.c (select_singlestep_lwp_callback): Do not focus on
|
|
|
|
the software watchpoint events.
|
|
|
|
* linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.
|
|
|
|
|
2007-10-19 00:12:58 +00:00
|
|
|
2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
* infrun.c (proceed): RESUME_STEP initialized for non-stepping.
|
|
|
|
RESUME_STEP set according to STEP only at the end of the function.
|
|
|
|
|
2008-03-03 16:13:47 +00:00
|
|
|
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
Port to GDB-6.8pre.
|
|
|
|
|
2014-02-07 18:38:14 +00:00
|
|
|
Index: gdb-7.6.90.20140127/gdb/inferior.h
|
2008-03-03 16:13:47 +00:00
|
|
|
===================================================================
|
2014-02-07 18:38:14 +00:00
|
|
|
--- gdb-7.6.90.20140127.orig/gdb/inferior.h 2014-01-27 22:05:28.801895347 +0100
|
|
|
|
+++ gdb-7.6.90.20140127/gdb/inferior.h 2014-01-27 22:33:45.230157813 +0100
|
|
|
|
@@ -155,7 +155,15 @@ extern void reopen_exec_file (void);
|
2007-06-21 05:22:01 +00:00
|
|
|
/* The `resume' routine should only be called in special circumstances.
|
|
|
|
Normally, use `proceed', which handles a lot of bookkeeping. */
|
|
|
|
|
2012-06-03 17:40:44 +00:00
|
|
|
-extern void resume (int, enum gdb_signal);
|
2007-06-21 05:22:01 +00:00
|
|
|
+enum resume_step
|
|
|
|
+ {
|
|
|
|
+ /* currently_stepping () should return non-zero for non-continue. */
|
|
|
|
+ RESUME_STEP_CONTINUE = 0,
|
|
|
|
+ RESUME_STEP_USER, /* Stepping is intentional by the user. */
|
|
|
|
+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */
|
|
|
|
+ };
|
|
|
|
+
|
2012-06-03 17:40:44 +00:00
|
|
|
+extern void resume (enum resume_step, enum gdb_signal);
|
2007-06-21 05:22:01 +00:00
|
|
|
|
2011-07-22 22:41:56 +00:00
|
|
|
extern ptid_t user_visible_resume_ptid (int step);
|
2007-06-21 05:22:01 +00:00
|
|
|
|
2014-02-07 18:38:14 +00:00
|
|
|
Index: gdb-7.6.90.20140127/gdb/infrun.c
|
2008-03-03 16:13:47 +00:00
|
|
|
===================================================================
|
2014-02-07 18:38:14 +00:00
|
|
|
--- gdb-7.6.90.20140127.orig/gdb/infrun.c 2014-01-27 22:05:28.804895349 +0100
|
|
|
|
+++ gdb-7.6.90.20140127/gdb/infrun.c 2014-01-27 22:35:12.781224279 +0100
|
|
|
|
@@ -83,7 +83,7 @@ static int follow_fork (void);
|
2008-12-14 14:05:20 +00:00
|
|
|
static void set_schedlock_func (char *args, int from_tty,
|
|
|
|
struct cmd_list_element *c);
|
2007-06-21 05:22:01 +00:00
|
|
|
|
2008-12-14 14:05:20 +00:00
|
|
|
-static int currently_stepping (struct thread_info *tp);
|
|
|
|
+static enum resume_step currently_stepping (struct thread_info *tp);
|
2007-06-21 05:22:01 +00:00
|
|
|
|
2009-08-04 05:37:29 +00:00
|
|
|
static int currently_stepping_or_nexting_callback (struct thread_info *tp,
|
|
|
|
void *data);
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -1699,7 +1699,8 @@ user_visible_resume_ptid (int step)
|
2011-07-22 22:41:56 +00:00
|
|
|
}
|
|
|
|
else if ((scheduler_mode == schedlock_on)
|
|
|
|
|| (scheduler_mode == schedlock_step
|
|
|
|
- && (step || singlestep_breakpoints_inserted_p)))
|
|
|
|
+ && (step == RESUME_STEP_USER
|
|
|
|
+ || singlestep_breakpoints_inserted_p)))
|
|
|
|
{
|
|
|
|
/* User-settable 'scheduler' mode requires solo thread resume. */
|
|
|
|
resume_ptid = inferior_ptid;
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -1717,7 +1718,7 @@ user_visible_resume_ptid (int step)
|
2007-06-21 05:22:01 +00:00
|
|
|
STEP nonzero if we should step (zero to continue instead).
|
|
|
|
SIG is the signal to give the inferior (zero for none). */
|
|
|
|
void
|
2012-06-03 17:40:44 +00:00
|
|
|
-resume (int step, enum gdb_signal sig)
|
|
|
|
+resume (enum resume_step step, enum gdb_signal sig)
|
2007-06-21 05:22:01 +00:00
|
|
|
{
|
|
|
|
int should_resume = 1;
|
|
|
|
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -1750,9 +1751,13 @@ resume (int step, enum gdb_signal sig)
|
2007-06-21 05:22:01 +00:00
|
|
|
|
|
|
|
if (debug_infrun)
|
2011-07-22 22:41:56 +00:00
|
|
|
fprintf_unfiltered (gdb_stdlog,
|
2014-02-07 18:38:14 +00:00
|
|
|
- "infrun: resume (step=%d, signal=%s), "
|
|
|
|
+ "infrun: resume (step=%s, signal=%s), "
|
2011-07-22 22:41:56 +00:00
|
|
|
"trap_expected=%d, current thread [%s] at %s\n",
|
2014-02-07 18:38:14 +00:00
|
|
|
- step, gdb_signal_to_symbol_string (sig),
|
2011-07-22 22:41:56 +00:00
|
|
|
+ (step == RESUME_STEP_CONTINUE
|
|
|
|
+ ? "RESUME_STEP_CONTINUE"
|
|
|
|
+ : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
|
|
|
|
+ : "RESUME_STEP_NEEDED")),
|
2014-02-07 18:38:14 +00:00
|
|
|
+ gdb_signal_to_symbol_string (sig),
|
|
|
|
tp->control.trap_expected,
|
2011-07-22 22:41:56 +00:00
|
|
|
target_pid_to_str (inferior_ptid),
|
|
|
|
paddress (gdbarch, pc));
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -2147,7 +2152,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
2009-08-04 05:37:29 +00:00
|
|
|
CORE_ADDR pc;
|
2010-01-16 22:32:10 +00:00
|
|
|
struct address_space *aspace;
|
2013-02-18 17:14:00 +00:00
|
|
|
/* GDB may force the inferior to step due to various reasons. */
|
|
|
|
- int force_step = 0;
|
2007-10-19 00:12:58 +00:00
|
|
|
+ enum resume_step resume_step = RESUME_STEP_CONTINUE;
|
2007-06-21 05:22:01 +00:00
|
|
|
|
2009-08-04 05:37:29 +00:00
|
|
|
/* If we're stopped at a fork/vfork, follow the branch set by the
|
|
|
|
"set follow-fork-mode" command; otherwise, we'll just proceed
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -2187,13 +2192,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
2008-12-14 14:05:20 +00:00
|
|
|
actually be executing the breakpoint insn anyway.
|
|
|
|
We'll be (un-)executing the previous instruction. */
|
|
|
|
|
2013-02-18 17:14:00 +00:00
|
|
|
- force_step = 1;
|
2007-06-21 05:22:01 +00:00
|
|
|
+ resume_step = RESUME_STEP_USER;
|
2008-12-14 14:05:20 +00:00
|
|
|
else if (gdbarch_single_step_through_delay_p (gdbarch)
|
|
|
|
&& gdbarch_single_step_through_delay (gdbarch,
|
|
|
|
get_current_frame ()))
|
2007-06-21 05:22:01 +00:00
|
|
|
/* We stepped onto an instruction that needs to be stepped
|
|
|
|
again before re-inserting the breakpoint, do so. */
|
2013-02-18 17:14:00 +00:00
|
|
|
- force_step = 1;
|
2007-06-21 05:22:01 +00:00
|
|
|
+ resume_step = RESUME_STEP_USER;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -2225,13 +2230,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
2008-12-14 14:05:20 +00:00
|
|
|
is required it returns TRUE and sets the current thread to
|
2011-01-17 15:31:43 +00:00
|
|
|
the old thread. */
|
2008-12-14 14:05:20 +00:00
|
|
|
if (prepare_to_proceed (step))
|
2013-02-18 17:14:00 +00:00
|
|
|
- force_step = 1;
|
2008-12-14 14:05:20 +00:00
|
|
|
+ resume_step = RESUME_STEP_USER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* prepare_to_proceed may change the current thread. */
|
|
|
|
tp = inferior_thread ();
|
2007-06-21 05:22:01 +00:00
|
|
|
|
2013-02-18 17:14:00 +00:00
|
|
|
- if (force_step)
|
2007-06-21 05:22:01 +00:00
|
|
|
+ if (resume_step == RESUME_STEP_USER)
|
2008-12-14 14:05:20 +00:00
|
|
|
{
|
2011-01-01 00:27:30 +00:00
|
|
|
tp->control.trap_expected = 1;
|
2008-12-14 14:05:20 +00:00
|
|
|
/* If displaced stepping is enabled, we can step over the
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -2318,9 +2323,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
2008-12-14 14:05:20 +00:00
|
|
|
/* Reset to normal state. */
|
|
|
|
init_infwait_state ();
|
2007-06-21 05:22:01 +00:00
|
|
|
|
2007-10-19 00:12:58 +00:00
|
|
|
+ if (step)
|
|
|
|
+ resume_step = RESUME_STEP_USER;
|
2007-06-21 05:22:01 +00:00
|
|
|
+ if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
|
|
|
|
+ resume_step = RESUME_STEP_NEEDED;
|
|
|
|
+
|
|
|
|
/* Resume inferior. */
|
2013-02-18 17:14:00 +00:00
|
|
|
- resume (force_step || step || bpstat_should_step (),
|
|
|
|
- tp->suspend.stop_signal);
|
2011-01-01 00:27:30 +00:00
|
|
|
+ resume (resume_step, tp->suspend.stop_signal);
|
2007-06-21 05:22:01 +00:00
|
|
|
|
|
|
|
/* Wait for it to stop (if not standalone)
|
|
|
|
and in any case decode why it stopped, and act accordingly. */
|
2014-02-07 18:38:14 +00:00
|
|
|
@@ -5332,13 +5341,18 @@ switch_back_to_stepped_thread (struct ex
|
2009-08-04 05:37:29 +00:00
|
|
|
|
|
|
|
/* Is thread TP in the middle of single-stepping? */
|
2007-06-21 05:22:01 +00:00
|
|
|
|
|
|
|
-static int
|
|
|
|
+static enum resume_step
|
2008-12-14 14:05:20 +00:00
|
|
|
currently_stepping (struct thread_info *tp)
|
2007-06-21 05:22:01 +00:00
|
|
|
{
|
2011-01-01 00:27:30 +00:00
|
|
|
- return ((tp->control.step_range_end
|
|
|
|
- && tp->control.step_resume_breakpoint == NULL)
|
|
|
|
- || tp->control.trap_expected
|
|
|
|
- || bpstat_should_step ());
|
|
|
|
+ if ((tp->control.step_range_end
|
|
|
|
+ && tp->control.step_resume_breakpoint == NULL)
|
2012-01-03 15:00:12 +00:00
|
|
|
+ || tp->control.trap_expected)
|
2007-06-21 05:22:01 +00:00
|
|
|
+ return RESUME_STEP_USER;
|
|
|
|
+
|
|
|
|
+ if (bpstat_should_step ())
|
|
|
|
+ return RESUME_STEP_NEEDED;
|
|
|
|
+
|
|
|
|
+ return RESUME_STEP_CONTINUE;
|
|
|
|
}
|
|
|
|
|
2009-08-04 05:37:29 +00:00
|
|
|
/* Returns true if any thread *but* the one passed in "data" is in the
|
2014-02-07 18:38:14 +00:00
|
|
|
Index: gdb-7.6.90.20140127/gdb/linux-nat.c
|
2008-03-03 16:13:47 +00:00
|
|
|
===================================================================
|
2014-02-07 18:38:14 +00:00
|
|
|
--- gdb-7.6.90.20140127.orig/gdb/linux-nat.c 2014-01-27 22:05:28.806895350 +0100
|
|
|
|
+++ gdb-7.6.90.20140127/gdb/linux-nat.c 2014-01-27 22:33:45.330157889 +0100
|
|
|
|
@@ -2697,7 +2697,11 @@ static int
|
2007-06-26 04:37:05 +00:00
|
|
|
select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
|
|
|
|
{
|
2012-01-03 15:00:12 +00:00
|
|
|
if (lp->last_resume_kind == resume_step
|
|
|
|
- && lp->status != 0)
|
|
|
|
+ && lp->status != 0
|
|
|
|
+ /* We do not focus on software watchpoints as we would not catch
|
|
|
|
+ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
|
|
|
|
+ as they would remain pending due to `Push back breakpoint for %s'. */
|
|
|
|
+ && lp->step == RESUME_STEP_USER)
|
2007-06-26 04:37:05 +00:00
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2014-02-07 18:38:14 +00:00
|
|
|
Index: gdb-7.6.90.20140127/gdb/linux-nat.h
|
2008-03-03 16:13:47 +00:00
|
|
|
===================================================================
|
2014-02-07 18:38:14 +00:00
|
|
|
--- gdb-7.6.90.20140127.orig/gdb/linux-nat.h 2014-01-27 22:05:28.807895351 +0100
|
|
|
|
+++ gdb-7.6.90.20140127/gdb/linux-nat.h 2014-01-27 22:33:45.334157892 +0100
|
|
|
|
@@ -59,8 +59,8 @@ struct lwp_info
|
2007-06-26 04:37:05 +00:00
|
|
|
/* If non-zero, a pending wait status. */
|
|
|
|
int status;
|
|
|
|
|
|
|
|
- /* Non-zero if we were stepping this LWP. */
|
|
|
|
- int step;
|
|
|
|
+ /* The kind of stepping of this LWP. */
|
|
|
|
+ enum resume_step step;
|
|
|
|
|
2012-07-15 08:41:46 +00:00
|
|
|
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
|
|
|
|
watchpoint trap. */
|