<html>
    <head>
      <base href="http://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 --- - Incorrect ARM disassembly annotation for symbol stubs"
   href="http://llvm.org/bugs/show_bug.cgi?id=18637">18637</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect ARM disassembly annotation for symbol stubs
          </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@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zach@fb.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The lldb from Xcode 5.1b4 (lldb-310.2.32) to incorrectly annotates ARM
instructions corresponding to indirect function calls when running on an
iPhone. This reproduces when generating both arm64 or armv7s code.

Here is an example using armv7s.

Steps to reproduce:
1) Place a breakpoint onn CFSocketCreate in a simple iOS app with the following
code in main.c:

int main(int argc, char * argv[])
{
  @autoreleasepool {
    CFSocketCreate(kCFAllocatorDefault, 0, 0, 0, 0, NULL, NULL);
    return 0;
  }
}

2) Breakpoint is hit, instructions appear:

CoreFoundation`CFSocketCreate:
0x30539848:  push   {r4, r5, r6, r7, lr}
...
0x305398d8:  mov    r1, r6
0x305398da:  blx    0x305a68dc ; symbol stub for: __copy_helper_block_457
0x305398de:  mov    r1, r0
...

The annotation on 0x305398da is incorrect:

(lldb) p/a 0x305a68dc
(int) $3 = 0x305a68dc CoreFoundation`symbol stub for: __copy_helper_block_457

0x305a68dc is actually a symbol stub that will branch to
libsystem_kernel.dylib`socket, which you can verify below:

(lldb) disas -s0x305a68dc -c4
CoreFoundation`symbol stub for: __copy_helper_block_457:
   0x305a68dc:  ldr    r12, [pc, #4]             ; symbol stub for:
__copy_helper_block_457 + 12
   0x305a68e0:  add    r12, pc, r12
   0x305a68e4:  ldr    pc, [r12]
   0x305a68e8:  beq    0x2f0575a0
(lldb) x/4w 0x305a68dc
0x305a68dc: 0xe59fc004
0x305a68e0: 0xe08fc00c
0x305a68e4: 0xe59cf000
0x305a68e8: 0x0aaac32c
(lldb) x/a `0x305a68e8 + 0x0aaac32c`
0x3b052c14: 0x3ae6cce4 libsystem_kernel.dylib`socket</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>