g++ fails to generate debug info for some methods. Please refer to the following files, posted here: http://www.adam-mckee.net/files/gccbug
------------------------------------------------------------------------------ TotalCostEvaluator_bug.ii : to reproduce the bug TotalCostEvaluator_ok.ii : my workaround (debug info is generated properly) readelf_bug.txt : readELF output shows no debug info generated for 'tsPerDay', a local within TotalCostEvaluator::cslistCost() readelf_ok.txt : debug info is properly generated for 'tsPerDay' as well as all other locals belonging to TotalCostEvaluator::cslistCost(). ------------------------------------------------------------------------------ If you compile TotalCostEvaluator_bug.ii, like this: === compilation command ===================================================== g++ -g -march=athlon-xp -Wall -Wno-uninitialized -fstrict-aliasing -c -o TotalCostEvaluator.o TotalCostEvaluator.ii ============================================================================= then run 'readelf -wi TotalCostEvaluator.o' - you will see that no debug info has been generated for any local variables belonging to cse::TotalCostEvaluator::cslistCost(). I did some testing, and found out that debug info would be properly generated for cslistCost() if I change the way I write a template function (deleteMapSecond), which is called by cslistCost(). If you compare TotalCostEvaluator_ok.ii with TotalCostEvaluator_bug.ii you'll see the change I made, which apparently causes gcc to generate debug info properly in this case. This is the first time I filed a bug report for gcc. I wasn't sure how to attach files so I thought it easiest to just make the files available from my web server. Here's some other information that you might want: ==== gcc -v =============================================================== [EMAIL PROTECTED]:/work/gccbug> gcc -v Reading specs from /usr/lib/gcc/i486-linux/3.4.2/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --disable-werror i486-linux Thread model: posix gcc version 3.4.2 (Debian 3.4.2-3) === uname -a ================================================================ Linux chef.clevor.vpn 2.6.9 #14 Mon Oct 25 19:49:12 CST 2004 i686 GNU/Linux -- Summary: Fail to generate debug info for member function. Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: adam_m_mckee at yahoo dot ca CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18273