public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [GDBserver] step over shouldn't be ongoing in proceed_one_lwp
@ 2016-04-29  8:08 Yao Qi
  2016-05-17  9:15 ` Yao Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Qi @ 2016-04-29  8:08 UTC (permalink / raw)
  To: gdb-patches

Hi,
proceed_one_lwp is called by either unstop_all_lwps or proceed_all_lwps,
and the step over shouldn't be ongoing, either not started or finished,
so the "else if (lwp->bp_reinsert != 0)" looks like a dead code.  This
patch is to remove it, add an assert that "lwp->bp_reinsert == 0", and
remove some comments in proceed_one_lwp.

Regression tested on x86_64-linux and arm-linux.

gdb/gdbserver:

2016-04-29  Yao Qi  <yao.qi@linaro.org>

	* linux-low.c (proceed_one_lwp): Remove comments.  Assert on
	"lwp->bp_reinsert == 0".  Remove code if (lwp->bp_reinsert != 0).
---
 gdb/gdbserver/linux-low.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 8e1e2fc..2737d27 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4943,11 +4943,7 @@ linux_resume (struct thread_resume *resume_info, size_t n)
 /* This function is called once per thread.  We check the thread's
    last resume request, which will tell us whether to resume, step, or
    leave the thread stopped.  Any signal the client requested to be
-   delivered has already been enqueued at this point.
-
-   If any thread that GDB wants running is stopped at an internal
-   breakpoint that needs stepping over, we start a step-over operation
-   on that particular thread, and leave all others stopped.  */
+   delivered has already been enqueued at this point.  */
 
 static int
 proceed_one_lwp (struct inferior_list_entry *entry, void *except)
@@ -5017,6 +5013,9 @@ proceed_one_lwp (struct inferior_list_entry *entry, void *except)
       send_sigstop (lwp);
     }
 
+  /* All step-overs shouldn't be ongoing when proceeding lwps.  */
+  gdb_assert (lwp->bp_reinsert == 0);
+
   if (thread->last_resume_kind == resume_step)
     {
       if (debug_threads)
@@ -5024,13 +5023,6 @@ proceed_one_lwp (struct inferior_list_entry *entry, void *except)
 		      lwpid_of (thread));
       step = 1;
     }
-  else if (lwp->bp_reinsert != 0)
-    {
-      if (debug_threads)
-	debug_printf ("   stepping LWP %ld, reinsert set\n",
-		      lwpid_of (thread));
-      step = 1;
-    }
   else
     step = 0;
 
-- 
1.9.1

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

* Re: [PATCH] [GDBserver] step over shouldn't be ongoing in proceed_one_lwp
  2016-04-29  8:08 [PATCH] [GDBserver] step over shouldn't be ongoing in proceed_one_lwp Yao Qi
@ 2016-05-17  9:15 ` Yao Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Yao Qi @ 2016-05-17  9:15 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Yao Qi <qiyaoltc@gmail.com> writes:

> proceed_one_lwp is called by either unstop_all_lwps or proceed_all_lwps,
> and the step over shouldn't be ongoing, either not started or finished,
> so the "else if (lwp->bp_reinsert != 0)" looks like a dead code.  This
> patch is to remove it, add an assert that "lwp->bp_reinsert == 0", and
> remove some comments in proceed_one_lwp.

The assert added by this patch can be triggered if GDBserver pauses all
lwps (due to requested memory access) when one thread is stepping over a
breakpoint, for example, we have a target-side conditional breakpoint,
continue inferior in background, and request memory access from GDB
(disassemble main).

-- 
Yao (齐尧)

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

end of thread, other threads:[~2016-05-17  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29  8:08 [PATCH] [GDBserver] step over shouldn't be ongoing in proceed_one_lwp Yao Qi
2016-05-17  9:15 ` Yao Qi

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).