Re: GCC world tour

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

 



Hey Kevin,
Hi,

Could anyone suggest some good tourist stops in GCC (i.e. good
functions to set breakpoints at while "debugging" a simple compile to
learn the inner workings of the beast)? If I wanted to visit the C
parser, what is that called?
That's really hard to answer. As you said, GCC is a beast with a _lot_ of different components. I used to start with just "main" and start working through the very high-level components like option parsing, front-end interaction, middle-end.

Some interesting functions could be: gimplify_function_tree (GENERIC to GIMPLE), cgraph_optimize (that's where the optimization passes of the middle-end start). If you are further more interested in the various (optimization) passes of GCC, I would possibly search the source code for "struct *opt_pass" (e.g. struct simple_ipa_opt_pass) which contains the descriptions for the (optimization) passes, including the functions getting executed.
I was playing with the -### option. There is a wiki debugging entry
that describes running cc1 using the driver:

gdb --args `gcc/xgcc -### -Bgcc -O2 -march=pentium3
-fomit-frame-pointer -S -fverbose-asm -dA -Q -fmem-report
../../gcctest1.i 2>&1|grep cc1|tr -d '"'`

I had to add the "tr -d '"' (a ' " ') or it would not work? Says it
can't find "gcc/cc1". Am I doing something wrong? Or is this a
"feature" of Debians gdb?
I think that you are doing something wrong. This command worked for me perfectly. Does the file gcc/cc1 exist? If yes, I would possibly start to just run the command in ``, check the result, execute this command in the shell and finally feed this command into gdb --args. Maybe there's somewhere a simple typo ...

Best regards,
Andi


[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