title: Valgrind not showing line numbers in spite of -g flag (on Ubuntu 11.10/VirtualBox)
body: <p>I'm following 'Learn C the Hard Way', specifically <a href="http://c.learncodethehardway.org/book/learn-c-the-hard-waych5.html#x10-290005">the chapter on Valgrind</a>. This chapter gives you a deliberately wrong program to show how Valgrind works.</p>
  
  <p>When I run the exercise under Valgrind I do not get line numbers in my stack trace, just '(below main)' for the errors.</p>
  
  <p>I am <em>definitely</em> compiling with the -g flag.</p>
  
  <p>My Valgrind output is as follows:</p>
  
  <pre><code>djb@twin:~/projects/Learning/C$ valgrind ./ex4
  ==5190== Memcheck, a memory error detector
  ==5190== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
  ==5190== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
  ==5190== Command: ./ex4
  ==5190== 
  ==5190== Use of uninitialised value of size 4
  ==5190==    at 0x4078B2B: _itoa_word (_itoa.c:195)
  ==5190==    by 0x407CE55: vfprintf (vfprintf.c:1619)
  ==5190==    by 0x40831DE: printf (printf.c:35)
  ==5190==    by 0x4052112: (below main) (libc-start.c:226)
  ==5190== 
  ==5190== Conditional jump or move depends on uninitialised value(s)
  ==5190==    at 0x4078B33: _itoa_word (_itoa.c:195)
  ==5190==    by 0x407CE55: vfprintf (vfprintf.c:1619)
  ==5190==    by 0x40831DE: printf (printf.c:35)
  ==5190==    by 0x4052112: (below main) (libc-start.c:226)
  ==5190== 
  ==5190== Conditional jump or move depends on uninitialised value(s)
  ==5190==    at 0x407CC10: vfprintf (vfprintf.c:1619)
  ==5190==    by 0x40831DE: printf (printf.c:35)
  ==5190==    by 0x4052112: (below main) (libc-start.c:226)
  ==5190== 
  ==5190== Conditional jump or move depends on uninitialised value(s)
  ==5190==    at 0x407C742: vfprintf (vfprintf.c:1619)
  ==5190==    by 0x40831DE: printf (printf.c:35)
  ==5190==    by 0x4052112: (below main) (libc-start.c:226)
  ==5190== 
  I am 0 years old.
  I am 68882420 inches tall.
  ==5190== 
  ==5190== HEAP SUMMARY:
  ==5190==     in use at exit: 0 bytes in 0 blocks
  ==5190==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
  ==5190== 
  ==5190== All heap blocks were freed -- no leaks are possible
  ==5190== 
  ==5190== For counts of detected and suppressed errors, rerun with: -v
  ==5190== Use --track-origins=yes to see where uninitialised values come from
  ==5190== ERROR SUMMARY: 22 errors from 4 contexts (suppressed: 11 from 6)
  </code></pre>
  
  <p>I'm using Ubuntu 11.10 in a VirtualBox VM.</p>
  
  <p>Thank you for any help. </p>
  
  <p><strong>Update</strong></p>
  
  <p>It seems that if I call a function from <code>main()</code> and that function contains a mistake (eg an uninitialized variable), then I <em>do</em> get a trace to the place that function was called in <code>main()</code>. However errors within <code>main()</code> remain unspecified. See <a href="http://pastebin.com/GGAK4912">this paste</a> for an example.</p>