Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Debugger/CPU    [ Add a report in this area ]  
Report #:  122438   Status: Open
[Win64] Lots of instructions are disassembled wrong
Project:  Delphi Build #:  19.0.14356.6604
Version:    19.2 Submitted By:   Lior Fainshil
Report Type:  Basic functionality failure Date Reported:  2/12/2014 6:59:01 AM
Severity:    Serious / Highly visible problem Last Updated: 2/16/2014 5:24:52 PM
Platform:    All versions Internal Tracking #:   47616
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
After inspecting some assembly code in Delphi debugger, it seems to me the disassembler is completely broken. The instructions I wrote are translated to something completely different.
I seriously hope the problem is only in the disassembler and not in the assembler.

Here are some examples:
original code -> debugger view
psrad xmm7,$10 -> psraw xmm7,$10
pinsrd xmm6,[r15+r14],3 -> pinsrd xmm6,esp,3
prefetcht0 [r15+r11] -> prefetcht0 byte ptr [rbx+rdi]
Steps to Reproduce:
Write some assembly code, run it and watch the result in the debugger CPU window.

procedure proc;
  psrad xmm7,$10
  pinsrd xmm6,[r15+r14],3
  prefetcht0 [r15+r11]

Project1.dpr.12: psrad xmm7,$10
0000000000424930 660F72E710       psraw xmm7,$10
Project1.dpr.13: pinsrd xmm6,[r15+r14],3
0000000000424935 66430F3A22343E03 pinsrd xmm6,esp,$03
Project1.dpr.14: prefetcht0 [r15+r11]
000000000042493D 0F180C3B         prefetcht0 byte ptr [rbx+rdi]
Project1.dpr.15: end;
0000000000424941 C3               ret

Tomohiro Takahashi at 2/13/2014 5:18:43 AM -
> Build No: XE5
What build no of Delphi XE5 do you use, for example Delphi XE5 Update2(19.0.14356.6604) etc..?

Is your issue about Win64 app?
Could you please attach sample project to reproduce/confirm your issue?

Lior Fainshil at 2/16/2014 6:25:53 AM -
I use XE5 Version 19.0.13856.4978
The target is Win64.
The bug is trivial to reproduce. Just start any kind of Win64 project and write the following function:

procedure proc;
  psrad xmm7,$10
  pinsrd xmm6,[r15+r14],3
  prefetcht0 [r15+r11]
//The code of course makes no sense. It is only intended to test the assembler and the disassembler.

Add a call this function from the main code, add a breakpoint inside the function, run the program. When it stops, open the CPU window and watch the wrong code. I am afraid this is the tip of the iceberg. Both the assembler and the disassembler seem to contain lots of bugs in 64 bit code.

Server Response from: ETNACODE01