diff --git a/Runtime/BacktraceClient.cs b/Runtime/BacktraceClient.cs index d4a4de21..df8570a8 100644 --- a/Runtime/BacktraceClient.cs +++ b/Runtime/BacktraceClient.cs @@ -1146,8 +1146,14 @@ internal void HandleUnityMessage(string message, string stackTrace, LogType type Type = type }; } + var report = new BacktraceReport(exception); +#if UNITY_ANDROID + if(exception.NativeStackTrace && _useProguard) { + report.UseSymbolication("proguard"); + } +#endif - SendUnhandledExceptionReport(new BacktraceReport(exception), invokeSkipApi); + SendUnhandledExceptionReport(report, invokeSkipApi); } /// diff --git a/Runtime/Model/BacktraceUnhandledException.cs b/Runtime/Model/BacktraceUnhandledException.cs index 882f19d4..c527af07 100644 --- a/Runtime/Model/BacktraceUnhandledException.cs +++ b/Runtime/Model/BacktraceUnhandledException.cs @@ -48,6 +48,14 @@ public override string StackTrace /// public readonly List StackFrames; + /// + /// Returns information if the stack trace is from the native environment (non-Unity) + /// + internal bool NativeStackTrace + { + get; + private set; + } public BacktraceUnhandledException(string message, string stacktrace) : base(message) { @@ -172,6 +180,8 @@ private BacktraceStackFrame ConvertFrame(string frameString, int methodNameEndIn FunctionName = frameString }; } + + NativeStackTrace = true; // add length of the '(' methodStartIndex += 1; var methodArguments = frameString.Substring(methodStartIndex, methodNameEndIndex - methodStartIndex); @@ -250,7 +260,8 @@ private BacktraceStackFrame SetJITStackTraceInformation(string frameString) { stackFrame.Library = stackFrame.FunctionName.Substring(0, libraryNameSeparator).Trim(); stackFrame.FunctionName = stackFrame.FunctionName.Substring(++libraryNameSeparator).Trim(); - } else + } + else { stackFrame.Library = "native"; } diff --git a/Tests/Runtime/BacktraceStackTraceTests.cs b/Tests/Runtime/BacktraceStackTraceTests.cs index 4558e4b0..74d085fa 100644 --- a/Tests/Runtime/BacktraceStackTraceTests.cs +++ b/Tests/Runtime/BacktraceStackTraceTests.cs @@ -345,6 +345,23 @@ public void TestStackTraceCreation_AndroidException_ValidStackTraceObject() } } + [Test] + public void TestNativeStackTraceDetection_AndroidExceptionShouldSetFlag_NativeStackTraceIsSet() + { + var stackTrace = ConvertStackTraceToString(_anrStackTrace); + var exception = new BacktraceUnhandledException(string.Empty, stackTrace); + Assert.IsTrue(exception.NativeStackTrace); + } + + + [Test] + public void TestNativeStackTraceDetection_UnityExceptionShouldNotSetFlag_NativeStackTraceIsNotSet() + { + var stackTrace = ConvertStackTraceToString(_simpleStack); + var exception = new BacktraceUnhandledException(string.Empty, stackTrace); + Assert.IsFalse(exception.NativeStackTrace); + } + [Test] public void TestStackTraceCreation_AndroidMixModeCallStack_ValidStackTraceObject()