Page MenuHomePhabricator

CrashHandler: be careful about crashing while handling

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



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.


Diff Detail


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.


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.

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.