From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12377 invoked by alias); 11 Apr 2013 02:44:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 12339 invoked by uid 89); 11 Apr 2013 02:44:01 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Apr 2013 02:44:00 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UQ7UU-00036f-Kf from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 10 Apr 2013 19:43:58 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 10 Apr 2013 19:43:58 -0700 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Wed, 10 Apr 2013 19:43:57 -0700 From: Yao Qi To: Subject: [PATCH 5/7] range stepping: New command 'maint set range stepping' Date: Thu, 11 Apr 2013 06:19:00 -0000 Message-ID: <1365648222-12540-6-git-send-email-yao@codesourcery.com> In-Reply-To: <1365648222-12540-1-git-send-email-yao@codesourcery.com> References: <1363006291-13334-1-git-send-email-yao@codesourcery.com> <1365648222-12540-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-04/txt/msg00302.txt.bz2 On 03/18/2013 11:45 AM, Eli Zaretskii wrote: >> Don't have any special reasons to do this. The range stepping should be >> >always on if target supports, and it can be turned off for some >> >"maintenance purpose", so I set this command as a maintenance >> >command. > What would be the possible reasons to turn this feature off? > > Once we have the reasons, we could try thinking whether or not they > are limited to GDB maintenance. Range-stepping is useful to speed up some operations, so users don't have to turn it off. The reason turning it off could be that the remote stub has a bug in supporting range stepping, so we have to disable it in GDB side. I considered to name the command to "set remote range-stepping", but range-stepping is not specific to remote target, and it can be implemented on native target as well. So "set remote range-stepping" is not a good choice. I also considered "set range-stepping", but unable to find a reasonable place for documentation on it. In V2, I don't update the command name. gdb: 2013-04-11 Yao Qi * 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-04-11 Yao Qi * gdb.texinfo (Maintenance Commands): Document commands 'maint set range-stepping' and 'maint show range-stepping' and convenience variable '$range_stepping_counter'. --- gdb/doc/gdb.texinfo | 10 ++++++++ gdb/remote.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index bf7e25e..9292b94 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -35620,6 +35620,16 @@ 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 +@vindex $range_stepping_counter +Control whether to do stepping in an address range. The debugger convenience +variable @samp{$range_stepping_counter} contains the number of range stepping +@value{GDBN} has performed. + @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 a063698..7022275 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -260,6 +260,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. */ @@ -4652,6 +4656,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++; @@ -4666,7 +4671,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, ';'); } @@ -4713,6 +4721,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)) @@ -11697,6 +11707,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) { @@ -12094,6 +12143,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