aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-02-15 15:58:42 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-02-15 16:03:58 -0800
commit4fd7268abff6f99dbbb78505f095bf1f54064db7 (patch)
treed8c05b94efcea412772b55fa50e27fdd5bb0bbb7 /opcodes
parent9c9a421ed2c5bf17afeacb23134ba95872537cce (diff)
downloadgdb-4fd7268abff6f99dbbb78505f095bf1f54064db7.zip
gdb-4fd7268abff6f99dbbb78505f095bf1f54064db7.tar.gz
gdb-4fd7268abff6f99dbbb78505f095bf1f54064db7.tar.bz2
Add parentheses to prevent truncated addresses
* i386-dis.c (print_insn): Parenthesize expression to prevent truncated addresses. (OP_J): Likewise.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog6
-rw-r--r--opcodes/i386-dis.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 24c1680..e9f1578 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (print_insn): Parenthesize expression to prevent
+ truncated addresses.
+ (OP_J): Likewise.
+
2016-02-10 Claudiu Zissulescu <claziss@synopsys.com>
Janek van Oirschot <jvanoirs@synopsys.com>
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 5f4aed5..de0534c 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -13644,7 +13644,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
if (op_index[i] != -1 && op_riprel[i])
{
(*info->fprintf_func) (info->stream, " # ");
- (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
+ (*info->print_address_func) ((bfd_vma) (start_pc + (codep - start_codep)
+ op_address[op_index[i]]), info);
break;
}
@@ -16158,7 +16158,7 @@ OP_J (int bytemode, int sizeflag)
the displacement is added! */
mask = 0xffff;
if ((prefixes & PREFIX_DATA) == 0)
- segment = ((start_pc + codep - start_codep)
+ segment = ((start_pc + (codep - start_codep))
& ~((bfd_vma) 0xffff));
}
if (address_mode != mode_64bit