diff --git a/Runtime/BacktraceClient.cs b/Runtime/BacktraceClient.cs index 89df8d80..2a63974d 100644 --- a/Runtime/BacktraceClient.cs +++ b/Runtime/BacktraceClient.cs @@ -66,6 +66,19 @@ internal AttributeProvider AttributeProvider } } +#if UNITY_ANDROID + private bool _useProguard = false; + + /// + /// Allow to enable Proguard support for captured Exceptions. + /// + /// Proguard map symbolication id + public void UseProguard(String symbolicationId) { + _useProguard = true; + AttributeProvider["symbolication_id"] = symbolicationId; + } +#endif + #if !UNITY_WEBGL private BacktraceMetrics _metrics; @@ -971,7 +984,11 @@ internal void OnAnrDetected(string stackTrace) { Breadcrumbs.FromMonoBehavior(anrMessage, LogType.Warning, new Dictionary { { "stackTrace", stackTrace } }); } - SendUnhandledException(hang); + var report = new BacktraceReport(hang); + if (_useProguard) { + report.UseSymbolication("proguard"); + } + SendUnhandledExceptionReport(report); } /// @@ -988,15 +1005,20 @@ internal void HandleUnhandledExceptionsFromAndroidBackgroundThread(string backgr } var message = backgroundExceptionMessage.Substring(0, splitIndex); var stackTrace = backgroundExceptionMessage.Substring(splitIndex); + var report = new BacktraceReport(new BacktraceUnhandledException(message, stackTrace)); + if (_useProguard) { + report.UseSymbolication("proguard"); + } + if (Database != null) { - var backtraceData = new BacktraceReport(new BacktraceUnhandledException(message, stackTrace)).ToBacktraceData(null, GameObjectDepth); + var backtraceData = report.ToBacktraceData(null, GameObjectDepth); AttributeProvider.AddAttributes(backtraceData.Attributes.Attributes); Database.Add(backtraceData); } else { - HandleUnityMessage(message, stackTrace, LogType.Exception); + SendUnhandledExceptionReport(report); } var androidNativeClient = _nativeClient as Runtime.Native.Android.NativeClient; if (androidNativeClient != null) @@ -1125,7 +1147,7 @@ internal void HandleUnityMessage(string message, string stackTrace, LogType type }; } - SendUnhandledException(exception, invokeSkipApi); + SendUnhandledExceptionReport(new BacktraceReport(exception), invokeSkipApi); } /// @@ -1142,15 +1164,15 @@ private bool SamplingShouldSkip() return value > Configuration.Sampling; } - private void SendUnhandledException(BacktraceUnhandledException exception, bool invokeSkipApi = true) + private void SendUnhandledExceptionReport(BacktraceReport report, bool invokeSkipApi = true) { if (OnUnhandledApplicationException != null) { - OnUnhandledApplicationException.Invoke(exception); + OnUnhandledApplicationException.Invoke(report.Exception); } - if (ShouldSendReport(exception, null, null, invokeSkipApi)) + if (ShouldSendReport(report.Exception, null, null, invokeSkipApi)) { - SendReport(new BacktraceReport(exception)); + SendReport(report); } } diff --git a/Runtime/Model/BacktraceData.cs b/Runtime/Model/BacktraceData.cs index d0b35219..be402cee 100644 --- a/Runtime/Model/BacktraceData.cs +++ b/Runtime/Model/BacktraceData.cs @@ -82,6 +82,11 @@ internal string UuidString /// public string[] Classifier; + /// + /// Symbolication method + /// + public String Symbolication; + /// /// Source code information. /// @@ -125,6 +130,7 @@ public BacktraceData(BacktraceReport report, Dictionary clientAt Uuid = Report.Uuid; Timestamp = Report.Timestamp; Classifier = Report.ExceptionTypeReport ? new[] { Report.Classifier } : new string[0]; + Symbolication = report.Symbolication; SetAttributes(clientAttributes, gameObjectDepth); SetThreadInformations(); @@ -152,6 +158,11 @@ public string ToJson() jObject.Add("attributes", Attributes.ToJson()); jObject.Add("annotations", Annotation.ToJson()); jObject.Add("threads", ThreadData.ToJson()); + + if (!String.IsNullOrEmpty(Symbolication)) { + jObject.Add("symbolication", Symbolication); + } + if (SourceCode != null) { jObject.Add("sourceCode", SourceCode.ToJson()); diff --git a/Runtime/Model/BacktraceReport.cs b/Runtime/Model/BacktraceReport.cs index 88c3e00e..a85f55cc 100644 --- a/Runtime/Model/BacktraceReport.cs +++ b/Runtime/Model/BacktraceReport.cs @@ -71,6 +71,11 @@ public class BacktraceReport /// public List DiagnosticStack { get; set; } + /// + /// Current report symbolication method + /// + public String Symbolication { get; set; } + /// /// Source code /// @@ -119,6 +124,14 @@ public BacktraceReport( SetDefaultAttributes(); } + + /// + /// Sets report symbolication type + /// + public void UseSymbolication(String symbolication) { + Symbolication = symbolication; + } + private void SetDefaultAttributes() { Attributes["error.message"] = Message;