From the GCC manual, there is the following overall option:
-wrapper
Invoke all subcommands under a wrapper program.
The name of the wrapper program and its parameters
are passed as a comma separated list.gcc -c t.c -wrapper gdb,–args
This will invoke all subprograms of gcc under
gdb --args', thusgdb –args cc1 …’.
the invocation of cc1 will be
I’m having trouble understanding the example and the purpose of the flag.
gcc -c t.c will create a t.o.
and then what? the object file is sent to gdb?
or is gdb given the responsibility of creating the object file (asummingly adding debugging information)?
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.
gdbis not in charge of generating anything, it is just wrapping aroundcc1whihc is the “compiler proper” – when you rungcc -c t.cthe compiler first runscpp -o t.i t.cto preprocess thet.cfile. Then it runscc1 -o t.s t.iand finallyas -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.