Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	 "H.J. Lu" <hjl.tools@gmail.com>,
	hongjiu.lu@intel.com
Subject: [RFA] fix for intel disassembly, truncated BFD_VMA
Date: Wed, 09 Feb 2011 18:36:00 -0000	[thread overview]
Message-ID: <4D52DEAC.1020607@vmware.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

This expression needed parentheses.  Without them, it was truncating the
target address of jumps and calls from BFD_VMA to 32-bits.

Disassembly at high addresses is vastly improved.


[-- Attachment #2: truncate.txt --]
[-- Type: text/plain, Size: 1469 bytes --]

2011-02-09  Michael Snyder  <msnyder@vmware.com>

	* i386-dis.c (OP_J): Parenthesize expression to prevent 
	truncated addresses.
	(print_insn): Fix indentation off-by-one.

Index: i386-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/i386-dis.c,v
retrieving revision 1.257
diff -u -p -u -p -r1.257 i386-dis.c
--- i386-dis.c	18 Jan 2011 17:08:13 -0000	1.257
+++ i386-dis.c	9 Feb 2011 18:28:02 -0000
@@ -1,6 +1,6 @@
 /* Print i386 instructions for GDB, the GNU debugger.
    Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
@@ -11702,9 +11702,9 @@ print_insn (bfd_vma pc, disassemble_info
       modrm.rm = *codep & 7;
     }
 
-   need_vex = 0;
-   need_vex_reg = 0;
-   vex_w_done = 0;
+  need_vex = 0;
+  need_vex_reg = 0;
+  vex_w_done = 0;
 
   if (dp->name == NULL && dp->op[0].bytemode == FLOATCODE)
     {
@@ -13817,7 +13817,7 @@ OP_J (int bytemode, int sizeflag)
       oappend (INTERNAL_DISASSEMBLER_ERROR);
       return;
     }
-  disp = ((start_pc + codep - start_codep + disp) & mask) | segment;
+  disp = ((start_pc + (codep - start_codep) + disp) & mask) | segment;
   set_op (disp, 0);
   print_operand_value (scratchbuf, 1, disp);
   oappend (scratchbuf);

             reply	other threads:[~2011-02-09 18:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 18:36 Michael Snyder [this message]
2011-02-09 18:42 ` H.J. Lu
2011-02-09 18:44   ` Michael Snyder
2016-02-16  0:07     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D52DEAC.1020607@vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=hongjiu.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox