From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17979 invoked by alias); 27 Jan 2009 17:27:38 -0000 Received: (qmail 17968 invoked by uid 22791); 27 Jan 2009 17:27:37 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_44 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Jan 2009 17:27:32 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id B304B10A42; Tue, 27 Jan 2009 17:27:30 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 9DAB310A3F; Tue, 27 Jan 2009 17:27:30 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1LRrik-000146-4F; Tue, 27 Jan 2009 12:27:30 -0500 Date: Tue, 27 Jan 2009 20:27:00 -0000 From: Daniel Jacobowitz To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFA] amd64 displaced stepping support Message-ID: <20090127172730.GA3749@caradoc.them.org> Mail-Followup-To: Doug Evans , gdb-patches@sourceware.org References: <20090126230013.5C7F01C72DE@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090126230013.5C7F01C72DE@localhost> User-Agent: Mutt/1.5.17 (2008-05-11) 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-01/txt/msg00520.txt.bz2 On Mon, Jan 26, 2009 at 03:00:12PM -0800, Doug Evans wrote: > 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. IMO, "the disassembler" means a bit of GDB interface glue, and libopcodes. Libopcodes is the obvious place for a library about opcodes. It can export more information; there's an example of this at the very end of struct disassemble_info, though it probably needs more granularity. -- Daniel Jacobowitz CodeSourcery