From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6959 invoked by alias); 27 Jan 2009 01:33:49 -0000 Received: (qmail 6948 invoked by uid 22791); 27 Jan 2009 01:33:48 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_05,J_CHICKENPOX_44,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; Tue, 27 Jan 2009 01:33:41 +0000 Received: (qmail 30369 invoked from network); 27 Jan 2009 01:33:39 -0000 Received: from unknown (HELO macbook-2.local) (stan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Jan 2009 01:33:39 -0000 Message-ID: <497E646E.2010108@codesourcery.com> Date: Tue, 27 Jan 2009 08:26:00 -0000 From: Stan Shebs User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Doug Evans CC: gdb-patches@sourceware.org Subject: Re: [RFA] amd64 displaced stepping support References: <20090126230013.5C7F01C72DE@localhost> In-Reply-To: <20090126230013.5C7F01C72DE@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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-01/txt/msg00516.txt.bz2 Doug Evans wrote: > Hi. I took a crack at implementing displaced stepping support for amd64. > Ooh nice! And fortuitous timing, I was supposed to write this very code next week... > Using the disassembler to compute instruction lengths is awkward, I know. > It's needed in order to compute the address of rip-relative addressing. > The address is %rip + address-of-next-insn + displacement, > and the displacement is only 32 bits so it's not guaranteed to be enough > to cover the distance between the original instruction and its copy. > To compensate I compute an unused integer reg, set it to > %rip + address-of-next-insn, and rewrite the insn to use base+disp addressing. > I think the GNU tools need a general-purpose library of ISA-related tools. > Until then, I went with the disassembler. The code is laid out such that > when a better implementation of computing insn lengths comes along, it > can be easily dropped in. > My kneejerk would be to borrow libopcodes. > This also includes a testcase! :-) > Plus I added a testcase for the i386 case. > > Ok to check in? > I read it and it seems sensible, I'm the not the displaced stepping maven though. Stan