Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 5/7] range stepping: New command 'maint set range stepping'
Date: Mon, 11 Mar 2013 12:53:00 -0000	[thread overview]
Message-ID: <1363006291-13334-6-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1363006291-13334-1-git-send-email-yao@codesourcery.com>

gdb:

2013-03-11  Yao Qi  <yao@codesourcery.com>

	* remote.c (use_range_stepping): New.
	(remote_vcont_probe): Set 'use_range_stepping' if the remote
	target supports range stepping.
	(append_resumption): Use 'vCont;r' packet if 'use_range_stepping'
	is true.
	(maint_show_range_stepping): New.
	(maint_set_range_stepping): New.
	(_initialize_remote): Call add_setshow_boolean_cmd to register
	commands 'maint set range-stepping' and
	'maint show range-stepping'.

gdb/doc:

2013-03-11  Yao Qi  <yao@codesourcery.com>

	* gdb.texinfo (Maintenance Commands): Document commands
	'maint set range-stepping' and 'maint show range-stepping'.
---
 gdb/doc/gdb.texinfo |    7 +++++
 gdb/remote.c        |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index a607166..7c06120 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -35547,6 +35547,13 @@ data in a @file{gmon.out} file, be sure to move it to a safe location.
 Configuring with @samp{--enable-profiling} arranges for @value{GDBN} to be
 compiled with the @samp{-pg} compiler option.
 
+@kindex maint set range-stepping
+@kindex maint show range-stepping
+@cindex range-stepping
+@item maint set range-stepping
+@itemx maint show range-stepping
+Control whether to do stepping in an address range.
+
 @kindex maint set show-debug-regs
 @kindex maint show show-debug-regs
 @cindex hardware debug registers
diff --git a/gdb/remote.c b/gdb/remote.c
index 84e09b0..de7391f 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -257,6 +257,10 @@ struct support_v_cont
   int r;
 };
 
+/* A flag on GDB is willing to use range-stepping or not.  */
+
+static int use_range_stepping = 0;
+
 /* Description of the remote protocol state for the currently
    connected target.  This is per-target state, and independent of the
    selected architecture.  */
@@ -4647,6 +4651,7 @@ remote_vcont_probe (struct remote_state *rs)
       support_C = 0;
       rs->support_vCont.t = 0;
       rs->support_vCont.r = 0;
+      use_range_stepping = 0;
       while (p && *p == ';')
 	{
 	  p++;
@@ -4661,7 +4666,10 @@ remote_vcont_probe (struct remote_state *rs)
 	  else if (*p == 't' && (*(p + 1) == ';' || *(p + 1) == 0))
 	    rs->support_vCont.t = 1;
 	  else if (*p == 'r' && (*(p + 1) == ';' || *(p + 1) == 0))
-	    rs->support_vCont.r = 1;
+	    {
+	      rs->support_vCont.r = 1;
+	      use_range_stepping = 1;
+	    }
 
 	  p = strchr (p, ';');
 	}
@@ -4708,6 +4716,8 @@ append_resumption (char *p, char *endp,
 
       pc = regcache_read_pc (get_thread_regcache (ptid));
       if (rs->support_vCont.r /* Target supports step range.  */
+	  /* GDB is willing to do range stepping.  */
+	  && use_range_stepping
 	  /* Can't do range stepping for all threads of a process
 	     'pPID.-1'.  */
 	  && !(remote_multi_process_p (rs) && ptid_is_pid (ptid))
@@ -11488,6 +11498,45 @@ remote_upload_trace_state_variables (struct uploaded_tsv **utsvp)
   return 0;
 }
 
+static void
+maint_show_range_stepping (struct ui_file *file, int from_tty,
+			   struct cmd_list_element *c,
+			   const char *value)
+{
+  fprintf_filtered (file,
+		    _("Debugger's willingness to do range-stepping "
+		      "is %s.\n"), value);
+}
+
+static void
+maint_set_range_stepping (char *ignore_args, int from_tty,
+			  struct cmd_list_element *c)
+{
+  /* Check range stepping is supported when turns it on.  */
+  if (use_range_stepping)
+    {
+      if (remote_desc != NULL)
+	{
+	  struct remote_state *rs = get_remote_state ();
+
+	  if (remote_protocol_packets[PACKET_vCont].support == PACKET_SUPPORT_UNKNOWN)
+	    remote_vcont_probe (rs);
+
+	  if (remote_protocol_packets[PACKET_vCont].support == PACKET_DISABLE
+	      || !rs->support_vCont.r)
+	    {
+	      use_range_stepping = 0;
+	      error (_("Range stepping is not supported"));
+	    }
+	}
+      else
+	{
+	  use_range_stepping = 0;
+	  error (_("Range stepping is not supported"));
+	}
+    }
+}
+
 void
 _initialize_remote (void)
 {
@@ -11873,6 +11922,19 @@ Set the remote pathname for \"run\""), _("\
 Show the remote pathname for \"run\""), NULL, NULL, NULL,
 				   &remote_set_cmdlist, &remote_show_cmdlist);
 
+  add_setshow_boolean_cmd ("range-stepping", class_maintenance,
+			   &use_range_stepping, _("\
+Enable or disable range-stepping."), _("\
+Show whether range-stepping is enabled."), _("\
+If On, GDB will tell the target to do stepping a range of address.\n\
+This will speed up stepping a line of source file.\n\
+If off, GDB will not use it, even if such is supported by the \n\
+target"),
+			   maint_set_range_stepping,
+			   maint_show_range_stepping,
+			   &maintenance_set_cmdlist,
+			   &maintenance_show_cmdlist);
+
   /* Eventually initialize fileio.  See fileio.c */
   initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);
 
-- 
1.7.7.6


  parent reply	other threads:[~2013-03-11 12:53 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 12:52 [PATCH 0/7] Range stepping Yao Qi
2013-03-11 12:53 ` [PATCH 3/7] range stepping: gdbserver on x86/linux Yao Qi
2013-05-14 18:30   ` Pedro Alves
2013-05-15  7:40     ` Yao Qi
2013-05-20 18:00       ` Pedro Alves
2013-05-22 10:06         ` Yao Qi
2013-03-11 12:53 ` [PATCH 7/7] range stepping: doc and NEWS Yao Qi
2013-03-11 13:38   ` Abid, Hafiz
2013-03-11 17:01   ` Eli Zaretskii
2013-05-14 18:32   ` Pedro Alves
2013-03-11 12:53 ` [PATCH 2/7] Move rs->support_vCont_t to a separate struct Yao Qi
2013-03-11 12:53 ` [PATCH 6/7] range stepping: test case Yao Qi
2013-05-14 18:32   ` Pedro Alves
2013-05-15  8:27     ` Yao Qi
2013-05-20 18:29       ` Pedro Alves
2013-05-22 14:01         ` Yao Qi
2013-03-11 12:53 ` Yao Qi [this message]
2013-03-11 17:05   ` [PATCH 5/7] range stepping: New command 'maint set range stepping' Eli Zaretskii
2013-03-18  3:10     ` Yao Qi
2013-03-18  5:39       ` Eli Zaretskii
2013-05-14 18:31   ` Pedro Alves
2013-03-11 12:53 ` [PATCH 4/7] range stepping: gdb Yao Qi
2013-05-14 18:31   ` Pedro Alves
2013-05-15  8:07     ` Yao Qi
2013-05-20 17:59       ` Pedro Alves
2013-03-11 12:53 ` [PATCH 1/7] New macro THREAD_WITHIN_SINGLE_STEP_RANGE Yao Qi
2013-05-14 19:24   ` Pedro Alves
2013-03-14 20:12 ` [PATCH 0/7] Range stepping Pedro Alves
2013-03-15 19:54   ` Pedro Alves
2013-03-22  2:25     ` Yao Qi
2013-03-22 20:24       ` Pedro Alves
2013-04-11  6:16 ` [PATCH 0/7 V2] " Yao Qi
2013-04-11  6:17   ` [PATCH 2/7] Move rs->support_vCont_t to a separate struct Yao Qi
2013-04-11  6:17   ` [PATCH 1/7] New macro THREAD_WITHIN_SINGLE_STEP_RANGE Yao Qi
2013-04-11  6:18   ` [PATCH 3/7] range stepping: gdbserver on x86/linux Yao Qi
2013-04-11  6:19   ` [PATCH 4/7] range stepping: gdb Yao Qi
2013-04-11 13:22     ` Yao Qi
2013-04-12 12:35       ` Yao Qi
2013-04-11  6:19   ` [PATCH 5/7] range stepping: New command 'maint set range stepping' Yao Qi
2013-04-11 23:00     ` Eli Zaretskii
2013-04-11  6:38   ` [PATCH 6/7] range stepping: test case Yao Qi
2013-04-11  7:30   ` [PATCH 7/7] range stepping: doc and NEWS Yao Qi
2013-04-11 23:00     ` Eli Zaretskii
2013-04-12 20:48   ` [PATCH 0/7 V2] Range stepping 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=1363006291-13334-6-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.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