From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12138 invoked by alias); 11 Mar 2013 12:53:02 -0000 Received: (qmail 12090 invoked by uid 22791); 11 Mar 2013 12:53:00 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_XS X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Mar 2013 12:52:52 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UF2Dj-0006ks-3W from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 11 Mar 2013 05:52:51 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 11 Mar 2013 05:52:50 -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; Mon, 11 Mar 2013 05:52:49 -0700 From: Yao Qi To: Subject: [PATCH 4/7] range stepping: gdb Date: Mon, 11 Mar 2013 12:53:00 -0000 Message-ID: <1363006291-13334-5-git-send-email-yao@codesourcery.com> In-Reply-To: <1363006291-13334-1-git-send-email-yao@codesourcery.com> References: <1363006291-13334-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes 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 X-SW-Source: 2013-03/txt/msg00453.txt.bz2 This patch teaches GDB to send 'vCont;r' packet when appropriate. GDB has to check whether the target understands 'r' action of 'vCont' packet. We also make use of fields 'step_range_start' and 'step_range_end' of 'struct thread_control_state' to compose the range of the stepping. gdb: 2013-03-11 Yao Qi * remote.c (struct support_v_cont) : New field. (remote_vcont_probe): Handle 'r' action of 'vCont' packet. (append_resumption): Send 'vCont;r' for range stepping. --- gdb/remote.c | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index ae0ae7e..84e09b0 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -253,6 +253,8 @@ struct support_v_cont { /* True if the stub reports support for vCont;t. */ int t; + /* True if the stub reports support for vCont;r. */ + int r; }; /* Description of the remote protocol state for the currently @@ -4644,6 +4646,7 @@ remote_vcont_probe (struct remote_state *rs) support_c = 0; support_C = 0; rs->support_vCont.t = 0; + rs->support_vCont.r = 0; while (p && *p == ';') { p++; @@ -4657,6 +4660,8 @@ remote_vcont_probe (struct remote_state *rs) support_C = 1; 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; p = strchr (p, ';'); } @@ -4689,7 +4694,36 @@ append_resumption (char *p, char *endp, if (step && siggnal != GDB_SIGNAL_0) p += xsnprintf (p, endp - p, ";S%02x", siggnal); else if (step) - p += xsnprintf (p, endp - p, ";s"); + { + struct thread_info *tp = NULL; + CORE_ADDR pc; + + gdb_assert (!ptid_equal (ptid, minus_one_ptid)); + + if (ptid_is_pid (ptid)) + tp = find_thread_ptid (inferior_ptid); + else + tp = find_thread_ptid (ptid); + gdb_assert (tp != NULL); + + pc = regcache_read_pc (get_thread_regcache (ptid)); + if (rs->support_vCont.r /* Target supports step range. */ + /* Can't do range stepping for all threads of a process + 'pPID.-1'. */ + && !(remote_multi_process_p (rs) && ptid_is_pid (ptid)) + /* Not step over a breakpoint. */ + && !tp->control.trap_expected + /* We have a range to single step. */ + && THREAD_WITHIN_SINGLE_STEP_RANGE (tp, pc)) + { + p += xsnprintf (p, endp - p, ";r"); + p += hexnumstr (p, tp->control.step_range_start); + p += xsnprintf (p, endp - p, ","); + p += hexnumstr (p, tp->control.step_range_end); + } + else + p += xsnprintf (p, endp - p, ";s"); + } else if (siggnal != GDB_SIGNAL_0) p += xsnprintf (p, endp - p, ";C%02x", siggnal); else -- 1.7.7.6