Re: Building GCC with the -g option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 12, 2012, at 2:32 PM, Ian Lance Taylor wrote:

> Amittai Aviram <amittai.aviram@xxxxxxxx> writes:
> 
> What exactly did you do, starting from the command line?

To build GCC or to try to debug GCC?  To build GCC, I had three sibling directories:

/home/afa9/Projects/GCC/gcc-4.6.2  [The source, decompressed from the tar.gz file.]
/home/afa9/Projects/GCC/gcc_build
/home/afa9/Projects/GCC/gcc_install

$ cd /home/afa9/Projects/GCC/gcc_build
$ ../configure --prefix=/home/afa9/Projects/GCC/gcc_install
$ make -j BOOT_CFLAGS='-g'
$ make -j install

Then, to try to debug GCC while GCC compiles a C source file (/home/afa9/Projects/OpenMP/r4.c), I did this:

$ cd /home/afa9/Projects/OpenMP
$ gdb /home/afa9/Projects/GCC/gcc_install/bin/gcc
[Inside GDB]
$ b omp-low.c:2612
[GDB couldn't find the file.]

> Have you read http://gcc.gnu.org/wiki/DebuggingGCC ?
> 

No.  Thank you!  As you can see, I was trying to run "gdb <my_compiler>" directly, so I suppose I just got to debug the driver, and hence the problem.

Questions about the "DebuggingGCC" document:

1.  The instructions say:  "Assuming you've produced preprocessed source (see the bug reporting directions for how to do this) ..."  They mean preprocessed source of the target that you will compile with GCC, don't they?  (I.e., not preprocessed source of GCC itself.)  Why do you need preprocessed source?  What if you want to step through the preprocessor as well as the compiler?

2.  Under "Building a Debuggable Compiler," the instructions say that you should run

make STAGE1_CFLAGS="-g -O0" all-stage1

or

make STAGE1_CFLAGS="-g3 -O0" all-stage1

Is this _instead_ of using BOOT_CFLAGS="-g -O0", or _in addition_ to it?  I'm confused about the relation between the two variables BOOT_CFLAGS and STAGE1_CFLAGS.

THANK YOU!

Amittai

Amittai Aviram
PhD Student in Computer Science
Yale University
646 483 2639
amittai.aviram@xxxxxxxx
http://www.amittai.com




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux