From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17914 invoked by alias); 28 Sep 2009 19:07:15 -0000 Received: (qmail 17767 invoked by uid 22791); 28 Sep 2009 19:07:14 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Sep 2009 19:07:10 +0000 Received: (qmail 13706 invoked from network); 28 Sep 2009 19:07:08 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Sep 2009 19:07:08 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [rfc] Fix PowerPC displaced stepping regression Date: Mon, 28 Sep 2009 19:07:00 -0000 User-Agent: KMail/1.9.10 Cc: "Ulrich Weigand" , Julian Brown , Daniel Jacobowitz References: <200909281745.n8SHjIkG030649@d12av02.megacenter.de.ibm.com> In-Reply-To: <200909281745.n8SHjIkG030649@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909282007.23213.pedro@codesourcery.com> 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: 2009-09/txt/msg00883.txt.bz2 On Monday 28 September 2009 18:45:18, Ulrich Weigand wrote: > Pedro Alves wrote: > > > On Monday 28 September 2009 18:27:03, Ulrich Weigand wrote: > > > Maybe I misunderstood your point here, but I don't think we can > > > actually do SW single-step on the displaced copy (using the normal > > > SW single-step mechanism). The way SW single-step ususally works > > > is to place breakpoints at all potential branch targets. But if > > > we have a displaced PC-relative branch, for example, the branch > > > target may not even point to addressable memory, so we cannot put > > > breakpoints there. > > > > If you get yourself such an instruction in the buffer, usually you'd > > want the branch offset had to be adjusted at displaced copy time, > > otherwise it seems to be you're already broken. > > If that's possible. In general, the real branch target may be out of > range relative to the address of the copied instruction for a branch in > the original instruction format ... (You could redirect to some temporary > target in the copy buffer, but at this point you're probably better off > just emulating the whole thing in the first place.) Yes, of course. But, the point is that whatever ends up in the displaced step scratch pad after displaced_step_copy time, be it simply a copy of the original insn, an adjusted pc-relative instruction, or a sequence of insns emulating the original insn, _could_ be single-stepped using software-single stepping. It's the latter case of single instruction emulation with more than one insn that is generatly more efficient to execute in one go with a break+continue, irrespective or HW or software single stepping being supported. Anyway, we're both clearly aware of these issues, and getting off topic. :-) -- Pedro Alves