Yes, for debugging the compiler itself. Or otherwise "trace" what is going on in the compiler - you could for example print the arguments passed to cc1 itself by adding a program that does that and then runs cc1.
gdb
is not in charge of generating anything, it is just wrapping around cc1
whihc is the "compiler proper" - when you run gcc -c t.c
the compiler first runs cpp -o t.i t.c
to preprocess the t.c
file. Then it runs cc1 -o t.s t.i
and finally as -o t.o t.s
(or something along those lines. With the wrapper, it would run those commands as, for example, gdb --args cc1 -o t.s t.i
.
Edit: This is of course much simplified compared to a "real" compile - there's a whole bunch of arguments passed to cc1
, etc.