Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1d55b41
iOS integration - full path
Sep 24, 2020
f894622
Improved code quality
Sep 24, 2020
0a35759
Unity IDE integration
Sep 24, 2020
1ce378a
readme, changelog updates + version bump
Sep 24, 2020
b72f625
Squashed commit of the following:
Sep 24, 2020
22d86fd
Merge branch 'master' into feature/ios
konraddysput Sep 24, 2020
ae886c3
Added TOC and updated iOS details
Sep 25, 2020
e8e4cc0
iOS updates.
Sep 25, 2020
28e0f86
iOS Updates
Sep 25, 2020
47e4712
fixed iOS native client
konraddysput Sep 30, 2020
b410fe4
Extended iOS integration
Oct 7, 2020
0478cec
Adjusted C# API
Oct 7, 2020
2ffed35
Swift posst processor modification
Oct 7, 2020
e64a1c3
Comment not supported integration
Oct 7, 2020
e3773b6
Unity iOS native attributes
Oct 13, 2020
6d91966
Setup report attributes
Oct 13, 2020
b40c268
cleanup logs
Oct 13, 2020
de049f8
Fixed line endinging in the iOS nativeClient
konraddysput Oct 14, 2020
44b29e0
Preparing production ready integration - handing specific cases
Oct 16, 2020
a383c25
revert Unity standalne plcrashreporter support
Oct 16, 2020
0fb3f4b
Removed mac file
Oct 16, 2020
cf8ccc2
Squashed commit of the following:
konraddysput Oct 19, 2020
a576e2d
Removed unused meta file
konraddysput Oct 19, 2020
582a422
Updated ndk libraries
konraddysput Oct 19, 2020
68fab41
Changelog update
konraddysput Oct 19, 2020
2529856
Added error.type to Unity runtime
konraddysput Oct 20, 2020
deeddcd
uname.sysname update
konraddysput Oct 28, 2020
0f64360
iOS integration with Backtrace-Cococa objective-c static library
konraddysput Nov 4, 2020
413338e
Applied platform to ios lib
konraddysput Nov 4, 2020
d4f15f1
Changed attribute to error.type
konraddysput Nov 4, 2020
83694e4
Merge branch 'feature/ios' of https://github.com/backtrace-labs/backt…
konraddysput Nov 4, 2020
62712cb
Updated package version
konraddysput Nov 4, 2020
59f959f
Merged uname.sysname
konraddysput Nov 4, 2020
a0efbdb
Merge branch 'feature/error.type' into feature/ios
konraddysput Nov 4, 2020
2e43bc4
ndk-update merge
konraddysput Nov 4, 2020
cfcf69a
Updated changelog
konraddysput Nov 4, 2020
72bfde4
Fixed readme conflict
konraddysput Nov 4, 2020
34272da
Added support for arm7
konraddysput Nov 4, 2020
45f8766
Final library update
konraddysput Nov 4, 2020
db029eb
Updated readme - disable crashreport api
konraddysput Nov 4, 2020
aa62203
updated error.type attributes
konraddysput Nov 4, 2020
7eed4c1
Updated changelog
konraddysput Nov 4, 2020
2b50807
Renamed tvOS
konraddysput Nov 4, 2020
2240e99
Updated changelog
Nov 4, 2020
507ca34
Fixed meta file
konraddysput Nov 4, 2020
2ad9531
Merge branch 'feature/ios' of https://github.com/backtrace-labs/backt…
konraddysput Nov 4, 2020
ef860a2
Added iOS Native memory details
Nov 10, 2020
b38698d
Promoting to latest
Nov 11, 2020
dd9c74e
Version update
konraddysput Nov 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed Android/lib/arm64-v8a/libbacktrace-crashpad.so
Binary file not shown.
Binary file added Android/lib/arm64-v8a/libbacktrace-native.so
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Android/lib/armeabi-v7a/libbacktrace-crashpad.so
Binary file not shown.
Binary file added Android/lib/armeabi-v7a/libbacktrace-native.so
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed Android/lib/x86/libbacktrace-crashpad.so
Binary file not shown.
Binary file added Android/lib/x86/libbacktrace-native.so
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Backtrace Unity Release Notes

## Version 3.2.0
- This release adds the ability to capture native iOS crashes from Unity games deployed to iOS. The Backtrace Configuration now exposes a setting for games being prepared for iOS to choose `Capture native crashes`. When enabled, the backtrace-unity client will capture and submit native iOS crashes to the configured Backtrace instance. To generate human readable callstacks, game programmers will need to generate and upload appropriate debug symbols.
- Added default uname.sysname attributes for some platforms. The following is the list of uname.sysname platforms that can be populated. list "Android, IOS, Linux, Mac OS, ps3, ps4, Samsung TV, tvOS, WebGL, WiiU, Switch, Xbox". Note 'Switch' had previously been reported as 'switch'
- Added a new attribute 'error.type' that allows developers to quickly filter error reports based on the type of error - The list includes "Crash, Message, Hang, Unhandled Exception, Exception".
- Updated Android NDK libraries used by Unity plugin.

## Version 3.1.2
- `BacktraceData` allows to edit list of environment variables collected by `BacktraceAnnotations`
- `SourceCode` object description for PII purpose
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation~/images/dsym-files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Editor/BacktraceConfigurationEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public override void OnInspectorGUI()

#endif

#if UNITY_ANDROID
#if UNITY_ANDROID || UNITY_IOS
EditorGUILayout.PropertyField(
serializedObject.FindProperty("CaptureNativeCrashes"),
new GUIContent(BacktraceConfigurationLabels.CAPTURE_NATIVE_CRASHES));
Expand Down
8 changes: 8 additions & 0 deletions Editor/Native.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Editor/Native/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
114 changes: 78 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@

# Backtrace Unity support

[Backtrace](http://backtrace.io/)'s integration with Unity allows developers to capture and report handled and unhandled Unity exceptions and crashes to their Backtrace instance, instantly offering the ability to prioritize and debug software errors.

[github release]: (https://github.com/backtrace-labs/backtrace-labs/)

- [Features Summary <a name="features-summary"></a>](#features-summary--a-name--features-summary----a-)
- [Prerequisites](#prerequisites)
- [Platforms Supported](#platforms-supported)
- [Setup <a name="installation"></a>](#setup--a-name--installation----a-)
- [Android Specific information](#android-specific-information)
- [iOS Specific information](#ios-specific-information)
- [API Overview](#api-overview)
- [Architecture description](#architecture-description)
- [Investigating an Error in Backtrace](#investigating-an-error-in-backtrace)


## Usage

```csharp
Expand All @@ -19,15 +31,23 @@ catch(Exception exception){
}
```

# Features Summary <a name="features-summary"></a>

- Light-weight Unity client that quickly submits crashed generated in Unity environment to your Backtrace dashboard
- Can include callstack, system metadata, custom metadata, custom attributes and file attachments if needed
- Supports a wide range of unity version and environments
- Supports .NET 2.0/3.5/4.5/Standard 2.0 Backend, IL2CPP and Mono environments
- Supports offline database for error report storage and re-submission in case of network outage
- Fully customizable and extendable event handlers
- Custom IDE integrations
# Feature Summary <a name="features-summary"></a>

- Lightweight library that quickly submits handled and unhandled exceptions and crashes to Backtrace
- Supports wide range of Unity versions (2017.4+) and deployments (iOS, Android, Windows, Mac, WebGL, PS4, Xbox, Switch, Stadia)
- Install via Universal Package Manager
- Collect detailed context
- Callstacks, including function names and line numbers where possible
- System metadata including device GUID, OS version, memory usage, process age
- Custom metadata including app version, scene info, device drivers
- Last # log lines, screenshots, log or config files, other attachments
- Android NDK Crashes; iOS Native Crashes, Windows Native Crashes
- Client-side features
- Deduplication options and custom client side fingerprinting
- Offline crash capture/storage for future collection
- Customizable event handlers and base classes, Client side filters
- Performance statistics collection option for timing observability
- Unity IDE integration to configure Backtrace behaviors in your game.

# Prerequisites

Expand All @@ -44,7 +64,7 @@ Game Consoles - PlayStation4, Xbox One, Nintendo Switch
There are some differences in capabilities that backtrace-unity provides based on the platform. Major capabilities are summarized as follows:
* All Platforms - Unhandled Exceptions, Handled Exceptions, Custom Indexable Metadata, File Attachments*, Last N Log Lines, Automatic attachment of Screenshots, Client Side Deduplication Rules*, Client Side Submission Filtering, Client Side Submission Limits, Performance Diagnostics, Offline Database*(Except Nintendo Switch)
* Android -Identified by attribute uname.sysname = Android; ANRs (Hangs), Native Process and Memory Information, Java Exception Handler (Plugins, Exported Game in Android Studio), NDK crashes.
* iOS - Identified by attribute uname.sysname = IOS
* iOS - Identified by attribute uname.sysname = IOS; Native Engine and Plugin Crashes.
* WebGL - Identified by attribute uname.sysname = WebGL. The attribute device.model is currently used to share the browser information.
* Switch - Identified by attribute uname.sysname = Switch. Note that the attribute GUID is regenerated with each Switch restart (It is not an accurate count of number of Users or Devices. It is a count of Switch Sessions). Note that the current release does no support Offline Database or related features.
* PlayStation4 - Identified by attribute uname.sysname = PS4
Expand Down Expand Up @@ -99,7 +119,7 @@ The following is a reference guide to the Backtrace Client fields:
`${Application.persistentDataPath}/backtrace/database` to dynamically look up a known directory structure to use. NOTE: Backtrace database will remove all existing files in the database directory upion first initialization.
- Create database directory toggle: If toggled, the library will create the offline database directory if the provided path doesn't exists,
- Client-side deduplication: Backtrace-unity plugin allows you to combine the same reports. By using deduplication rules, you can tell backtrace-unity plugin how we should merge reports.
- Capture native crashes: This option will appear for games being deployed to Android and will allow Backtrace to capture and symbolicate native stack traces from crashes impacting the Unity Engine or any Unity Engine Plugin.
- Capture native crashes: This option will appear for games being deployed to Android or iOS and will allow Backtrace to capture and symbolicate native stack traces from crashes impacting the Unity Engine or any Unity Plugin.
- Minidump type: Type of minidump that will be attached to Backtrace report in the report generated on Windows machine.
- Attach Unity Player.log: Add Unity player log file to Backtrace report. NOTE: This feature is available only on desktop - Windows/MacOS/Linux.
- Attach screenshot: Generate and attach screenshot of frame as exception occurs.
Expand All @@ -109,6 +129,53 @@ The following is a reference guide to the Backtrace Client fields:
- Retry interval: If the database is unable to send its record, this setting specifies how many seconds the library should wait between retries.
- Maximum retries: If the database is unable to send its record, this setting specifies the maximum number of retries before the system gives up.
- Retry order: This specifies in which order records are sent to the Backtrace server.
# Android Specific information

The backtrace-unity library includes support for capturing Android NDK crashes and additional Android Native information, from underlying Android OS (Memory and process related), JNI, and NDK layers.

## Native process and memory related information

system.memory usage related information including memfree, swapfree, and vmalloc.used is now available. Additional VM details and voluntary / nonvountary ctxt switches are included.

## ANR

When configuring the backtrace-unity client for an Android deployment, programmers will have a toggle available in backtrace-unity GUI in the Unity Editor to enable or disable ANR reports. This will use the default of 5 seconds.

## Symbols upload

Unity allows developer to generate symbols archive called `symbols.zip` in the il2cpp build pipeline in the root directory of your game. In this archive you can find generated symbols for your game libraries. When your game crashes due to a native exception, your stack trace will contain only memory addresses instead of function name. Symbols from `symbols.zip` archive allows Backtrace to match function address to function name in your source code.

To generate `symbols.zip` archive make sure:
* you selected il2cpp build,
* you checked `Create symbols.zip` in the Build settings window
![Create symbols.zip](./Documentation~/images/symbols.png)

To upload symbols to Backtrace, you need to rename symbols generated by Unity end simply with a `.so` extension. By default, symbol files within the .zip will end with extension `.sym.so`. or `.dbg.so` Backtrace will only match symbols to files based on the ending with `.so` extension. Please ensure all files have a single `.so` extention before uploading the zip. To upload symbols please go to your project settings, to the `Upload an archive` tab under `Symbols` section.

Backtrace offers to upload symbols automatically from Unity Editor to your Backtrace instance. Backtrace symbols upload pipeline will be triggered after successfull build of il2cpp Android game and when Symbols upload token is available in Backtrace Client options. After successfull build, upload pipeline will confirm symbols upload.

# iOS Specific information
The backtrace-unity library includes support for capturing native iOS crashes as well as iOS native memory and process information from underlying iOS layer.

## Native process and memory related information

system and vm usage related information including system.memory.free, system.memory.used, system.memory.total, system.memory.active, system.memory.inactive, system.memory.wired are avaialble.

## Native Crashes
When configuring the backtrace-unity client for an iOS deployment in the Unity Editor, programmers will have a toggle to enable or disable `Capture native crashes`. If this is enabled, the backtrace-unity client will ensure the crash report is generated, stored locally, and uploaded upon next game start. Unity crash reporter might prevent Backtrace Crash reporte from sending crashes to Backtrace. To be sure Backtrace is able to collect and send data please set "Enable CrashReport API" to false.
![Enable symbols](./Documentation~/images/Disable-ios-unity-crash-reporter.png)

## Debug Symbol upload
When building your iOS game in Xcode, you must make sure you configure the build settings to generate "`DWARF with dSYM files` for any build that you want to debug with Backtrace (By default, it may only generate `DWARF`). In the example below, `DWARF with dSYM files` is enabled in the `Project Build Settings` for each `Target`.
![Enable symbols](./Documentation~/images/xCode-enable-debugging-symbols.png)

This change will generate dSYM files every time you build your game in Xcode. You can find the files in the `...\Build\Products\<the folder representing your build>`. Within there will be dSYM files that you should compress into a .zip file and submit to Backtrace for use during symbolication.

![pack symbols](./Documentation~/images/dsym-files.png)

To learn more about how to submit those symbol files to Backtrace, please see the Project Settings / Symbols. You can manage submission tokens, upload via the UI, or configure external Symbol Servers to connect and discover required symbols. Please review additional Symbol documentaion at https://support.backtrace.io/hc/en-us/articles/360040517071-Symbolication-Overview



# API Overview

Expand Down Expand Up @@ -301,31 +368,6 @@ Notes:
- `BacktraceDatabase` `Count` method will return number of all records stored in database (included deduplicated records),
- `BacktarceDatabase` `Delete` method will remove record (with multiple deduplicated records) at the same time.

# Android Specific information

The backtrace-unity library includes support for capturing additional Android Native information, from underlying Android OS (Memory and process related), JNI, and NDK layers.

## Native process and memory related information

system.memory usage related information including memfree, swapfree, and vmalloc.used is now available. Additional VM details and voluntary / nonvountary ctxt switches are included.

## ANR

When configuring the backtrace-unity client for an Android deployment, programmers will have a toggle available in backtrace-unity GUI in the Unity Editor to enable or disable ANR reports. This will use the default of 5 seconds.

## Symbols upload

Unity allows developer to generate symbols archive called `symbols.zip` in the il2cpp build pipeline in the root directory of your game. In this archive you can find generated symbols for your game libraries. When your game crashes due to a native exception, your stack trace will contain only memory addresses instead of function name. Symbols from `symbols.zip` archive allows Backtrace to match function address to function name in your source code.

To generate `symbols.zip` archive make sure:
* you selected il2cpp build,
* you checked `Create symbols.zip` in the Build settings window
![Create symbols.zip](./Documentation~/images/symbols.png)

To upload symbols to Backtrace, you need to rename symbols generated by Unity end simply with a `.so` extension. By default, symbol files within the .zip will end with extension `.sym.so`. or `.dbg.so` Backtrace will only match symbols to files based on the ending with `.so` extension. Please ensure all files have a single `.so` extention before uploading the zip. To upload symbols please go to your project settings, to the `Upload an archive` tab under `Symbols` section.

Backtrace offers to upload symbols automatically from Unity Editor to your Backtrace instance. Backtrace symbols upload pipeline will be triggered after successfull build of il2cpp Android game and when Symbols upload token is available in Backtrace Client options. After successfull build, upload pipeline will confirm symbols upload.

# Architecture description

## BacktraceReport <a name="architecture-BacktraceReport"></a>
Expand Down
12 changes: 6 additions & 6 deletions Runtime/Common/SystemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal static bool IsLibraryAvailable(string[] libraries)
/// </summary>
/// <param name="architecture">System architecture</param>
/// <returns>System name</returns>
internal static string Name(string architecture)
internal static string Name()
{
#pragma warning disable CS0618 // Type or member is obsolete
switch (Application.platform)
Expand All @@ -80,20 +80,20 @@ internal static string Name(string architecture)
case RuntimePlatform.OSXPlayer:
return "Mac OS";
case RuntimePlatform.PS3:
return "PS3";
return "ps3";
case RuntimePlatform.PS4:
return "PS4";
return "ps4";
case RuntimePlatform.TizenPlayer:
case RuntimePlatform.SamsungTVPlayer:
return "Samsung TV";
case RuntimePlatform.tvOS:
return "Apple tvOS";
return "tvOS";
case RuntimePlatform.WebGLPlayer:
return "WebGL";
case RuntimePlatform.WiiU:
return "WiiU";
case RuntimePlatform.Switch:
return "Switch";
return "switch";
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
case RuntimePlatform.WSAPlayerARM:
Expand All @@ -104,7 +104,7 @@ internal static string Name(string architecture)
case RuntimePlatform.XboxOne:
return "Xbox";
default:
return "NaCl";
return Application.platform.ToString();
}
}

Expand Down
5 changes: 2 additions & 3 deletions Runtime/Json/BacktraceJObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ public object this[string key]
/// <returns>BacktraceJObject JSON representation</returns>
public string ToJson()
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine("{");
var stringBuilder = new StringBuilder("{");

var lines = Source.Select(entry => string.Format("\"{0}\": {1}", EscapeString(entry.Key), ConvertValue(entry.Value)));
var content = string.Join(",", lines);

stringBuilder.Append(content);
stringBuilder.AppendLine("}");
stringBuilder.Append("}");

return stringBuilder.ToString();
}
Expand Down
22 changes: 16 additions & 6 deletions Runtime/Model/BacktraceConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,28 @@ public class BacktraceConfiguration : ScriptableObject
[Tooltip("Try to find game native crashes and send them on Game startup")]
public bool SendUnhandledGameCrashesOnGameStartup = true;

#if UNITY_ANDROID || UNITY_IOS
#if UNITY_ANDROID
/// <summary>
/// Handle ANR events - Application not responding
/// </summary>
[Tooltip("Handle ANR events - Application not responding")]
public bool HandleANR = true;

/// <summary>
/// Capture native NDK Crashes.
/// </summary>
[Tooltip("Capture native NDK Crashes (ANDROID API 21+)")]
#elif UNITY_IOS
/// <summary>
/// Capture native iOS Crashes.
/// </summary>
[Tooltip("Capture native Crashes")]
#endif

public bool CaptureNativeCrashes = true;
#endif

#if UNITY_ANDROID
/// <summary>
/// Handle ANR events - Application not responding
/// </summary>
[Tooltip("Handle ANR events - Application not responding")]
public bool HandleANR = true;

#if UNITY_2019_2_OR_NEWER
/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions Runtime/Model/BacktraceCredentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ public Uri GetSubmissionUrl()
return uriBuilder.Uri;
}

public Uri GetPlCrashReporterSubmissionUrl()
{
var url = GetSubmissionUrl().ToString();
var plCrashReporterUrl = url.IndexOf("submit.backtrace.io") != -1
? url.Replace("/json", "/plcrash")
: url.Replace("format=json", "format=plcrash");
var uriBuilder = new UriBuilder(plCrashReporterUrl);
return uriBuilder.Uri;
}

/// <summary>
/// Create minidump submission url to Backtrace API
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Model/BacktraceData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class BacktraceData
/// <summary>
/// Version of the C# library
/// </summary>
public const string AgentVersion = "3.1.2";
public const string AgentVersion = "3.2.0";

/// <summary>
/// Application thread details
Expand Down
Loading