[RFC] Generating LLD reproducers on crashes

Sounds like a good idea. I suppose in case of a crash, Driver::generateCompilationDiagnostics() could invoke the linker again with --reproduce? That would be the "cheap" version of option 2.

-----Message d'origine-----

The build system needs to be aware of the core dump files, and deal with them before/after the build. It should do an automatic cleanup before and compress+upload the core dumps to a network location if a crash occurs. I agree that the size is a problem if that isn't dealt with. 50 GB .dmp files for LLD crashes aren't uncommon, and you would probably see the same figures with production builds on Linux. Mostly likely dumps would need to be enabled explicitly with an env.var or a system setting on the build system? I personally find it valuable to have .dmp files. As hard as we try to make the CI builds the same as the local ones, there's always something different that triggers a different behavior on the build system.

-----Message d'origine-----

  1. Haowei’s proposal is a good first step. A reproducer is good for 100% crashes. The reproducer archive is good for developers that need to iterate when fixing a crash. That can be achieved by mimicking the behavior of -fintegrated-cc1 and CC1Command (which is somehow equivalent to safeLldMain()), followed by something similar to generateCompilationDiagnostics(). All this controlled by an optional cmd-line flag. Also worth noting that some LLD drivers (if not all) support reproducers already.

I think implementing option 1 as a starter is a good idea. The existing crash reproducer for clang with ‘-fintegrated-cc1’ works pretty good in our case so if we can have it in lld, It should greatly improve the debug experience. If there is no further objection, I can start working on this.

Sounds like a good idea. I suppose in case of a crash, Driver::generateCompilationDiagnostics() could invoke the linker again with --reproduce? That would be the “cheap” version of option 2.

I agree with this as well. Though we probably won’t need a perfect crash reproducer, this solution is simple enough and it would cover some rare cases that an in process lld crash handler cannot handle.