<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Disassembly incorrect for x64 RIP-relative"
   href="https://llvm.org/bugs/show_bug.cgi?id=26248">26248</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Disassembly incorrect for x64 RIP-relative
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mhop@microsoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15687" name="attach_15687" title="Program demonstrates incorrect disassembly for x64 RIP relative.">attachment 15687</a> <a href="attachment.cgi?id=15687&action=edit" title="Program demonstrates incorrect disassembly for x64 RIP relative.">[details]</a></span>
Program demonstrates incorrect disassembly for x64 RIP relative.

The disassemble command for x64 RIP relative addressing modes displays the
wrong disassembly. As an example, the byte sequence

  49 8b 05 78 56 34 12

disassembles to three instructions like

    (lldb) di -c3 -b -s &a
      0x7fff5fbff740: 49 8b 05  movq   (%r13), %rax
      0x7fff5fbff743: 78 56     js     0x7fff5fbff79b
      0x7fff5fbff745: 34 12     xorb   $0x12, %al

when it should produce a single instruction like

      0x7fff5fbff740: 49 8b 05 78 56 34 12  movq   (%rip + 12345679), %rax

I've attached a small C++ program to demonstrate the problem in the debugger.
The program just declares an array to hold the byte sequence above and then
prints out instructions to copy/paste into the LLDB. Here are the instructions
from the attached program (note that g++ on the Mac maps to LLVM).

REPRO STEPS:

g++ -g lldb-disassemble-rip.cxx
lldb a.out
breakpoint set -f lldb-disassemble-rip.cxx -l 7
r
di -c3 -b -s &a

EXPECT:
  Something like
  (lldb) di -c3 -b -s &a
    0x7fff5fbff740: 49 8b 05 78 56 34 12  movq   (%rip + 12345679), %rax

OBSERVE:
  Something like
  (lldb) di -c3 -b -s &a
    0x7fff5fbff740: 49 8b 05  movq   (%r13), %rax
    0x7fff5fbff743: 78 56     js     0x7fff5fbff79b
    0x7fff5fbff745: 34 12     xorb   $0x12, %al

I am seeing this problem on Mac OS X Yosemite Version 10.10.5 with
lldb-340.4.110.1.

This bug may be more impactful than incorrect output if it prevents lldb from
single stepping. In order to test whether lldb single stepping is broken, one
would need an example with the correct stack unwinding provisions.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>