Bug 16089 - disassembler work incorrectly with some SSE2 instructions.
Summary: disassembler work incorrectly with some SSE2 instructions.
Status: RESOLVED DUPLICATE of bug 16083
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.5
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-25 18:19 UTC by Evgeny Yulyugin
Modified: 2013-10-31 10:43 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments
real hardware test (223 bytes, text/plain)
2013-10-25 18:19 UTC, Evgeny Yulyugin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny Yulyugin 2013-10-25 18:19:35 UTC
Created attachment 7257 [details]
real hardware test

Compile attached file:
> gcc -Wall -g -O0 mulsd.c
Run gdb:
> gdb a.out

Set breakpoint in main:
Breakpoint 1, main () at test.c:4
4           double a[2] = {2, 2}, b[2] = {0, 0};

Make one step
(gdb) n
5           __asm__ __volatile__ (

(gdb) disassembler
<omitted>
=> 0x0000000000400572 <+54>:    movupd -0x10(%rbp),%xmm7
   0x0000000000400577 <+59>:    data16
   0x0000000000400578 <+60>:    mulpd  %xmm7,%xmm7
   0x000000000040057c <+64>:    movupd %xmm7,-0x20(%rbp)
<omitted>

Instruction disassembled incorrectly. It's mulsd %xmm7, %xmm7.

Hardware look at prefixes order but not in all cases.

Examples with mul** instructions:
66 f3 f2 0f 59 ff     is mulsd %%xmm7, %%xmm7 (mandatory prefix is f2)
66 f2 f3 0f 59 ff     is mulss %%xmm7, %%xmm7 (mandatory prefix is f3)
66 0f 59 ff           is mulpd %%xmm7, %%xmm7 (mandatory prefix is 66)
f2 66 0f 59 ff        is mulsd %%xmm7, %%xmm7 (mandatory prefix is f2)

If both f2 and f3 prefixes present last of it is mandatory. But 66 prefix is mandatory only if f2 and f3 prefixes is not present in this insturction.

Similar bug submitted in objdump (16083).
Comment 1 Pedro Alves 2013-10-31 10:43:08 UTC
> Similar bug submitted in objdump (16083).

Thanks.  GDB actually shares the disassembler code with objdump, so once that one is fixed, so will GDB.

*** This bug has been marked as a duplicate of bug 16083 ***