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

Expose custom cxa throw and rethrow calls to Unity #3996

Merged
merged 3 commits into from
May 22, 2024

Conversation

munkiki7
Copy link
Contributor

@munkiki7 munkiki7 commented May 17, 2024

📜 Description

I have added custom calls that can be later used by Unity SDK for capturing C++ exceptions on iOS.
Also, when the current exception is NULL (during the std::terminate call) the sentrycrashsc_initSelfThread call is made to enrich the stack trace.

💡 Motivation and Context

The fix is related to this issue.

💚 How did you test it?

I have added the code to the Unity SDK that calls these new exposed functions using the dlsym search:

image

📝 Checklist

You have to check all boxes before merging:

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

This change makes sense to me, but I think someone of @getsentry/owners-native should have a look at this proposal, because my CPP on that topic isn't the best. @armcknight, maybe you could also have a look please?

Copy link
Member

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 35 lines in your changes are missing coverage. Please review.

Project coverage is 90.874%. Comparing base (c6b920a) to head (0b7dd7b).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #3996       +/-   ##
=============================================
+ Coverage   90.850%   90.874%   +0.024%     
=============================================
  Files          594       594               
  Lines        46494     46607      +113     
  Branches     16641     16690       +49     
=============================================
+ Hits         42240     42354      +114     
- Misses        4071      4183      +112     
+ Partials       183        70      -113     
Files Coverage Δ
...rding/Monitors/SentryCrashMonitor_CPPException.cpp 20.408% <0.000%> (-3.122%) ⬇️

... and 45 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c6b920a...0b7dd7b. Read the comment docs.

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

I added a changelog entry and tested this with the macOS sample app. Previously, the SDK didn't catch the crash report for the following code

void
Sentry::CppSample::rethrowNoActiveCPPException(void)
{
    // Rethrowing an exception when there is no active exception will lead to std::terminate being
    // called.
    throw;
}

No, it does, see screenshot:

CleanShot 2024-05-22 at 16 18 01

Thanks a lot, @munkiki7, LGTM.

@munkiki7
Copy link
Contributor Author

Glad to be helpful, @philipphofmann

@philipphofmann philipphofmann merged commit cf97209 into getsentry:main May 22, 2024
61 of 67 checks passed
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.

None yet

3 participants