Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Capture Native Instruction Addrs for Exceptions #683

Merged
merged 28 commits into from
Jun 20, 2022

Conversation

Swatinem
Copy link
Member

@Swatinem Swatinem commented Apr 12, 2022

For each of the chained Exceptions, this will query the list of native instruction addrs for the Exception from the libil2cpp runtime, to decorate the Sentry Event with those instruction addresses.

The libil2cpp APIs available to do this are completely internal, but have been there for a few releases and should not break in the near future.
One limitation is that the APIs return only addresses from, and relative to, the main GameAssembly library. As far as Unity is concerned, the game will only ever consist of a single Binary/Library and will not be split up into multiple things.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 12, 2022

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Capture Native Instruction Addrs for Exceptions ([#683](https://github.com/getsentry/sentry-unity/pull/683))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 62afa40

@Swatinem Swatinem marked this pull request as ready for review June 1, 2022 09:35
@Swatinem
Copy link
Member Author

Swatinem commented Jun 1, 2022

I squashed all the commits, so this should be "ready to review", though there is still some work to do here.

Most notably:

  • The runtime parts need to be conditionally compiled only on Unity >2020, and targeting il2cpp.
  • There are some unrelated changes that @bitsandfoxes added I’m unsure about.

Especially the conditional compiler is something I need help with, as I have no idea how that would need to be done for Unity. Other than that, code is ready to review.

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need a strategy to gracefully downgrade features depending on Unity versions. Will chat offline about it

src/Sentry.Unity.Editor/Il2CppOption.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/Il2CppEventProcessor.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/Il2CppEventProcessor.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/Il2CppEventProcessor.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/Il2CppEventProcessor.cs Outdated Show resolved Hide resolved
}
}

// This is the same logic as `MainExceptionProcessor` uses to create the `SentryEvent.SentryExceptions` list.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior just changed in the .NET SDK: https://github.com/getsentry/sentry-dotnet/pull/1672/files

We should instead refactor this out so we use either one strategy or the other, and have the base behavior on some base class or helper method

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good point. I would have loved to just have an iterator that yields exceptions.
The .NET SDK could just map over that iterator to yield sentry exceptions. And this here could use the exact same iterator to zip.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/Sentry.Unity/Il2CppEventProcessor.cs Outdated Show resolved Hide resolved
src/Sentry.Unity/Il2CppEventProcessor.cs Outdated Show resolved Hide resolved
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
@bitsandfoxes bitsandfoxes merged commit be7bdf5 into main Jun 20, 2022
@bitsandfoxes bitsandfoxes deleted the feat/native-stack branch June 20, 2022 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants