This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] amd64 displaced stepping support
- From: Daniel Jacobowitz <drow at false dot org>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 27 Jan 2009 12:27:30 -0500
- Subject: Re: [RFA] amd64 displaced stepping support
- References: <20090126230013.5C7F01C72DE@localhost>
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