daniel tian wrote: > Thanks. I am working for it now. > But I have a question about how to debug the cc1 with libgcc1.c. > because if I run the cc1 to build the libgcc2.c, lots of errors > occurred. > > Run the cc1 with the command: > ./cc1 -g -I../../rice-gcc-4.3.0/gcc > -I../../rice-gcc-4.3.0/gcc/../include > ../../rice-gcc-4.3.0/gcc/libgcc2.c > > here is the error message:
> Did I do something wrong? Yes, it can't work that simply; the code in libgcc2.c needs a bunch of macros defined and some other -I paths as well before it will work. One way is to - in the gcc/ subdir of your build directory, delete one of the libgcc .o files that you want to test your new compiler against - run "make 2>&1 | tee build.log" to capture the xgcc command that the makefile generates to rebuild that .o file. - copy and paste the commandline from the build log and add "-v 2>&1 | tee rebuild.log" at the end to capture the way the xgcc driver invokes cc1 - copy and paste /that/ commandline, and put "gdb --args" at the front of it to debug your compiler. See also http://gcc.gnu.org/wiki/DebuggingGCC cheers, DaveK