<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 --- - lldb doesn't report line number for NULL function pointer crash"
   href="http://llvm.org/bugs/show_bug.cgi?id=17477">17477</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb doesn't report line number for NULL function pointer crash
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>kainjow@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If a NULL function pointer is called, lldb does not report the line number
properly, however gdb does.

Here is sample code:

#include <stdio.h>

struct blah {
    void (*asdf)();
};

int main() {
    struct blah b;
    b.asdf = NULL;
    b.asdf();
    return 0;
}

When I invoke lldb on the executable and 'run', then 'bt', it gives:

$ lldb Puke 
Current executable set to 'Puke' (x86_64).
(lldb) run
Process 53327 launched: '/path/to/PUke' (x86_64)
Process 53327 stopped
* thread #1: tid = 0x37a5c9, 0x0000000000000000, queue =
'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0
(lldb) bt
* thread #1: tid = 0x37a5c9, 0x0000000000000000, queue =
'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
    frame #1: 0x00007fff97ff47e1 libdyld.dylib`start + 1


Doing the same with gdb gives:

$ gdb Puke 
(gdb) run
Starting program: /path/to/Puke 
Reading symbols for shared libraries +.............................. done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000000100000f64 in main () at /path/to/main.c:11
(gdb)


lldb version lldb-300.5.46 (Xcode 5).</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>