[lldb-dev] [Bug 26248] New: Disassembly incorrect for x64 RIP-relative

via lldb-dev lldb-dev at lists.llvm.org
Thu Jan 21 18:18:24 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26248

            Bug ID: 26248
           Summary: Disassembly incorrect for x64 RIP-relative
           Product: lldb
           Version: 3.4
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: mhop at microsoft.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15687
  --> https://llvm.org/bugs/attachment.cgi?id=15687&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160122/138db301/attachment.html>


More information about the lldb-dev mailing list