[5/9] Switch back to stepped thread: clear step-over info

Message ID 1411691982-10744-6-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Sept. 26, 2014, 12:39 a.m. UTC
  This path misses clearing the step-over info, because it bypasses
keep_going.

The testsuite caught this while I was working on making software
single-step breakpoints per-thread.  Unfortunately, I didn't keep the
logs around and I don't recall ATM which test tripped on this.

gdb/
2014-09-25  Pedro Alves  <palves@redhat.com>

	* infrun.c (switch_back_to_stepped_thread) <expect thread advanced
	also>: Clear step-over info.
---
 gdb/infrun.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Pedro Alves Sept. 30, 2014, 4:33 p.m. UTC | #1
On 09/26/2014 01:39 AM, Pedro Alves wrote:
> This path misses clearing the step-over info, because it bypasses
> keep_going.
> 
> The testsuite caught this while I was working on making software
> single-step breakpoints per-thread.  Unfortunately, I didn't keep the
> logs around and I don't recall ATM which test tripped on this.

Got it.  It's schedlock.exp, what else...

Without this, the previous part of the series fails with:

Running /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.threads/schedlock.exp ...
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 0)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 1)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 2)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 3)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 4)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 5)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 6)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 7)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 8)
FAIL: gdb.threads/schedlock.exp: step to increment (unlocked 9)
...

> 
> gdb/
> 2014-09-25  Pedro Alves  <palves@redhat.com>
> 
> 	* infrun.c (switch_back_to_stepped_thread) <expect thread advanced
> 	also>: Clear step-over info.
> ---
>  gdb/infrun.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index 94a58b2..e0df9bf 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -5275,6 +5275,13 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
>  		fprintf_unfiltered (gdb_stdlog,
>  				    "infrun: expected thread advanced also\n");
>  
> +	      /* Clear this before trying to insert the sss
> +		 breakpoint, in case we were previously trying to step
> +		 over this location in another thread, otherwise the
> +		 breakpoint ends up _not_ installed.  It's what
> +		 keep_going would do too, if we called it.  */
> +	      clear_step_over_info ();
> +
>  	      insert_single_step_breakpoint (get_frame_arch (frame),
>  					     get_frame_address_space (frame),
>  					     stop_pc);
> 


Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 94a58b2..e0df9bf 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5275,6 +5275,13 @@  switch_back_to_stepped_thread (struct execution_control_state *ecs)
 		fprintf_unfiltered (gdb_stdlog,
 				    "infrun: expected thread advanced also\n");
 
+	      /* Clear this before trying to insert the sss
+		 breakpoint, in case we were previously trying to step
+		 over this location in another thread, otherwise the
+		 breakpoint ends up _not_ installed.  It's what
+		 keep_going would do too, if we called it.  */
+	      clear_step_over_info ();
+
 	      insert_single_step_breakpoint (get_frame_arch (frame),
 					     get_frame_address_space (frame),
 					     stop_pc);