I am looking at the source code of gcc.c, and I found the driver function main.c calls do_spec(). It seems that do_spce() is the function, called by main(), which invokes the preprocessor, compiler, assembler and linker individually at different step according to the input to the driver; and execute() is the function actually invoke them. (I copy and past my gdb output with "bt" command.)

Can someone give a brief intro of what do_spec(), do_spec_x() and execute() do, so that I can follow the procedure?

A seperate but sort of related question is:
After looking at Makefile, I think toplev_main () in toplev.c (which is wrapped in main() in main.c)is compiled to cc1(i.e, $BACKEND), is it correct? But why can't I find cc1 in the mygcc/bin directory after make and make install?

Thanks for the help.

------------------------------------------------------------------------------------------------
Breakpoint 14, execute () at ../../gcc-4.0.2/gcc/gcc.c:2663
(gdb) bt
#0  execute () at ../../gcc-4.0.2/gcc/gcc.c:2663
#1 0x080504ee in do_spec_1 (spec=0x8e94648 "-o %|.s |\n as %(asm_options) %|.s %A", inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:4532 #2 0x080528d6 in handle_braces (p=0x8059021 "-o %|.s |\n as %(asm_options) %|.s %A }") at ../../gcc-4.0.2/gcc/gcc.c:5706 #3 0x08050b63 in do_spec_1 (spec=0x805901c "%{!S:-o %|.s |\n as %(asm_options) %|.s %A }", inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:5087 #4 0x0805127e in do_spec_1 (spec=0x8e995f8 "%(invoke_as)", inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:5186 #5 0x080528d6 in handle_braces (p=0x8e993e4 "%(invoke_as)}") at ../../gcc-4.0.2/gcc/gcc.c:5706 #6 0x08050b63 in do_spec_1 (spec=0x8e99290 "\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i} \n\t\t cc1 -fpreprocessed %{save-temps:%b.i} %{!save-temps:%g.i} \t\t\t%(c"..., inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:5087 #7 0x080528d6 in handle_braces (p=0x8e99002 "\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i} \n\t\t cc1 -fpreprocessed %{save-temps:%b.i} %{!save-temps:%g.i} \t\t\t%(c"...) at ../../gcc-4.0.2/gcc/gcc.c:5706 #8 0x08050b63 in do_spec_1 (spec=0x8e98f98 " %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_options) -o %{sa"..., inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:5087 #9 0x080528d6 in handle_braces (p=0x8e98c9e " %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_options) -o %{sa"...) at ../../gcc-4.0.2/gcc/gcc.c:5706 #10 0x08050b63 in do_spec_1 (spec=0x8e98c98 "%{!MM: %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_options) -"..., inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:5087 #11 0x080528d6 in handle_braces (p=0x8e98995 "%{!MM: %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_options) -"...) at ../../gcc-4.0.2/gcc/gcc.c:5706 #12 0x08050b63 in do_spec_1 (spec=0x8e98990 "%{!M:%{!MM: %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_optio"..., inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:5087 #13 0x080528d6 in handle_braces (p=0x8057464 "%{!M:%{!MM: %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \t\t%(cpp_optio"...) at ../../gcc-4.0.2/gcc/gcc.c:5706 #14 0x08050b63 in do_spec_1 (spec=0x8057418 "%{E|M|MM:%(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)} %{!E:%{!M:%{!MM: %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{sa"..., inswitch=0, soft_matched_part=0x0) at ../../gcc-4.0.2/gcc/gcc.c:5087 #15 0x08051c01 in do_spec_2 (spec=0x8057418 "%{E|M|MM:%(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)} %{!E:%{!M:%{!MM: %{traditional|ftraditional:%eGNU C no longer supports -traditional without -E} %{!combine:\t %{sa"...) at ../../gcc-4.0.2/gcc/gcc.c:4267 #16 0x08051f67 in do_spec (spec=0xd <Address 0xd out of bounds>) at ../../gcc-4.0.2/gcc/gcc.c:4235 #17 0x080552bc in main (argc=3, argv=0xbfffd9f4) at ../../gcc-4.0.2/gcc/gcc.c:6523
--------------------------------------------------------------------------------------------------------------

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Reply via email to