This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 3.0 bogus file information in debugging output


On Wed, Jan 30, 2002 at 12:50:38PM -0800, Zack Weinberg wrote:
> (There's still a bug with this stuff in 3.1, see next message.)
> 
> $ cat test.c
> int main(void) {
>   int i = 0;
> #line __LINE__ "foo.c"
>   i++;
> #line __LINE__ "bar.c"
>   return i;
> }

Perhaps a stupid question, but why doesn't it work in C++?

~/c++/libcw/src/libcwd/tests>cat lines2.cc
int main(void)
{
  int i = 0;
#line __LINE__ "foo.cc"
  i++;
#line __LINE__ "bar.cc"
  return i;
}

~/c++/libcw/src/libcwd/tests>g++-3.0.3 -S -g -v lines2.cc
Reading specs from /usr/local/gcc-3.0.3/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/specs
Configured with: /usr/src/gcc/gcc-3.0.3/configure --prefix=/usr/local/gcc-3.0.3 --enable-shared --with-gnu-as --with-gnu-ld --enable-languages=c++ --enable-debug --enable-threads
Thread model: posix
gcc version 3.0.3
 /usr/local/gcc-3.0.3/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -D__ELF__ -Dunix -Dlinux -D__ELF__
-D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__
-D__tune_i686__ -D__tune_pentiumpro__ lines2.cc -D__GNUG__=3 -D__GXX_DEPRECATED
-D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase lines2.cc -g -version -o lines2.s
GNU CPP version 3.0.3 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.3 (i686-pc-linux-gnu)
        compiled by GNU C version 3.0.3.
ignoring nonexistent directory "/usr/local/gcc-3.0.3/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc-3.0.3/include/g++-v3
 /usr/local/gcc-3.0.3/include/g++-v3/i686-pc-linux-gnu
 /usr/local/gcc-3.0.3/include/g++-v3/backward
 /usr/local/include
 /usr/local/gcc-3.0.3/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/include
 /usr/include
End of search list.
~/c++/libcw/src/libcwd/tests>sed -n '/^main:/,/^\.Lfe1:/p' lines2.s
main:
.LFB1:
        .stabn 68,0,2,.LM1-main
.LM1:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        subl    $8, %esp
.LCFI2:
        andl    $-16, %esp
.LBB2:
        .stabn 68,0,3,.LM2-main
.LM2:
        movl    $0, -4(%ebp)
        .stabn 68,0,4,.LM3-main
.LM3:
        leal    -4(%ebp), %eax
        incl    (%eax)
        .stabn 68,0,5,.LM4-main
.LM4:
        movl    -4(%ebp), %eax
.LBE2:
        .stabn 68,0,6,.LM5-main
.LM5:
        movl    %ebp, %esp
        popl    %ebp
        ret
.LFE1:
.Lfe1:


This is worse then the .c case, now also the
.stabs lines are missing.

-- 
Carlo Wood <carlo@alinoe.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]