Triggering -save-temps from the front-end code
Marc Glisse
marc.glisse@inria.fr
Mon Nov 28 17:18:40 GMT 2022
On Mon, 28 Nov 2022, Florian Weimer via Gcc wrote:
> * Arsen Arsenović:
>
>> Hi,
>>
>> Florian Weimer via Gcc <gcc@gcc.gnu.org> writes:
>>
>>> Unfortunately, some build systems immediately delete the input source
>>> files. Is there some easy way I can dump the pre-processed and
>>> non-preprocessed sources to my log file? I tried to understand how
>>> -save-temps for crash recovery works, but it seems that this runs
>>> outside of the frontend, in the driver.
>>
>> Would dumping unconditionally into some "side channel" -dumpdir be a
>> sufficient workaround?
>
> Of the file names overlap, and it seems in this case, the dump files are
> just overwritten. I don't see a way to make the file names unique.
>
> I guess for the tough cases, I can just keep running the build under
> strace.
You could override unlink with LD_PRELOAD. Use a special purpose
filesystem (gitfs? I haven't tried it yet). Wrap gcc with a command that
calls the true gcc with a different TMPDIR / -dumpdir each time.
--
Marc Glisse
More information about the Gcc
mailing list