<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 --- - Single step atomic sequences" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23944&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=DDUMf06MYELAe1Nlv7KChiwJLLHbYha4jtK_AOiWqwQ&m=rGPT4hEoDeDJelHlTRdo6wORV15THV-MIBKL6CIl5vs&s=HheDQI6rr6w95Irzn19OPXKv_-OTXLlMdJiCElYTpz0&e=">23944</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Single step atomic sequences
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>tberghammer@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On several architectures there are atomic instruction sequences where placing a
breakpoint in the middle of them changes the behavior of the code. The expected
behavior from the debugger is to treat these sequences as a "single instruction
block" and step through it and place breakpoints only outside of it.

Example on ARM (code came from libc.so`pthread_mutex_lock):

libc.so[0x17738] <+190>: ldrex  lr, [r4]
libc.so[0x1773c] <+194>: mov.w  r2, #0x0
libc.so[0x17740] <+198>: teq.w  lr, r5
libc.so[0x17744] <+202>: it     eq
libc.so[0x17746] <+204>: strexeq r2, r12, [r4]
libc.so[0x1774a] <+208>: cmp    r2, #0x0
libc.so[0x1774c] <+210>: bne    0x17738                   ; <+190>

There is an internal link (implemented inside of the processor) between the
ldrex and the strex instruction. If the evaluation of the code brakes between
these 2 instructions then this link broke resulting in a change in the behavior
of the code (in this case strex will always fail).

P.S.: The issue (in theory) handled by GDB properly on ARM
(<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceware.org_ml_gdb-2Dpatches_2011-2D12_msg00235.html&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=DDUMf06MYELAe1Nlv7KChiwJLLHbYha4jtK_AOiWqwQ&m=rGPT4hEoDeDJelHlTRdo6wORV15THV-MIBKL6CIl5vs&s=DufXso7sZ8QqtDG6NoBDf7u1g2TZkj2qBxMSGdHr-7w&e=">https://sourceware.org/ml/gdb-patches/2011-12/msg00235.html</a>)</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>