public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step
@ 2023-07-03  3:04 zhiyong.yan
  2023-07-10 12:46 ` Alexandra Petlanova Hajkova
  2023-07-11 18:42 ` Kevin Buettner
  0 siblings, 2 replies; 18+ messages in thread
From: zhiyong.yan @ 2023-07-03  3:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: tom, zhiyong.yan

From: Zhiyong Yan <zhiyong.yan@windriver.com>

Gdb should not assume pending threads always generate “a non-gdbserver trap event”, for example “Signal 17” event could happen. Now that resume_stopped_resumed_lwps() -> may_hw_step() assumes that the break point must already exist, resume_one_thread() should ensure the software breaking point is installed although the thread is pending.

Signed-off-by: Zhiyong Yan zhiyong.yan@windriver.com
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30387
---
 gdbserver/linux-low.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index e6a39202a98..7d8bbf71ddc 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -4671,7 +4671,16 @@ linux_process_target::resume_one_thread (thread_info *thread,
       proceed_one_lwp (thread, NULL);
     }
   else
-    threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+    {
+      threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+      if (thread->last_resume_kind == resume_step)
+	{
+	  /* If resume_step is required by GDB, 
+	     install single-step breakpoint.  */
+	  if (supports_software_single_step())
+	    install_software_single_step_breakpoints (lwp);
+	}
+    }
 
   thread->last_status.set_ignore ();
   lwp->resume = NULL;
-- 
2.35.5


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step
@ 2023-07-12  3:19 zhiyong.yan
  0 siblings, 0 replies; 18+ messages in thread
From: zhiyong.yan @ 2023-07-12  3:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: tom, zhiyong.yan

From: Zhiyong Yan <zhiyong.yan@windriver.com>

Gdb should not assume pending threads always generate “a non-gdbserver trap event”, for example “Signal 17” event could happen. Now that resume_stopped_resumed_lwps() -> may_hw_step() assumes that the break point must already exist, resume_one_thread() should ensure the software breaking point is installed although the thread is pending.

Signed-off-by: Zhiyong Yan zhiyong.yan@windriver.com
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30387
---
 gdbserver/linux-low.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index e6a39202a98..d29881174db 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -4671,7 +4671,16 @@ linux_process_target::resume_one_thread (thread_info *thread,
       proceed_one_lwp (thread, NULL);
     }
   else
-    threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+    {
+      threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+      if (thread->last_resume_kind == resume_step)
+	{
+	  /* If resume_step is required by GDB, 
+	     install single-step breakpoint.  */
+	  if (supports_software_single_step ())
+	    install_software_single_step_breakpoints (lwp);
+	}
+    }
 
   thread->last_status.set_ignore ();
   lwp->resume = NULL;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step
@ 2023-07-12  3:25 zhiyong.yan
  2023-07-21 20:49 ` Kevin Buettner
  0 siblings, 1 reply; 18+ messages in thread
From: zhiyong.yan @ 2023-07-12  3:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: luis.machado, kevinb, tom, zhiyong.yan

From: Zhiyong Yan <zhiyong.yan@windriver.com>

Gdb should not assume pending threads always generate “a non-gdbserver trap event”, for example “Signal 17” event could happen. Now that resume_stopped_resumed_lwps() -> may_hw_step() assumes that the break point must already exist, resume_one_thread() should ensure the software breaking point is installed although the thread is pending.

Signed-off-by: Zhiyong Yan zhiyong.yan@windriver.com
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30387
---
 gdbserver/linux-low.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index e6a39202a98..d29881174db 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -4671,7 +4671,16 @@ linux_process_target::resume_one_thread (thread_info *thread,
       proceed_one_lwp (thread, NULL);
     }
   else
-    threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+    {
+      threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+      if (thread->last_resume_kind == resume_step)
+	{
+	  /* If resume_step is required by GDB, 
+	     install single-step breakpoint.  */
+	  if (supports_software_single_step ())
+	    install_software_single_step_breakpoints (lwp);
+	}
+    }
 
   thread->last_status.set_ignore ();
   lwp->resume = NULL;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step
@ 2023-07-12  3:25 zhiyong.yan
  0 siblings, 0 replies; 18+ messages in thread
From: zhiyong.yan @ 2023-07-12  3:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: luis.machado, kevinb, tom, zhiyong.yan

From: Zhiyong Yan <zhiyong.yan@windriver.com>

Gdb should not assume pending threads always generate “a non-gdbserver trap event”, for example “Signal 17” event could happen. Now that resume_stopped_resumed_lwps() -> may_hw_step() assumes that the break point must already exist, resume_one_thread() should ensure the software breaking point is installed although the thread is pending.

Signed-off-by: Zhiyong Yan zhiyong.yan@windriver.com
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30387
---
 gdbserver/linux-low.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index e6a39202a98..d29881174db 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -4671,7 +4671,16 @@ linux_process_target::resume_one_thread (thread_info *thread,
       proceed_one_lwp (thread, NULL);
     }
   else
-    threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+    {
+      threads_debug_printf ("leaving LWP %ld stopped", lwpid_of (thread));
+      if (thread->last_resume_kind == resume_step)
+	{
+	  /* If resume_step is required by GDB, 
+	     install single-step breakpoint.  */
+	  if (supports_software_single_step ())
+	    install_software_single_step_breakpoints (lwp);
+	}
+    }
 
   thread->last_status.set_ignore ();
   lwp->resume = NULL;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-07-26  6:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03  3:04 [PATCH] gdbserver: Install single-step breakpoint for a pending thread whose last_resume_kind is resume_step zhiyong.yan
2023-07-10 12:46 ` Alexandra Petlanova Hajkova
2023-07-11  1:49   ` Yan, Zhiyong
2023-07-11 18:42 ` Kevin Buettner
2023-07-12  2:17   ` Yan, Zhiyong
     [not found]   ` <DS0PR11MB644704609A8C731570939D96E736A@DS0PR11MB6447.namprd11.prod.outlook.com>
2023-07-12  3:29     ` Yan, Zhiyong
2023-07-17  9:35   ` Luis Machado
2023-07-12  3:19 zhiyong.yan
2023-07-12  3:25 zhiyong.yan
2023-07-21 20:49 ` Kevin Buettner
2023-07-24 13:36   ` Yan, Zhiyong
2023-07-25  3:36     ` Kevin Buettner
     [not found]       ` <DS0PR11MB6447E74277EE65464375E086E703A@DS0PR11MB6447.namprd11.prod.outlook.com>
2023-07-25  6:32         ` Kevin Buettner
2023-07-25  6:50           ` Yan, Zhiyong
2023-07-25  7:05             ` Yan, Zhiyong
2023-07-26  3:58               ` Kevin Buettner
2023-07-26  6:30                 ` Yan, Zhiyong
2023-07-12  3:25 zhiyong.yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).