* Triggering -save-temps from the front-end code
@ 2022-11-28 11:28 Florian Weimer
2022-11-28 11:44 ` Richard Biener
2022-11-28 13:02 ` Arsen Arsenović
0 siblings, 2 replies; 5+ messages in thread
From: Florian Weimer @ 2022-11-28 11:28 UTC (permalink / raw)
To: gcc
I've got some instrumentation for logging errors to a magic directory,
so that I can see if a build triggered them even when it did not
fail—and hid all compiler errors and warnings.
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.
Here's an example of the
challenges this would help to solve:
Building in strict C99 mode
<https://github.com/ksh93/ksh/issues/587>
Thanks,
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Triggering -save-temps from the front-end code
2022-11-28 11:28 Triggering -save-temps from the front-end code Florian Weimer
@ 2022-11-28 11:44 ` Richard Biener
2022-11-28 13:02 ` Arsen Arsenović
1 sibling, 0 replies; 5+ messages in thread
From: Richard Biener @ 2022-11-28 11:44 UTC (permalink / raw)
To: Florian Weimer; +Cc: gcc
On Mon, Nov 28, 2022 at 12:30 PM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>
> I've got some instrumentation for logging errors to a magic directory,
> so that I can see if a build triggered them even when it did not
> fail—and hid all compiler errors and warnings.
>
> 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.
Yep, there's no way to trigger -save-temps behavior after-the-fact.
> Here's an example of the
> challenges this would help to solve:
>
> Building in strict C99 mode
> <https://github.com/ksh93/ksh/issues/587>
>
> Thanks,
> Florian
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Triggering -save-temps from the front-end code
2022-11-28 11:28 Triggering -save-temps from the front-end code Florian Weimer
2022-11-28 11:44 ` Richard Biener
@ 2022-11-28 13:02 ` Arsen Arsenović
2022-11-28 13:14 ` Florian Weimer
1 sibling, 1 reply; 5+ messages in thread
From: Arsen Arsenović @ 2022-11-28 13:02 UTC (permalink / raw)
To: Florian Weimer; +Cc: gcc
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
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?
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Overall-Options.html#index-dumpdir
Hope that helps, have a great day.
--
Arsen Arsenović
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Triggering -save-temps from the front-end code
2022-11-28 13:02 ` Arsen Arsenović
@ 2022-11-28 13:14 ` Florian Weimer
2022-11-28 17:18 ` Marc Glisse
0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2022-11-28 13:14 UTC (permalink / raw)
To: Arsen Arsenović; +Cc: gcc
* 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.
Thanks,
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Triggering -save-temps from the front-end code
2022-11-28 13:14 ` Florian Weimer
@ 2022-11-28 17:18 ` Marc Glisse
0 siblings, 0 replies; 5+ messages in thread
From: Marc Glisse @ 2022-11-28 17:18 UTC (permalink / raw)
To: Florian Weimer; +Cc: gcc
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-28 17:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 11:28 Triggering -save-temps from the front-end code Florian Weimer
2022-11-28 11:44 ` Richard Biener
2022-11-28 13:02 ` Arsen Arsenović
2022-11-28 13:14 ` Florian Weimer
2022-11-28 17:18 ` Marc Glisse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).