From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12308 invoked by alias); 20 Mar 2012 04:39:59 -0000 Received: (qmail 12297 invoked by uid 22791); 20 Mar 2012 04:39:58 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 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; Tue, 20 Mar 2012 04:39:36 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1S9qr9-0001Pq-My from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Mon, 19 Mar 2012 21:39:35 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by svr-orw-fem-01.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 19 Mar 2012 21:39:05 -0700 Received: from [0.0.0.0] ([172.16.63.104]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 19 Mar 2012 21:39:04 -0700 Message-ID: <4F6809DB.1010005@mentor.com> Date: Tue, 20 Mar 2012 04:39:00 -0000 From: Luis Gustavo Reply-To: "Gustavo, Luis" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix displaced stepping for remote targets References: <4F67E54C.1010904@mentor.com> <4F6808C9.7020709@codesourcery.com> In-Reply-To: <4F6808C9.7020709@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: 2012-03/txt/msg00732.txt.bz2 On 03/20/2012 01:34 AM, Yao Qi wrote: > On 03/20/2012 10:02 AM, Luis Gustavo wrote: >> If a target supports hw single-stepping for displaced stepping, GDB >> should just send a vCont;s packet to tell the target to step a single >> instruction. In my case, GDB was always sending a vCont;c instead. > > On some arch, the original instruction may be translated to more than > one instructions, and copied to scratch pad. So, we can't do > single-step in scratch pad. During a few tests x86 seems to do single-stepping in the scratch pad when using displaced stepping, or at least it sends the correct vCont;s packet. > > Even the case that one instruction is generated/copied to scratch pad > can be optimized in your approach, but not sure it breaks > software-single-step arch or not. > In my case GDB thinks there's a breakpoint right at PC since PC points to the old location. GDB just continues through vCont;c. This does not work as execution will just re-start from the scratch pad area and will cause unpredictable behavior. Maybe we need a better mechanism for this then. Luis