Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/5] Factor out in-stepping-range checks.
Date: Tue, 14 May 2013 19:10:00 -0000	[thread overview]
Message-ID: <20130514191033.13213.74286.stgit@brno.lan> (raw)
In-Reply-To: <20130514191026.13213.39574.stgit@brno.lan>

This adds a function for doing within-thread's-stepping-range checks, and converts
a couple spots to use it.  Following patches will add more uses.

v3:

 - macro -> function, and rename it.

gdb/
2013-05-09  Yao Qi  <yao@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* gdbthread.h (pc_in_thread_step_range): New declaration.
	* thread.c (pc_in_thread_step_range): New function.
	* infrun.c (handle_inferior_event): Use it.
---
 gdb/gdbthread.h |    4 ++++
 gdb/infrun.c    |    6 ++----
 gdb/thread.c    |    7 +++++++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 0846322..a9f8a94 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -399,6 +399,10 @@ extern struct thread_info* inferior_thread (void);
 
 extern void update_thread_list (void);
 
+/* Return true if PC is in the stepping range of THREAD.  */
+
+int pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread);
+
 extern struct thread_info *thread_list;
 
 #endif /* GDBTHREAD_H */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 54e92f2..57c427d 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4337,8 +4337,7 @@ process_event_stop_test:
 
       if (ecs->event_thread->control.step_range_end != 0
 	  && ecs->event_thread->suspend.stop_signal != GDB_SIGNAL_0
-	  && (ecs->event_thread->control.step_range_start <= stop_pc
-	      && stop_pc < ecs->event_thread->control.step_range_end)
+	  && pc_in_thread_step_range (stop_pc, ecs->event_thread)
 	  && frame_id_eq (get_stack_frame_id (frame),
 			  ecs->event_thread->control.step_stack_frame_id)
 	  && ecs->event_thread->control.step_resume_breakpoint == NULL)
@@ -4707,8 +4706,7 @@ process_event_stop_test:
      through a function epilogue and therefore must detect when
      the current-frame changes in the middle of a line.  */
 
-  if (stop_pc >= ecs->event_thread->control.step_range_start
-      && stop_pc < ecs->event_thread->control.step_range_end
+  if (pc_in_thread_step_range (stop_pc, ecs->event_thread)
       && (execution_direction != EXEC_REVERSE
 	  || frame_id_eq (get_frame_id (frame),
 			  ecs->event_thread->control.step_frame_id)))
diff --git a/gdb/thread.c b/gdb/thread.c
index 2a1d723..2eb506b 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -750,6 +750,13 @@ finish_thread_state_cleanup (void *arg)
   finish_thread_state (*ptid_p);
 }
 
+int
+pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread)
+{
+  return (pc >= thread->control.step_range_start
+	  && pc < thread->control.step_range_end);
+}
+
 /* Prints the list of threads and their details on UIOUT.
    This is a version of 'info_threads_command' suitable for
    use from MI.


  parent reply	other threads:[~2013-05-14 19:10 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14 19:10 [PATCH 0/5 V3] target-assisted range stepping Pedro Alves
2013-05-14 19:10 ` [PATCH 4/5] range stepping: gdbserver (x86 GNU/Linux) Pedro Alves
2013-05-14 19:47   ` Eli Zaretskii
2013-05-14 20:14   ` Tom Tromey
2013-05-23 17:44     ` Pedro Alves
2013-05-24 11:33       ` Pedro Alves
2013-05-15 12:14   ` Yao Qi
2013-05-20 18:01     ` Pedro Alves
2013-05-23  0:56   ` Yao Qi
2013-05-23 17:26     ` Pedro Alves
2013-05-14 19:10 ` [PATCH 2/5] Convert rs->support_vCont_t to a struct Pedro Alves
2013-05-14 19:40   ` Tom Tromey
2013-05-14 19:10 ` Pedro Alves [this message]
2013-05-14 19:37   ` [PATCH 1/5] Factor out in-stepping-range checks Tom Tromey
2013-05-14 19:10 ` [PATCH 3/5] range stepping: gdb Pedro Alves
2013-05-14 19:46   ` Eli Zaretskii
2013-05-15 10:23     ` Pedro Alves
2013-05-15 11:22       ` Eli Zaretskii
2013-05-15 12:39         ` Pedro Alves
2013-05-15 13:46           ` Eli Zaretskii
2013-05-15 13:58             ` Pedro Alves
2013-05-15 18:20               ` Pedro Alves
2013-05-16  6:08                 ` Eli Zaretskii
2013-05-20 18:43                   ` Pedro Alves
2013-05-20 19:05                     ` Eli Zaretskii
2013-05-23  0:47                     ` Yao Qi
2013-05-23 17:22                       ` Pedro Alves
2013-05-14 19:11 ` [PATCH 5/5] range stepping: tests Pedro Alves
2013-05-22 14:32   ` Yao Qi
2013-05-23 17:34     ` Pedro Alves
2013-05-23 18:03     ` Pedro Alves
2013-05-24  2:27       ` Yao Qi
2013-05-24  9:45         ` Pedro Alves
2013-05-24  9:57           ` Yao Qi
2013-05-14 20:21 ` [PATCH 0/5 V3] target-assisted range stepping Tom Tromey
2013-05-23 17:44   ` Pedro Alves
2013-05-23  1:02 ` Yao Qi
2013-05-23 17:46   ` Pedro Alves

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=20130514191033.13213.74286.stgit@brno.lan \
    --to=palves@redhat.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