[v3,5/7] fix issue: gdb hangs in the command following a commad returning with TARGET_WAITKIND_NO_HISTORY

Message ID 20210331025234.518688-6-zied.guermazi@trande.de
State Superseded
Headers show
Series
  • extend branch tracing to use ARM CoreSight traces
Related show

Commit Message

Zied Guermazi March 31, 2021, 2:52 a.m.
This patch fixes an issue observed with btrace when replaying the execution.
The issue was observed on ARMv7 processors.
To reproduce the issue, the user needs to replay in forward direction 
until he reaches the end of history, then replay backwards 
(e.g a reverse-next) and then replay forwards. gdb hangs and the user
can not issue new commands.
This fix keeps the same behaviour of gdb as when TARGET_WAITKIND_NO_HISTORY
is hit on other architectures.

gdb/ChangeLog

	* infrun.c (set_step_over_info): add debug print.
	(handle_inferior_event): clear step over info 
	in case TARGET_WAITKIND_NO_HISTORY

---
 gdb/ChangeLog | 6 ++++++
 gdb/infrun.c  | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

-- 
2.25.1

Comments

Luis Machado via Gdb-patches April 1, 2021, 12:18 p.m. | #1
On 3/30/21 11:52 PM, Zied Guermazi wrote:
> 

> This patch fixes an issue observed with btrace when replaying the execution.

> The issue was observed on ARMv7 processors.

> To reproduce the issue, the user needs to replay in forward direction

> until he reaches the end of history, then replay backwards

> (e.g a reverse-next) and then replay forwards. gdb hangs and the user

> can not issue new commands.

> This fix keeps the same behaviour of gdb as when TARGET_WAITKIND_NO_HISTORY

> is hit on other architectures.

> 

> gdb/ChangeLog

> 

> 	* infrun.c (set_step_over_info): add debug print.

> 	(handle_inferior_event): clear step over info

> 	in case TARGET_WAITKIND_NO_HISTORY

> 

> ---

>   gdb/ChangeLog | 6 ++++++

>   gdb/infrun.c  | 3 ++-

>   2 files changed, 8 insertions(+), 1 deletion(-)

> 

> diff --git a/gdb/ChangeLog b/gdb/ChangeLog

> index d22ec8b5976..d4ed6fe0255 100644

> --- a/gdb/ChangeLog

> +++ b/gdb/ChangeLog

> @@ -1,3 +1,9 @@

> +2021-02-25  Zied Guermazi  <zied.guermazi@trande.de>

> +

> +	* infrun.c (set_step_over_info): add debug print.

> +	(handle_inferior_event): clear step over info

> +	in case TARGET_WAITKIND_NO_HISTORY

> +

>   2021-02-25  Zied Guermazi  <zied.guermazi@trande.de>

>   

>   	* nat/linux-btrace.h (btrace_tinfo_etm): New.

> diff --git a/gdb/infrun.c b/gdb/infrun.c

> index a271220b261..9c2522376f2 100644

> --- a/gdb/infrun.c

> +++ b/gdb/infrun.c

> @@ -1308,6 +1308,7 @@ set_step_over_info (const address_space *aspace, CORE_ADDR address,

>   		    int nonsteppable_watchpoint_p,

>   		    int thread)

>   {

> +  infrun_debug_printf ("setting step over info");

>     step_over_info.aspace = aspace;

>     step_over_info.address = address;

>     step_over_info.nonsteppable_watchpoint_p = nonsteppable_watchpoint_p;

> @@ -5536,7 +5537,7 @@ handle_inferior_event (struct execution_control_state *ecs)

>         delete_just_stopped_threads_single_step_breakpoints ();

>         ecs->event_thread->suspend.stop_pc

>   	= regcache_read_pc (get_thread_regcache (inferior_thread ()));

> -

> +      clear_step_over_info ();

>         if (handle_stop_requested (ecs))

>   	return;

>   

> 


I'll defer this to folks more familiar with the infrun code, but this is 
one area that needs to be exercised carefully, as it is really complex 
with many execution paths.

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d22ec8b5976..d4ed6fe0255 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@ 
+2021-02-25  Zied Guermazi  <zied.guermazi@trande.de>
+
+	* infrun.c (set_step_over_info): add debug print.
+	(handle_inferior_event): clear step over info
+	in case TARGET_WAITKIND_NO_HISTORY
+
 2021-02-25  Zied Guermazi  <zied.guermazi@trande.de>
 
 	* nat/linux-btrace.h (btrace_tinfo_etm): New.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a271220b261..9c2522376f2 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1308,6 +1308,7 @@  set_step_over_info (const address_space *aspace, CORE_ADDR address,
 		    int nonsteppable_watchpoint_p,
 		    int thread)
 {
+  infrun_debug_printf ("setting step over info");
   step_over_info.aspace = aspace;
   step_over_info.address = address;
   step_over_info.nonsteppable_watchpoint_p = nonsteppable_watchpoint_p;
@@ -5536,7 +5537,7 @@  handle_inferior_event (struct execution_control_state *ecs)
       delete_just_stopped_threads_single_step_breakpoints ();
       ecs->event_thread->suspend.stop_pc
 	= regcache_read_pc (get_thread_regcache (inferior_thread ()));
-
+      clear_step_over_info ();
       if (handle_stop_requested (ecs))
 	return;