Skip to content

Commit c9704d1

Browse files
konraddysputjasoncdavis0Dautery91vlussenburg
authored
Version 3.7.0 (#121)
* .NET 3.5 backward compatibility (#93) * Backward compatibility * Annotations test isolation * Removed not used anymore variable * Version bump * iOS Support * Safe enum comparision x64 vs x86 * variable name improvements * Version bump * client side unwinding (#95) * Client side unwinding * Client side unwinding - initialze client side unwinding with the crashpad database path * Adjust client side unwinding to the newest api * Libraries update * Removed new lines * removed unused function * Update CHANGELOG.md * Update README.md * Expose unwinding in the Backtrace UI * native client updates - ignore anrs on the debug mode, don't generate oom reports when memory warning occurred + fixed structure calculation * 3.6.0-preview.0 * Added client side unwinding details. * Update CHANGELOG.md * Add files via upload * Delete Backtrace Panel Native Crashes.png * Add files via upload * Update README.md * Add files via upload * Update README.md * Windows native support (#97) * Windows native support * Removed debugging information from native libraries, improved scoped attributes for unity crash reporting tool, improved attributes support for minidump/json query params, native client improvements + tests * Breadcrumbs support from previous session (when multiple crashes occurred in the previous session * Removed comment * Attribute cache * Source Code integration (#98) * Bring back source code support * .NET 3.5 support * Fixed every typo 'Untiy' * Include source code in each frame * Version bump * Preview 3: Fixes compilation issues on platforms without native client * Preview 3: version bump * Remove class instance on OnDestroy method and move disabing native integration code outside #ifdef * Enable by default metrics support * event agg documentation clarification (#99) Updated a few bits in the readme to clarify a question a customer had. * Enable client side unwinding + CSU switch * Enable client side unwinding flag available outside Android env * Adjusted .meta files * Adjusted win libraries * Client side unwinding only for unity 2019 * Version bump * Update README.md * Update README.md * Client side unwinding improvements (#107) * Version 3.6.1 preparation * Changelog update * Changelog typo * Multiselect dropdown support (#111) * Multiselect dropdown support * Typo * Typo * Escape control characters (#109) * Escape control characters * Test JSON escaping * Keep unicode function private * Backtrace thread API improvements (#110) * Do not use unity api in background threads or in methods that can use background threads * Handle database path invalid initialization * Typo * Changelog and version update * Handle enum flag options that can generate bigger value than int32 (#113) * Prevent from changing source code collection while jobject iterate over it (#112) * Readme update to include Windows specific information * Update README.md Reference to released NDK16b version * Update README.md * Update CHANGELOG.md * Print warning when filter is set to all (#116) * Unity 2018 and older ndk warning (#115) * Unity 2018 and older ndk warning * Uncommented ifdef * Correct warning message * Update BacktraceConfigurationEditor.cs * Apply warning only to unity version older than 2019 * Editor sampling (#118) * Disable error reporting in editor mode (#119) * Disable Backtrace reporting in Editor * Do not send crashes on the editor startup * Test * Moved tests to separated file + added tests for unhandled exceptions * Background exception handler (#117) * Background exception handler * Correct ANR disable message * CrashHelper funcitons * Code review suggestions * Set database path by default and create database directory (#124) * Disable NDK integration on Application.Exit (#120) * Disable NDK integration on Application.Exit * The latest verison of the backtrace-android binaries * Memory attributes (#122) * Fixed unit tests after merge + fixed .meta file creation + improved code comments * Version 3.7.0-preview.1 changelog + version bump * Binaries update (#126) * Remove Android dependencies on non-Android platforms (#125) * Removed android dependencies + preprocesor directive for android native client * Update NativeClient.cs * Do the same for WindowS * Version update * Prevent from using modern C# API (#127) * Decrease default texture quality (#129) * Texture quality * Always apply quality settings * Formatting changes * Breadcrumbs initialization improvements (#128) * Breadcrumbs initialization improvements * Do not ignore EnableBreadcurmbsSupport flag * Address code review suggestions + support for None * Label update * Breadcrumbs ANR support (#130) * Breadcrumbs ANR support * Keep things private * Update CHANGELOG.md * Code review suggestions Co-authored-by: Vincent Lussenburg <[email protected]> * New preview version * Disable integration on app.exit (#131) * Disable integration on app.exit * Update ios binaries after cr * Version 3.7.0 update Co-authored-by: jasoncdavis0 <[email protected]> Co-authored-by: Drake Autery <[email protected]> Co-authored-by: Vincent Lussenburg <[email protected]>
1 parent 971d552 commit c9704d1

File tree

52 files changed

+1053
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1053
-381
lines changed

Android/BacktraceANRWatchdog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public static void printStackTrace(StackTraceElement[] stackTrace, PrintWriter p
126126
}
127127
}
128128

129-
public void stopMonitoringAnr() {
130-
Log.d(LOG_TAG, "Stop monitoring ANR");
129+
public void stopMonitoring() {
130+
Log.d(LOG_TAG, "ANR handler has been disabled.");
131131
shouldStop = true;
132132
}
133133
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package backtrace.io.backtrace_unity_android_plugin;
2+
3+
import android.os.Build;
4+
import android.os.Looper;
5+
import android.util.Log;
6+
7+
import com.unity3d.player.UnityPlayer;
8+
9+
import java.io.PrintWriter;
10+
import java.io.StringWriter;
11+
12+
/**
13+
* Handle unhandled Android exceptions from background threads.
14+
*/
15+
public class BacktraceAndroidBackgroundUnhandledExceptionHandler implements Thread.UncaughtExceptionHandler{
16+
private final static transient String LOG_TAG = BacktraceAndroidBackgroundUnhandledExceptionHandler.class.getSimpleName();
17+
private final Thread.UncaughtExceptionHandler mRootHandler;
18+
19+
/**
20+
* Check if data shouldn't be reported.
21+
*/
22+
private volatile boolean shouldStop = false;
23+
24+
private final String _gameObject;
25+
private final String _methodName;
26+
27+
public BacktraceAndroidBackgroundUnhandledExceptionHandler(String gameObject, String methodName) {
28+
Log.d(LOG_TAG, "Initializing Android unhandled exception handler");
29+
this._gameObject = gameObject;
30+
this._methodName = methodName;
31+
32+
mRootHandler = Thread.getDefaultUncaughtExceptionHandler();
33+
Thread.setDefaultUncaughtExceptionHandler(this);
34+
}
35+
36+
@Override
37+
public void uncaughtException(Thread thread, Throwable exception) {
38+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE && mRootHandler != null && shouldStop == false) {
39+
if(Looper.getMainLooper().getThread().getId() == thread.getId()) {
40+
// prevent from sending exception happened to main thread - we will catch them via unity logger
41+
return;
42+
}
43+
String exceptionType = exception.getClass().getName();
44+
Log.d(LOG_TAG, "Detected unhandled background thread exception. Exception type: " + exceptionType + ". Reporting to Backtrace");
45+
ReportThreadException(exceptionType + " : " + exception.getMessage(), stackTraceToString(exception.getStackTrace()));
46+
}
47+
}
48+
49+
public void ReportThreadException(String message, String stackTrace) {
50+
UnityPlayer.UnitySendMessage(this._gameObject, this._methodName, message + '\n' + stackTrace);
51+
}
52+
53+
private static String stackTraceToString(StackTraceElement[] stackTrace) {
54+
StringWriter sw = new StringWriter();
55+
printStackTrace(stackTrace, new PrintWriter(sw));
56+
return sw.toString();
57+
}
58+
59+
private static void printStackTrace(StackTraceElement[] stackTrace, PrintWriter pw) {
60+
for(StackTraceElement stackTraceEl : stackTrace) {
61+
pw.println(stackTraceEl);
62+
}
63+
}
64+
65+
public void stopMonitoring() {
66+
Log.d(LOG_TAG, "Uncaught exception handler has been disabled.");
67+
shouldStop = true;
68+
}
69+
}

Android/BacktraceAndroidBackgroundUnhandledExceptionHandler.java.meta

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Android/BacktraceCrashHelper.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66

77

88
public class BacktraceCrashHelper {
9+
10+
public void throwRuntimeException() {
11+
Log.d("BacktraceCrashHelper", "Throwing runtime exception");
12+
throw new RuntimeException("Unity-test: Uncaught JVM exception");
13+
}
14+
15+
public void throwBackgroundJavaException() {
16+
Log.d("BacktraceCrashHelper", "throwing an unhandled background java exception");
17+
new Thread(new Runnable() {
18+
@Override
19+
public void run() {
20+
int[] numbers = {10, 20, 30, 40};
21+
Log.d("BacktraceCrashHelper", String.valueOf(numbers[5]));
22+
}
23+
}).start();
24+
}
25+
926
public static void StartAnr() {
1027
Log.d("BacktraceCrashHelper", "Starting ANR");
1128
Handler handler = new Handler(Looper.getMainLooper());
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)