|
|
f9426a |
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
f9426a |
|
|
|
f9426a |
* inferior.h (enum resume_step): New definition.
|
|
|
f9426a |
(resume): Change STEP parameter type to ENUM RESUME_STEP.
|
|
|
f9426a |
* infrun.c (resume): Likewise. Extend debug printing of the STEP
|
|
|
f9426a |
parameter. Lock the scheduler only for intentional stepping.
|
|
|
f9426a |
(proceed): Replace the variable ONESTEP with tristate RESUME_STEP.
|
|
|
f9426a |
Set the third RESUME_STEP state according to BPSTAT_SHOULD_STEP.
|
|
|
f9426a |
(currently_stepping): Change the return type to ENUM RESUME_STEP.
|
|
|
f9426a |
Return RESUME_STEP_NEEDED if it is just due to BPSTAT_SHOULD_STEP.
|
|
|
f9426a |
* linux-nat.c (select_singlestep_lwp_callback): Do not focus on
|
|
|
f9426a |
the software watchpoint events.
|
|
|
f9426a |
* linux-nat.h (struct lwp_info): Redeclare STEP as ENUM RESUME_STEP.
|
|
|
f9426a |
|
|
|
f9426a |
2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
f9426a |
|
|
|
f9426a |
* infrun.c (proceed): RESUME_STEP initialized for non-stepping.
|
|
|
f9426a |
RESUME_STEP set according to STEP only at the end of the function.
|
|
|
f9426a |
|
|
|
f9426a |
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
f9426a |
|
|
|
f9426a |
Port to GDB-6.8pre.
|
|
|
f9426a |
|
|
|
f9426a |
Index: gdb-7.7.90.20140613/gdb/infrun.c
|
|
|
f9426a |
===================================================================
|
|
|
f9426a |
--- gdb-7.7.90.20140613.orig/gdb/infrun.c 2014-06-13 03:59:36.000000000 +0200
|
|
|
f9426a |
+++ gdb-7.7.90.20140613/gdb/infrun.c 2014-06-13 21:36:43.637294782 +0200
|
|
|
f9426a |
@@ -84,7 +84,7 @@ static int follow_fork (void);
|
|
|
f9426a |
static void set_schedlock_func (char *args, int from_tty,
|
|
|
f9426a |
struct cmd_list_element *c);
|
|
|
f9426a |
|
|
|
f9426a |
-static int currently_stepping (struct thread_info *tp);
|
|
|
f9426a |
+static enum resume_step currently_stepping (struct thread_info *tp);
|
|
|
f9426a |
|
|
|
f9426a |
static void xdb_handle_command (char *args, int from_tty);
|
|
|
f9426a |
|
|
|
f9426a |
@@ -1742,7 +1742,8 @@ user_visible_resume_ptid (int step)
|
|
|
f9426a |
}
|
|
|
f9426a |
else if ((scheduler_mode == schedlock_on)
|
|
|
f9426a |
|| (scheduler_mode == schedlock_step
|
|
|
f9426a |
- && (step || singlestep_breakpoints_inserted_p)))
|
|
|
f9426a |
+ && (step == RESUME_STEP_USER
|
|
|
f9426a |
+ || singlestep_breakpoints_inserted_p)))
|
|
|
f9426a |
{
|
|
|
f9426a |
/* User-settable 'scheduler' mode requires solo thread resume. */
|
|
|
f9426a |
resume_ptid = inferior_ptid;
|
|
|
f9426a |
@@ -1760,7 +1761,7 @@ user_visible_resume_ptid (int step)
|
|
|
f9426a |
STEP nonzero if we should step (zero to continue instead).
|
|
|
f9426a |
SIG is the signal to give the inferior (zero for none). */
|
|
|
f9426a |
void
|
|
|
f9426a |
-resume (int step, enum gdb_signal sig)
|
|
|
f9426a |
+resume (enum resume_step step, enum gdb_signal sig)
|
|
|
f9426a |
{
|
|
|
f9426a |
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
|
|
|
f9426a |
struct regcache *regcache = get_current_regcache ();
|
|
|
f9426a |
@@ -1800,9 +1801,13 @@ resume (int step, enum gdb_signal sig)
|
|
|
f9426a |
|
|
|
f9426a |
if (debug_infrun)
|
|
|
f9426a |
fprintf_unfiltered (gdb_stdlog,
|
|
|
f9426a |
- "infrun: resume (step=%d, signal=%s), "
|
|
|
f9426a |
+ "infrun: resume (step=%s, signal=%s), "
|
|
|
f9426a |
"trap_expected=%d, current thread [%s] at %s\n",
|
|
|
f9426a |
- step, gdb_signal_to_symbol_string (sig),
|
|
|
f9426a |
+ (step == RESUME_STEP_CONTINUE
|
|
|
f9426a |
+ ? "RESUME_STEP_CONTINUE"
|
|
|
f9426a |
+ : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
|
|
|
f9426a |
+ : "RESUME_STEP_NEEDED")),
|
|
|
f9426a |
+ gdb_signal_to_symbol_string (sig),
|
|
|
f9426a |
tp->control.trap_expected,
|
|
|
f9426a |
target_pid_to_str (inferior_ptid),
|
|
|
f9426a |
paddress (gdbarch, pc));
|
|
|
f9426a |
@@ -2188,6 +2193,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
|
|
f9426a |
struct thread_info *tp;
|
|
|
f9426a |
CORE_ADDR pc;
|
|
|
f9426a |
struct address_space *aspace;
|
|
|
f9426a |
+ enum resume_step resume_step = RESUME_STEP_CONTINUE;
|
|
|
f9426a |
|
|
|
f9426a |
/* If we're stopped at a fork/vfork, follow the branch set by the
|
|
|
f9426a |
"set follow-fork-mode" command; otherwise, we'll just proceed
|
|
|
f9426a |
@@ -2230,13 +2236,19 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
|
|
f9426a |
Note, we don't do this in reverse, because we won't
|
|
|
f9426a |
actually be executing the breakpoint insn anyway.
|
|
|
f9426a |
We'll be (un-)executing the previous instruction. */
|
|
|
f9426a |
+ {
|
|
|
f9426a |
tp->stepping_over_breakpoint = 1;
|
|
|
f9426a |
+ resume_step = RESUME_STEP_USER;
|
|
|
f9426a |
+ }
|
|
|
f9426a |
else if (gdbarch_single_step_through_delay_p (gdbarch)
|
|
|
f9426a |
&& gdbarch_single_step_through_delay (gdbarch,
|
|
|
f9426a |
get_current_frame ()))
|
|
|
f9426a |
/* We stepped onto an instruction that needs to be stepped
|
|
|
f9426a |
again before re-inserting the breakpoint, do so. */
|
|
|
f9426a |
+ {
|
|
|
f9426a |
tp->stepping_over_breakpoint = 1;
|
|
|
f9426a |
+ resume_step = RESUME_STEP_USER;
|
|
|
f9426a |
+ }
|
|
|
f9426a |
}
|
|
|
f9426a |
else
|
|
|
f9426a |
{
|
|
|
f9426a |
@@ -2288,6 +2300,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
|
|
f9426a |
tp->prev_pc = regcache_read_pc (get_current_regcache ());
|
|
|
f9426a |
switch_to_thread (step_over->ptid);
|
|
|
f9426a |
tp = step_over;
|
|
|
f9426a |
+ resume_step = RESUME_STEP_USER;
|
|
|
f9426a |
}
|
|
|
f9426a |
}
|
|
|
f9426a |
|
|
|
f9426a |
@@ -2375,9 +2388,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
|
|
|
f9426a |
/* Reset to normal state. */
|
|
|
f9426a |
init_infwait_state ();
|
|
|
f9426a |
|
|
|
f9426a |
+ if (tp->control.trap_expected || step)
|
|
|
f9426a |
+ resume_step = RESUME_STEP_USER;
|
|
|
f9426a |
+ if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ())
|
|
|
f9426a |
+ resume_step = RESUME_STEP_NEEDED;
|
|
|
f9426a |
+
|
|
|
f9426a |
/* Resume inferior. */
|
|
|
f9426a |
- resume (tp->control.trap_expected || step || bpstat_should_step (),
|
|
|
f9426a |
- tp->suspend.stop_signal);
|
|
|
f9426a |
+ resume (resume_step, tp->suspend.stop_signal);
|
|
|
f9426a |
|
|
|
f9426a |
/* Wait for it to stop (if not standalone)
|
|
|
f9426a |
and in any case decode why it stopped, and act accordingly. */
|
|
|
f9426a |
@@ -5359,13 +5376,16 @@ switch_back_to_stepped_thread (struct ex
|
|
|
f9426a |
|
|
|
f9426a |
/* Is thread TP in the middle of single-stepping? */
|
|
|
f9426a |
|
|
|
f9426a |
-static int
|
|
|
f9426a |
+static enum resume_step
|
|
|
f9426a |
currently_stepping (struct thread_info *tp)
|
|
|
f9426a |
{
|
|
|
f9426a |
- return ((tp->control.step_range_end
|
|
|
f9426a |
+ if ((tp->control.step_range_end
|
|
|
f9426a |
&& tp->control.step_resume_breakpoint == NULL)
|
|
|
f9426a |
- || tp->control.trap_expected
|
|
|
f9426a |
- || bpstat_should_step ());
|
|
|
f9426a |
+ || tp->control.trap_expected)
|
|
|
f9426a |
+ return RESUME_STEP_USER;
|
|
|
f9426a |
+ if (bpstat_should_step ())
|
|
|
f9426a |
+ return RESUME_STEP_NEEDED;
|
|
|
f9426a |
+ return RESUME_STEP_CONTINUE;
|
|
|
f9426a |
}
|
|
|
f9426a |
|
|
|
f9426a |
/* Inferior has stepped into a subroutine call with source code that
|
|
|
f9426a |
Index: gdb-7.7.90.20140613/gdb/linux-nat.c
|
|
|
f9426a |
===================================================================
|
|
|
f9426a |
--- gdb-7.7.90.20140613.orig/gdb/linux-nat.c 2014-06-13 03:59:37.000000000 +0200
|
|
|
f9426a |
+++ gdb-7.7.90.20140613/gdb/linux-nat.c 2014-06-13 21:31:19.449949814 +0200
|
|
|
f9426a |
@@ -2709,7 +2709,11 @@ static int
|
|
|
f9426a |
select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
|
|
|
f9426a |
{
|
|
|
f9426a |
if (lp->last_resume_kind == resume_step
|
|
|
f9426a |
- && lp->status != 0)
|
|
|
f9426a |
+ && lp->status != 0
|
|
|
f9426a |
+ /* We do not focus on software watchpoints as we would not catch
|
|
|
f9426a |
+ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
|
|
|
f9426a |
+ as they would remain pending due to `Push back breakpoint for %s'. */
|
|
|
f9426a |
+ && lp->step == RESUME_STEP_USER)
|
|
|
f9426a |
return 1;
|
|
|
f9426a |
else
|
|
|
f9426a |
return 0;
|
|
|
f9426a |
Index: gdb-7.7.90.20140613/gdb/linux-nat.h
|
|
|
f9426a |
===================================================================
|
|
|
f9426a |
--- gdb-7.7.90.20140613.orig/gdb/linux-nat.h 2014-06-13 03:59:37.000000000 +0200
|
|
|
f9426a |
+++ gdb-7.7.90.20140613/gdb/linux-nat.h 2014-06-13 21:31:19.449949814 +0200
|
|
|
f9426a |
@@ -18,6 +18,7 @@
|
|
|
f9426a |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
f9426a |
|
|
|
f9426a |
#include "target.h"
|
|
|
f9426a |
+#include "infrun.h"
|
|
|
f9426a |
|
|
|
f9426a |
#include <signal.h>
|
|
|
f9426a |
|
|
|
f9426a |
@@ -59,8 +60,8 @@ struct lwp_info
|
|
|
f9426a |
/* If non-zero, a pending wait status. */
|
|
|
f9426a |
int status;
|
|
|
f9426a |
|
|
|
f9426a |
- /* Non-zero if we were stepping this LWP. */
|
|
|
f9426a |
- int step;
|
|
|
f9426a |
+ /* The kind of stepping of this LWP. */
|
|
|
f9426a |
+ enum resume_step step;
|
|
|
f9426a |
|
|
|
f9426a |
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
|
|
|
f9426a |
watchpoint trap. */
|
|
|
f9426a |
Index: gdb-7.7.90.20140613/gdb/infrun.h
|
|
|
f9426a |
===================================================================
|
|
|
f9426a |
--- gdb-7.7.90.20140613.orig/gdb/infrun.h 2014-06-13 03:59:36.000000000 +0200
|
|
|
f9426a |
+++ gdb-7.7.90.20140613/gdb/infrun.h 2014-06-13 21:31:19.449949814 +0200
|
|
|
f9426a |
@@ -89,7 +89,14 @@ extern void proceed (CORE_ADDR, enum gdb
|
|
|
f9426a |
|
|
|
f9426a |
/* The `resume' routine should only be called in special circumstances.
|
|
|
f9426a |
Normally, use `proceed', which handles a lot of bookkeeping. */
|
|
|
f9426a |
-extern void resume (int, enum gdb_signal);
|
|
|
f9426a |
+enum resume_step
|
|
|
f9426a |
+ {
|
|
|
f9426a |
+ /* currently_stepping () should return non-zero for non-continue. */
|
|
|
f9426a |
+ RESUME_STEP_CONTINUE = 0,
|
|
|
f9426a |
+ RESUME_STEP_USER, /* Stepping is intentional by the user. */
|
|
|
f9426a |
+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */
|
|
|
f9426a |
+ };
|
|
|
f9426a |
+extern void resume (enum resume_step, enum gdb_signal);
|
|
|
f9426a |
|
|
|
f9426a |
extern ptid_t user_visible_resume_ptid (int step);
|
|
|
f9426a |
|
|
|
f9426a |
diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
|
|
|
f9426a |
index 2a30604..ee1fd11 100644
|
|
|
f9426a |
--- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
|
|
|
f9426a |
+++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp
|
|
|
f9426a |
@@ -97,7 +97,7 @@ gdb_test "set debug infrun 1"
|
|
|
f9426a |
|
|
|
f9426a |
gdb_test \
|
|
|
f9426a |
"step" \
|
|
|
f9426a |
- ".*need to step-over.*resume \\(step=1.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
|
|
|
f9426a |
+ ".*need to step-over.*resume \\(step=RESUME_STEP_USER.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \
|
|
|
f9426a |
"step"
|
|
|
f9426a |
|
|
|
f9426a |
set cnt_after [get_value "args\[$my_number\]" "get count after step"]
|