From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29392 invoked by alias); 14 May 2013 18:31:56 -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 29382 invoked by uid 89); 14 May 2013 18:31:56 -0000 X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 14 May 2013 18:31:56 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4EIVrf6005615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 14 May 2013 14:31:53 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4EIVquJ007679; Tue, 14 May 2013 14:31:52 -0400 Message-ID: <51928317.9000601@redhat.com> Date: Tue, 14 May 2013 18:31:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH 5/7] range stepping: New command 'maint set range stepping' References: <1363006291-13334-1-git-send-email-yao@codesourcery.com> <1363006291-13334-6-git-send-email-yao@codesourcery.com> In-Reply-To: <1363006291-13334-6-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00480.txt.bz2 On 03/11/2013 12:51 PM, Yao Qi wrote: > @@ -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; > + } I don't think this is a good approach. :-( If the user does "maint set range-stepping", and then connects, she'll reasonably assume range stepping will be disabled. She could have a stub that has known broken range stepping, for example. However, with this approach, if the target supports it, range stepping will always end up forced enabled as soon as GDB sends the first vCont packet, even if the user set range stepping off. So I think the "maint set range-stepping" toggle should be enabled by default, and it should only represent GDB's willingness to use the feature. > > 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) If we check instead for PACKET_ENABLE && rs->support_vCont.r here, > + { > + use_range_stepping = 0; > + error (_("Range stepping is not supported")); > + } > + } > + else > + { > + use_range_stepping = 0; > + error (_("Range stepping is not supported")); > + } Then we can merge these two errors. Following up on the "willingness-only" idea, I'd rather make this a warning though. In v3, I've make moved the setting out of "maint". -- Pedro Alves