This is an archive of the discontinued LLVM Phabricator instance.

[StandardInstrumentations] Add option to dump IR to a file on crash
ClosedPublic

Authored by aeubanks on May 22 2023, 4:03 PM.

Details

Summary

We already have -print-on-crash which dumps the IR to stderr on a crash, but it's more useful to dump to a file.

Introduce -print-on-crash-path to dump the IR to a file.

Making -print-on-crash a string option is confusing if you only pass -print-on-crash and it swallows up the next command line arg, which is why this is a new option.

Perhaps we could retire the dump to stderr version if people don't use it, but not sure how much people find that useful.

Diff Detail

Event Timeline

aeubanks created this revision.May 22 2023, 4:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 22 2023, 4:03 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aeubanks requested review of this revision.May 22 2023, 4:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 22 2023, 4:03 PM
hans added inline comments.May 23 2023, 4:21 AM
llvm/lib/Passes/StandardInstrumentations.cpp
101

How about -print-on-crash-file and PrintOnCrashFile instead?

jamieschmeiser requested changes to this revision.May 23 2023, 6:39 AM
jamieschmeiser added inline comments.
llvm/lib/Passes/StandardInstrumentations.cpp
2228

You have removed the test on CrashReporter, which prevents multiple reporters. Now, a subsequent one will replace previous reporters. Is this intentional? I think the replaced ones will still be registered with the signal handler.

This revision now requires changes to proceed.May 23 2023, 6:39 AM
aeubanks updated this revision to Diff 525272.May 24 2023, 11:04 AM

add back unintentionally removed condition

This revision is now accepted and ready to land.May 25 2023, 6:08 AM
This revision was landed with ongoing or failed builds.May 25 2023, 9:18 AM
This revision was automatically updated to reflect the committed changes.