title: LLDB not showing source code
body: <p>I am trying to debug a C++ program I am writing, but when I run it in LLDB and stop the program, it only shows me the assembler, not the original source.
  e.g. after the crash I’m trying to debug:</p>
  
  <pre><code>Process 86122 stopped
  * thread #13: tid = 0x142181, 0x0000000100006ec1 debug_build`game::update() + 10961, stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
      frame #0: 0x0000000100006ec1 debug_build`game::update() + 10961
  debug_build`game::update:
  -&gt;  0x100006ec1 &lt;+10961&gt;: movq   (%rdx), %rdx
      0x100006ec4 &lt;+10964&gt;: movq   %rax, -0xb28(%rbp)
      0x100006ecb &lt;+10971&gt;: movq   -0x1130(%rbp), %rax
      0x100006ed2 &lt;+10978&gt;: movq   0x8(%rax), %rsi
  </code></pre>
  
  <p>I am compiling with <code>-O0 -g</code>. I see the same thing when running the debugger via Xcode (I’m on OSX) or from the command line.</p>
  
  <p>What else might I need to do to get the source code to show up in LLDB?</p>
  
  <p><strong>Additional notes</strong></p>
  
  <p>Here is an example of a typical build command:</p>
  
  <pre><code>clang++ -std=c++1y -stdlib=libc++ -fexceptions -I/usr/local/include -c -O2 -Wall -ferror-limit=5 -g -O0 -ftrapv lib/format.cpp -o format.o
  </code></pre>
  
  <p>The earlier <code>-O2</code> is there because that’s the default I’m using, but I believe the later <code>-O0</code> overrides it, right?</p>
  
  <p><strong>What I’ve tried</strong></p>
  
  <ol>
  <li><p>I’ve recreated this problem with a simple ‘hello world’ program using the same build settings.</p></li>
  <li><p>After some searching, I tried running <code>dsymutil main.o</code> which said <code>warning: no debug symbols in executable (-arch x86_64)</code>, so perhaps the debug symbols are not being generated by my build commands?</p></li>
  <li><p>I also tried adding <code>-gsplit-dwarf</code> to the build commands but with no effect.</p></li>
  <li><p>Here is the link command from my ‘hello world’ version:</p>
  
  <p>clang++ main.o -L/usr/local/lib -g -o hello</p></li>
  <li><p>I ran <code>dwarfdump</code> (<a href="https://stackoverflow.com/questions/20772007/how-to-decode-dsym-file-to-explicit-dwarf-format">I read about it here</a>) on the executable and object files. It looks to my untrained eye like the debug symbols <em>are</em> present in the object files, but not in the executable itself (unless <code>dwarfdump</code> only works on object files, which is possible). So maybe the linking stage is the issue. Or maybe there’s a problem with the DWARF.</p></li>
  <li><p>I have now got this working in the ‘hello world’ program, through issuing build commands one-by-one in the terminal. I am therefore guessing this may be an issue with my build system (<a href="http://gittup.org/tup/" rel="noreferrer">Tup</a>), possibly running the commands with a different working directory so the paths get mangled or something.</p></li>
  </ol>