Bug 38765 - Support for accurate process/thread state in crash reports
Summary: Support for accurate process/thread state in crash reports
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: unspecified
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2016-02-15 14:34 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2017-01-19 06:36 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 38765 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Rolf Bjarne Kvinge [MSFT] 2016-02-15 14:34:35 UTC
This is a spin-off bug from bug #4120.

Currently for SIGSEGVs, Mono will:

1) Handle the SIGSEGV
2) Check if it's in managed code (if it is, throw a NullReferenceException. That's not what this bug is about).
3) If in native code, print diagnostics to stderr/logs.
4) Raise SIGABRT.

The problem here is 4), when raising SIGABRT the register/thread/process state from the SIGSEGV is lost, and it may contain information crucial to diagnose a crash (see bug #4120, comments 22/24 for examples).


1) Add support to enable crash chaining [1]. This must be opt-in, because currently crash reporters depend on us raising SIGABRT for SIGSEGVs we recognize as NullReferenceExceptions [2].

  a) Using an argument to mtouch: --enable-crash-chaining. Pro: easy to implement. Con: hard to set from third-party libraries (which is usually how crash reporters are consumed by customers).
  b) Using an assembly-level attribute. [assembly: CrashChaining (true)]. Con: harder to implement (but not very hard I think). Pro: can easily be configured from third-party libraries.

2) Add support for providing a native method that initializes crash reporters (so that the signal handlers for the crash reporter is installed before Mono's).

  a) Using an argument to mtouch. --crash-reporter-initialization-function:<function name>
  b) Using an assembly-level attribute.

  Same cons/pros as for 1).

3) Add support for 1) and 2) to Xamarin.Insights.

[1] https://github.com/mono/mono/commit/8ffc4070a94c5c3ef73b99e836e1b1e5652dffba
[2] http://stackoverflow.com/a/14499336/458193
Comment 1 Rolf Bjarne Kvinge [MSFT] 2017-01-19 06:36:33 UTC
2) Is already implemented: https://github.com/mono/mono/commit/aaaead4. This will be in C9.

There's also another option for 1):

c) Automatically detect apps that call https://github.com/mono/mono/commit/aaaead4, and then enable crash chaining.