This is an archive of the discontinued LLVM Phabricator instance.

CrashHandler: be careful about crashing while handling
ClosedPublic

Authored by jfb on Jul 24 2019, 11:20 AM.

Details

Summary

Looking at the current Apple-specific code for crash handling it does a few
silly things that I think we should avoid while handling crashes:

  • Try real hard not to allocate.
  • Set the global crash reporter string early so that any crash while generating the stack trace will still report some info.
  • Prevent reordering of operations in the current thread.

rdar://problem/53503334

Diff Detail

Repository
rL LLVM

Event Timeline

jfb created this revision.Jul 24 2019, 11:20 AM
scanon accepted this revision.Jul 24 2019, 11:59 AM
scanon added a subscriber: scanon.

LGTM

This revision is now accepted and ready to land.Jul 24 2019, 11:59 AM

Sure, I guess. I suspect most crashes-while-crashing are from the PrettyStackTrace machinery, not these allocations, but you're right that we can get a partial string out of it if it's short enough.

llvm/lib/Support/PrettyStackTrace.cpp
137 ↗(On Diff #211569)

Nitpick: llvm::AlignedCharArrayUnion<CrashHandlerString> would also include the alignment.

kubamracek accepted this revision.Jul 24 2019, 12:24 PM

LGTM, thanks!

jfb updated this revision to Diff 211638.Jul 24 2019, 4:29 PM
  • Specify alignment too.
jfb marked an inline comment as done.Jul 24 2019, 4:29 PM
This revision was automatically updated to reflect the committed changes.