This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] opcodes/i386-dis: fix print_insn when 0x0f is last byte
- From: Jan Stancek <jstancek at redhat dot com>
- To: binutils at sourceware dot org
- Cc: jstancek at redhat dot com, nickc at redhat dot com
- Date: Mon, 24 Aug 2015 14:31:19 +0200
- Subject: [PATCH] opcodes/i386-dis: fix print_insn when 0x0f is last byte
- Authentication-results: sourceware.org; auth=none
When 0x0f is last byte before next symbol or last byte of output,
it is not printed:
a.s:
.file "foo.c"
.text
.globl foo
.type foo, @function
foo:
.byte 0x24
.byte 0x2f
.byte 0x0f
.size foo, .-foo
.globl bar
.type bar, @function
bar:
.byte 0x0f
.byte 0xba
.byte 0xe2
.byte 0x03
.size bar, .-bar
Problem is that byte at "2:" is missing:
Disassembly of section .text:
0000000000000000 <foo>:
0: 24 2f and $0x2f,%al
2:
0000000000000003 <bar>:
3: 0f ba e2 03 bt $0x3,%edx
With patch:
Disassembly of section .text:
0000000000000000 <foo>:
0: 24 2f and $0x2f,%al
2: 0f .byte 0xf
0000000000000003 <bar>:
3: 0f ba e2 03 bt $0x3,%edx
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Cc: Nick Clifton <nickc@redhat.com>
---
opcodes/i386-dis.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 055b38f98639..90cc8be91f4e 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -13438,8 +13438,9 @@ print_insn (bfd_vma pc, disassemble_info *info)
if (*codep == 0x0f)
{
unsigned char threebyte;
- FETCH_DATA (info, codep + 2);
- threebyte = *++codep;
+ codep++;
+ FETCH_DATA (info, codep + 1);
+ threebyte = *codep;
dp = &dis386_twobyte[threebyte];
need_modrm = twobyte_has_modrm[*codep];
codep++;
--
1.8.3.1