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

[PLAT-13024] Send native mapped information in stack traces from system exceptions #855

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

kstenerud
Copy link
Contributor

@kstenerud kstenerud commented Nov 18, 2024

Goal

On Cocoa devices, get the corresponding native stack trace entries for a system exception, and add the necessary information for the backend to be able to map it back to the CSharp code.

Design

We now use il2cpp_native_stack_trace() to fetch the native frame addresses from the transpiled C++ code, which can then be mapped back to the CSharp code using LineNumberMappings.json. This requires knowledge of the binary image the frame address corresponds to, which we can already find using the LoadedImages class.

We now send the following per-frame data in Unity stack traces on Cocoa:

{
  "frameAddress": "4395873640",
  "method": "Void Throw()",
  "machoFile": "/private/var/containers/Bundle/Application/D9733826-3F83-4126-9536-BDA4D980DF65/BugsnagUnity.app/Frameworks/UnityFramework.framework/UnityFramework",
  "machoLoadAddress": "4386652160",
  "machoUUID": "4c3afc07-a7af-2036-b53a-18a7828648ef",
  "inProject": true
},

I've written up a HOWTO for mapping this data back to the .cs file and line number.

Testing

Added e2e test that verifies the new frame attributes on cocoa.

@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Nov 19, 2024

Build size impact

Format Size impact of Bugsnag (kB)
IL2CPP APK 2606.47
IL2CPP IPA 1700.21

Generated by 🚫 Danger

@kstenerud kstenerud force-pushed the PLAT-13024-native-stack-trace branch from ffdd333 to dbd06bd Compare December 6, 2024 14:12
Copy link
Contributor

@richardelms richardelms left a comment

Choose a reason for hiding this comment

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

thanks 👍

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.

3 participants