<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 --- - Erroneous Dissassembly obtained when breakpoint is inserted" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23613&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=DDUMf06MYELAe1Nlv7KChiwJLLHbYha4jtK_AOiWqwQ&m=7ldP3DtOz_3jcL0qOZUbUGbJ_OSVEetXzdEtbV7LuD8&s=-QdMjuJaNV8mwge-Gu6lbxvAZ4CCgwRqlOz-Y2huV4I&e=">23613</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Erroneous Dissassembly obtained when breakpoint is inserted
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ravithejawork@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14356" name="attach_14356" title="C++ source file">attachment 14356</a> <a href="attachment.cgi?id=14356&action=edit" title="C++ source file">[details]</a></span>
C++ source file

When a breakpoint is inserted at an instruction, the subsequent instructions
are erroneously decoded by LLDB. Possible reason could be that while decoding
instructions (when a breakpoint is also inserted), LLDB should substitute the
complete original instruction before decoding. Instead the dissassembly is
decoded correctly till the breakpoint instruction but since the breakpoint
instruction is basically modifying 1 byte of an already existing instruction,
LLDB interprets the rest of the bytes as new instructions.

Disassembly by GDB

   0x0000000000400922 <+0>:    push   %rbp
   0x0000000000400923 <+1>:    mov    %rsp,%rbp
   0x0000000000400926 <+4>:    sub    $0x30,%rsp
   0x000000000040092a <+8>:    mov    %rdi,-0x18(%rbp)
   0x000000000040092e <+12>:    mov    %esi,-0x1c(%rbp)
   0x0000000000400931 <+15>:    mov    %edx,-0x20(%rbp)
   0x0000000000400934 <+18>:    mov    %ecx,-0x24(%rbp)
=> 0x0000000000400937 <+21>:    mov    -0x1c(%rbp),%eax
   0x000000000040093a <+24>:    cmp    -0x20(%rbp),%eax
   0x000000000040093d <+27>:    jle    0x40094b <binary_search(int*, int, int,
int)+41>
   0x000000000040093f <+29>:    movl   $0xffffffff,-0x8(%rbp)
   0x0000000000400946 <+36>:    jmpq   0x4009d9 <binary_search(int*, int, int,
int)+183>

Corresponding Disassembly by LLDB

    0x400922 <+0>:  pushq  %rbp
    0x400923 <+1>:  movq   %rsp, %rbp
    0x400926 <+4>:  subq   $0x30, %rsp
    0x40092a <+8>:  movq   %rdi, -0x18(%rbp)
    0x40092e <+12>: movl   %esi, -0x1c(%rbp)
    0x400931 <+15>: movl   %edx, -0x20(%rbp)
    0x400934 <+18>: movl   %ecx, -0x24(%rbp)
->  0x400937 <+21>: int3              
    0x400938 <+22>: inb    $0x3b, %al
    0x40093b <+25>: loopne 0x4009bc                  ; <+154> at test.cpp:34
    0x40093e <+28>: orb    $-0x39, %al
    0x400940 <+30>: clc    



As it can be seen in the disassembly by LLDB, after breakpoint at <+21> the
instructions are not correctly decoded.



Steps to reproduce
1) Compile attached source with g++ (with -g option)
2) Start debugging with LLDB
3) Insert breakpoint at binary_search (b binary_search)
4) Execute command "disassemble"</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>