Larry Evans wrote: > On 06/30/09 12:59, Jonathan Wakely wrote: >> 2009/6/30 Larry Evans: >>> So... I read `man gcc` which claimed passing "CFLAGS=<options>" on the >>> command line is how to do this. Well, since <options> in my case was >>> '-g3 -O0' I had to pass it as CFLAGS='-g3 oO0'. >> >> http://gcc.gnu.org/install/build.html >> >> If you wish to use non-default GCC flags when compiling the stage2 and >> stage3 compilers, set BOOT_CFLAGS on the command line when doing >> `make'. >> > > Thanks Jonathan. > > I also noticed the same info here: > > http://gcc.gnu.org/wiki/DebuggingGCC > > Well, I think what I did that; however, when I got into gdb, I got this: > > #{################################################## > Current directory is ~/download/gcc/4.4-20090630/build/gcc/ > GNU gdb 6.8-debian > Copyright (C) 2008 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "x86_64-linux-gnu"... > Breakpoint 1 at 0x411136: file > /home/evansl/download/gcc/4.4-20090630/build/../src/gcc/gcc.c, line 7008. > Function "internal_error" not defined. > Make breakpoint pending on future shared library load? (y or [n]) > [answered N; input not from terminal] > Function "exit" not defined. > Make breakpoint pending on future shared library load? (y or [n]) > [answered N; input not from terminal] > Function "abort" not defined. > Make breakpoint pending on future shared library load? (y or [n]) > [answered N; input not from terminal] > No source file named parser.c. > Make breakpoint pending on future shared library load? (y or [n]) > [answered N; input not from terminal] > /home/evansl/download/gcc/4.4-20090630/build/gcc/.gdbinit:13: Error in > sourced command file: > No symbol "expand_location" in current context. > (gdb) run > Starting program: /home/evansl/download/gcc/4.4-20090630/build/gcc/g++ > -std=gnu++0x bug.dir/bug.cpp > warning: failed to reevaluate condition for breakpoint 1: No symbol > "expand_location" in current context. > warning: failed to reevaluate condition for breakpoint 1: No symbol > "expand_location" in current context. > g++: error trying to exec 'cc1plus': execvp: No such file or directory > > Program exited with code 01. > (gdb) > #}################################################## > > What am I doing wrong now? Should I do `make install` also? > OOPS, tried that and didn't help.
Are you trying to debug the compiler, or the compiler driver? If the compiler, debug cc1 or cc1plus, not gcc. If the driver, pass -B/path/to/build/gcc/ to gcc. Andrew.