How do I effectively use gdb for debugging the compiler?
Pre-requirements:1. Your gcc version needs to be 2.95.2 or 2.96 2. To enable debugging, you can build the entire compiler with make BUILD_OPTIMIZE=DEBUG Or you can build individual components (such as wopt.so) by going into the corresponding targia_xxx directories, and build with “BUILD_OPTIMIZE=DEBUG”. To single step inside the backend components (we’ll show the CG portion, other components are similar): 1. Remember to set the environment variable LD_LIBRARY_PATH. For cross compiler this variable should be set as export LD_LIBRARY_PATH=${TOOROOT}/usr/ia64-orc-linux/lib/gcc-lib/ia64-orc-linux/2.0:$LD_LIBRARY_PATH For native compiler it should be export LD_LIBRARY_PATH=${TOOROOT}/usr/lib/gcc-lib/ia64-orc-linux/2.0:$LD_LIBRARY_PATH 2. First run orcc using options ” … -show -keep … “. It will keep some needed intermediate files. orcc -show -keep kk16.c It will print some info like this: /home/xyz/orc-2.0/usr/ia64-orc-linux/altbin/gcc -D_LANGUAGE_C -D_SGI_COMPILER_VERSION=10. -D__host_