public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] Refactor function set_step_over_info
Date: Fri, 15 Apr 2016 13:29:00 -0000	[thread overview]
Message-ID: <1460726961-27486-2-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1460726961-27486-1-git-send-email-yao.qi@linaro.org>

This patch replace two parameters of set_step_over_info (aspace and
address) with one (thread).

gdb:

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

	* infrun.c (set_step_over_info): Remove parameter aspace and
	address.  Add thread.  Set field aspace and address.
	Callers updated.
	(keep_going_pass_signal): Remove local variable regcache.
---
 gdb/infrun.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 696105d..9017b0a 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1325,14 +1325,24 @@ struct step_over_info
 static struct step_over_info step_over_info;
 
 /* Record the address of the breakpoint/instruction we're currently
-   stepping over.  */
+   stepping over THREAD.  */
 
 static void
-set_step_over_info (struct address_space *aspace, CORE_ADDR address,
+set_step_over_info (struct thread_info *thread,
 		    int nonsteppable_watchpoint_p)
 {
-  step_over_info.aspace = aspace;
-  step_over_info.address = address;
+  if (thread != NULL)
+    {
+      struct regcache *regcache = get_thread_regcache (thread->ptid);
+
+      step_over_info.aspace = get_regcache_aspace (regcache);
+      step_over_info.address = regcache_read_pc (regcache);
+    }
+  else
+    {
+      step_over_info.aspace = NULL;
+      step_over_info.address = 0;
+    }
   step_over_info.nonsteppable_watchpoint_p = nonsteppable_watchpoint_p;
 }
 
@@ -2578,8 +2588,7 @@ resume (enum gdb_signal sig)
 	  if (target_is_non_stop_p ())
 	    stop_all_threads ();
 
-	  set_step_over_info (get_regcache_aspace (regcache),
-			      regcache_read_pc (regcache), 0);
+	  set_step_over_info (tp, 0);
 
 	  step = maybe_software_singlestep (gdbarch, pc);
 
@@ -7713,7 +7722,6 @@ keep_going_pass_signal (struct execution_control_state *ecs)
     }
   else
     {
-      struct regcache *regcache = get_current_regcache ();
       int remove_bp;
       int remove_wps;
       step_over_what step_what;
@@ -7749,11 +7757,10 @@ keep_going_pass_signal (struct execution_control_state *ecs)
       if (remove_bp
 	  && (remove_wps || !use_displaced_stepping (ecs->event_thread)))
 	{
-	  set_step_over_info (get_regcache_aspace (regcache),
-			      regcache_read_pc (regcache), remove_wps);
+	  set_step_over_info (ecs->event_thread, remove_wps);
 	}
       else if (remove_wps)
-	set_step_over_info (NULL, 0, remove_wps);
+	set_step_over_info (NULL, remove_wps);
 
       /* If we now need to do an in-line step-over, we need to stop
 	 all other threads.  Note this must be done before
-- 
1.9.1

      parent reply	other threads:[~2016-04-15 13:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 13:29 [PATCH 0/2] Add thread info in 'struct step_over_info' Yao Qi
2016-04-15 13:29 ` [PATCH 2/2] Replace address and aspace with thread in struct step_over_info Yao Qi
2016-04-19 10:43   ` Pedro Alves
2016-04-19 13:55     ` Yao Qi
2016-04-20 18:01       ` Doug Evans
2016-04-20 18:03         ` Pedro Alves
2016-12-22 23:51           ` Doug Evans
2016-04-15 13:29 ` Yao Qi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460726961-27486-2-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).