title: GDB says "no symbol table," but nm shows file has debug symbols
body: <p>I'm trying to debug a simple C project using GDB, but GDB can't seem to find the debug symbols for the program no matter how I compile it.</p>
  
  <p>When I load the program into GDB, it claims to have read the symbols successfully because it prints</p>
  
  <pre><code>Reading symbols from /home/edward/&lt;executable&gt;...done.
  </code></pre>
  
  <p>However, when I run the program, break on a segmentation fault, and type <code>info locals</code>, it says</p>
  
  <pre><code>No symbol table info available.
  </code></pre>
  
  <p>Also, <code>bt</code> shows that execution stopped inside a function I wrote (not a system or library call), but there is no line number information, just raw memory addresses.</p>
  
  <p>Why can't GDB find or use the symbols it successfully read earlier? I've run <code>nm</code> and <code>objdump</code> on the binary file I'm running, and they both show sections like <code>.debug_info</code>, <code>.debug_line</code>, so the file does in fact contain debugging symbols.</p>
  
  <p>I usually compile with a Makefile that sets the following flags:</p>
  
  <pre><code>CFLAGS = -mno-red-zone -fno-omit-frame-pointer -ggdb -O0 -I. -Wdeclaration-after-statement -Wall
  </code></pre>
  
  <p>which I can see are being used when make invokes gcc. However, I've tried changing to just <code>-g</code>, and compiling manually by invoking <code>gcc -g -O0</code> on a simple test file, and the result is still the same: the binary file contains debug symbols, and GDB reads them, but invoking any GDB command results in a message that debug information is not available.</p>
  
  <p><strong>Updates</strong></p>
  
  <p>I'm running Ubuntu 12.04, my GDB version is 7.4, and my GCC version is 4.8.1.</p>
  
  <p>If I <code>set complaints 10000</code> in GDB and then load the file, it prints the following complaints:</p>
  
  <pre><code>Reading symbols from /home/edward/&lt;snip&gt;/minithread...
  DW_AT_low_pc 0x400690 is not &lt; DW_AT_high_pc 0x33 for DIE at 0x205 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x4006c3 is not &lt; DW_AT_high_pc 0xa9 for DIE at 0x235 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x40076c is not &lt; DW_AT_high_pc 0xad for DIE at 0x287 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400819 is not &lt; DW_AT_high_pc 0xe7 for DIE at 0x2d3 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400900 is not &lt; DW_AT_high_pc 0x4f for DIE at 0x345 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x40094f is not &lt; DW_AT_high_pc 0x55 for DIE at 0x39d [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x4009a4 is not &lt; DW_AT_high_pc 0x38 for DIE at 0x3e7 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x4009dc is not &lt; DW_AT_high_pc 0x43 for DIE at 0x433 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400a20 is not &lt; DW_AT_high_pc 0x2e for DIE at 0x56c [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400a4e is not &lt; DW_AT_high_pc 0x2e for DIE at 0x5aa [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400a7c is not &lt; DW_AT_high_pc 0x29 for DIE at 0x5d4 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400aa5 is not &lt; DW_AT_high_pc 0x49 for DIE at 0x620 [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400aee is not &lt; DW_AT_high_pc 0xca for DIE at 0x66c [in module /home/edward/&lt;snip&gt;/minithread]
  ...DW_AT_low_pc 0x400bb8 is not &lt; DW_AT_high_pc 0x7bb for DIE at 0x6f0 [in module /home/edward/&lt;snip&gt;/minithread]...done.
  </code></pre>
  
  <p>Are these errors the cause of the problem? Do they mean my GDB is the "wrong" version?</p>