Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Commit

Permalink
v2.22.6
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench authored Aug 19, 2019
2 parents 9352a01 + 1192ff5 commit 00543a4
Show file tree
Hide file tree
Showing 22 changed files with 183 additions and 62 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Changelog
=========

## TBD
## 2.22.6 (2019-08-19)

### Enhancements
* (Android) Add support for parsing Hermes stacktraces
[#394](https://github.com/bugsnag/bugsnag-react-native/pull/394)

## Bug fixes
* Make JavaScriptException inherit from BugsnagException
Expand All @@ -13,6 +17,11 @@ Changelog
* Improve ANR error message information
[#553](https://github.com/bugsnag/bugsnag-android/pull/553)

* (iOS) Upgrade bugsnag-cocoa to v5.22.5
* Fix possible crash or deadlock arising from calling Bugsnag.notify() from
multiple queues concurrently.
[#401](https://github.com/bugsnag/bugsnag-cocoa/pull/401)

## 2.22.5 (2019-08-09)

This release add a react-native.config.js file to the package to ensure
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Bugsnag error monitoring & exception reporter for React Native
[![Documentation](https://img.shields.io/badge/documentation-2.22.5-blue.svg)](http://docs.bugsnag.com/platforms/react-native/)
[![Documentation](https://img.shields.io/badge/documentation-2.22.6-blue.svg)](http://docs.bugsnag.com/platforms/react-native/)

Automatic [React Native crash reporting](https://www.bugsnag.com/platforms/react-native-error-reporting/) with Bugsnag helps you detect both native OS and JavaScript errors in your React Native apps.

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ android {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 4
versionName '2.22.5'
versionName '2.22.6'
consumerProguardFiles 'proguard-rules.pro'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
2 changes: 1 addition & 1 deletion cocoa/vendor/bugsnag-cocoa/Source/BugsnagApiClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ - (NSURLSession *)prepareSession {
if (session) {
return session;
} else {
if (self.generatedSession) {
if (!self.generatedSession) {
_generatedSession = [NSURLSession
sessionWithConfiguration:[NSURLSessionConfiguration
defaultSessionConfiguration]];
Expand Down
2 changes: 1 addition & 1 deletion cocoa/vendor/bugsnag-cocoa/Source/BugsnagNotifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#import <AppKit/AppKit.h>
#endif

NSString *const NOTIFIER_VERSION = @"5.22.4";
NSString *const NOTIFIER_VERSION = @"5.22.5";
NSString *const NOTIFIER_URL = @"https://github.com/bugsnag/bugsnag-cocoa";
NSString *const BSTabCrash = @"crash";
NSString *const BSAttributeDepth = @"depth";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,6 @@ - (void)reportUserException:(NSString *)name
terminateProgram);

free(callstack);

// If bsg_kscrash_reportUserException() returns, we did not terminate.
// Set up IDs and paths for the next crash.

self.nextCrashID = [NSUUID UUID].UUIDString;

bsg_kscrash_reinstall(
[self.crashReportPath UTF8String], [self.recrashReportPath UTF8String],
[self.stateFilePath UTF8String], [self.nextCrashID UTF8String]);
}

// ============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ static volatile sig_atomic_t bsg_g_installed = 0;
static BSG_KSCrash_Context bsg_g_crashReportContext = {
.config = {.handlingCrashTypes = BSG_KSCrashTypeProductionSafe}};

/** Path to store the next crash report. */
static char *bsg_g_crashReportFilePath;

/** Path to store the next crash report (only if the crash manager crashes). */
static char *bsg_g_recrashReportFilePath;

/** Path to store the state file. */
static char *bsg_g_stateFilePath;

Expand All @@ -65,7 +59,7 @@ static const int bsg_filepath_len = 512;
static const int bsg_error_class_filepath_len = 21;
static const char bsg_filepath_context_sep = '-';

static inline BSG_KSCrash_Context *crashContext(void) {
BSG_KSCrash_Context *crashContext(void) {
return &bsg_g_crashReportContext;
}

Expand Down Expand Up @@ -118,11 +112,9 @@ int bsg_create_filepath(char *base, char filepath[bsg_filepath_len], char severi
*
* This function gets passed as a callback to a crash handler.
*/
void bsg_kscrash_i_onCrash(char severity, char *errorClass) {
void bsg_kscrash_i_onCrash(char severity, char *errorClass, BSG_KSCrash_Context *context) {
BSG_KSLOG_DEBUG("Updating application state to note crash.");

BSG_KSCrash_Context *context = crashContext();

bsg_kscrashstate_notifyAppCrash(context->crash.crashType);

if (context->config.printTraceToStdout) {
Expand All @@ -131,10 +123,10 @@ void bsg_kscrash_i_onCrash(char severity, char *errorClass) {

if (context->crash.crashedDuringCrashHandling) {
bsg_kscrashreport_writeMinimalReport(context,
bsg_g_recrashReportFilePath);
context->config.recrashReportFilePath);
} else {
char filepath[bsg_filepath_len];
bsg_create_filepath(bsg_g_crashReportFilePath, filepath, severity, errorClass);
bsg_create_filepath((char *)context->config.crashReportFilePath, filepath, severity, errorClass);
bsg_kscrashreport_writeStandardReport(context, filepath);
}
}
Expand Down Expand Up @@ -186,11 +178,12 @@ void bsg_kscrash_reinstall(const char *const crashReportFilePath,
BSG_KSLOG_TRACE("crashID = %s", crashID);

bsg_ksstring_replace((const char **)&bsg_g_stateFilePath, stateFilePath);
bsg_ksstring_replace((const char **)&bsg_g_crashReportFilePath,

BSG_KSCrash_Context *context = crashContext();
bsg_ksstring_replace((const char **)&context->config.crashReportFilePath,
crashReportFilePath);
bsg_ksstring_replace((const char **)&bsg_g_recrashReportFilePath,
bsg_ksstring_replace((const char **)&context->config.recrashReportFilePath,
recrashReportFilePath);
BSG_KSCrash_Context *context = crashContext();
bsg_ksstring_replace(&context->config.crashID, crashID);

if (!bsg_kscrashstate_init(bsg_g_stateFilePath, &context->state)) {
Expand All @@ -206,7 +199,7 @@ BSG_KSCrashType bsg_kscrash_setHandlingCrashTypes(BSG_KSCrashType crashTypes) {
if (bsg_g_installed) {
bsg_kscrashsentry_uninstall(~crashTypes);
crashTypes = bsg_kscrashsentry_installWithContext(
&context->crash, crashTypes, bsg_kscrash_i_onCrash);
&context->crash, crashTypes, (void(*)(char, char *, void *))bsg_kscrash_i_onCrash);
}

return crashTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ void bsg_kscrash_setThreadTracingEnabled(bool threadTracingEnabled);
void bsg_kscrash_setWriteBinaryImagesForUserReported(
bool writeBinaryImagesForUserReported);

/**
* The current crash context
*/
BSG_KSCrash_Context *crashContext(void);

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ typedef struct {
* the report file. Application MUST NOT call async-unsafe methods!
*/
BSGReportCallback onCrashNotify;

/**
* File path to write the crash report
*/
const char *crashReportFilePath;

/**
* File path to write the recrash report, if the crash reporter crashes
*/
const char *recrashReportFilePath;
} BSG_KSCrash_Configuration;

/** Contextual data used by the crash report writer.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef HDR_BSG_KSCrashIdentifier_h
#define HDR_BSG_KSCrashIdentifier_h
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* Generates a new UUID. Not async signal safe. Caller responsible for
* freeing allocated string.
*/
const char *bsg_kscrash_generate_report_identifier(void);
/**
* Generates a new path string. Not async signal safe. Caller responsible
* for freeing allocated string.
*/
const char *bsg_kscrash_generate_report_path(const char *identifier,
bool is_recrash_report);

#ifdef __cplusplus
}
#endif

#endif // HDR_BSG_KSCrashIdentifier_h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#import "BSG_KSCrashIdentifier.h"
#import "BSG_KSCrashAdvanced.h"
#import <Foundation/Foundation.h>
#import <string.h>

const char *bsg_kscrash_generate_report_identifier(void) {
return strdup([[[NSUUID UUID] UUIDString] UTF8String]);
}

const char *bsg_kscrash_generate_report_path(const char *identifier,
bool is_recrash_report) {
if (identifier == NULL) {
return NULL;
}
BSG_KSCrashReportStore *store = [[BSG_KSCrash sharedInstance] crashReportStore];
NSString *reportID = [NSString stringWithUTF8String:identifier];

if (is_recrash_report) {
return strdup([[store pathToRecrashReportWithID:reportID] UTF8String]);
} else {
return strdup([[store pathToFileWithId:reportID] UTF8String]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,11 @@ void bsg_kscrashstate_notifyAppCrash(BSG_KSCrashType type) {
state->backgroundDurationSinceLaunch += duration;
state->backgroundDurationSinceLastCrash += duration;
}
state->crashedThisLaunch |= type != BSG_KSCrashTypeUserReported;
bsg_kscrashstate_i_saveState(state, stateFilePath);
BOOL didCrash = type != BSG_KSCrashTypeUserReported;
state->crashedThisLaunch |= didCrash;
if (didCrash) {
bsg_kscrashstate_i_saveState(state, stateFilePath);
}
}

const BSG_KSCrash_State *const bsg_kscrashstate_currentState(void) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static bool bsg_g_threads_are_running = true;
BSG_KSCrashType
bsg_kscrashsentry_installWithContext(BSG_KSCrash_SentryContext *context,
BSG_KSCrashType crashTypes,
void (*onCrash)(char, char *)) {
void (*onCrash)(char, char *, void *)) {
if (bsg_ksmachisBeingTraced()) {
if (context->reportWhenDebuggerIsAttached) {
BSG_KSLOG_WARN("KSCrash: App is running in a debugger. Crash "
Expand Down Expand Up @@ -200,7 +200,7 @@ void bsg_kscrashsentry_resumeThreads(void) {
}

void bsg_kscrashsentry_clearContext(BSG_KSCrash_SentryContext *context) {
void (*onCrash)(char, char *) = context->onCrash;
void (*onCrash)(char, char *, void *) = context->onCrash;
bool threadTracingEnabled = context->threadTracingEnabled;
bool reportWhenDebuggerIsAttached = context->reportWhenDebuggerIsAttached;
bool suspendThreadsForUserReported = context->suspendThreadsForUserReported;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef struct BSG_KSCrash_SentryContext {
// Caller defined values. Caller must fill these out prior to installation.

/** Called by the crash handler when a crash is detected. */
void (*onCrash)(char, char[21]);
void (*onCrash)(char, char[21], void *);

/** If true, will suspend threads for user reported exceptions. */
bool suspendThreadsForUserReported;
Expand Down Expand Up @@ -162,7 +162,7 @@ typedef struct BSG_KSCrash_SentryContext {
BSG_KSCrashType
bsg_kscrashsentry_installWithContext(BSG_KSCrash_SentryContext *context,
BSG_KSCrashType crashTypes,
void (*onCrash)(char, char *));
void (*onCrash)(char, char *, void *));

/** Uninstall crash sentry.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "BSG_KSCrashSentry_CPPException.h"
#include "BSG_KSCrashSentry_Private.h"
#include "BSG_KSMach.h"
#include "BSG_KSCrashC.h"

//#define BSG_KSLogger_LocalLevel TRACE
#include "BSG_KSLogger.h"
Expand Down Expand Up @@ -181,7 +182,7 @@ static void CPPExceptionTerminate(void) {
BSG_KSLOG_DEBUG(@"Calling main crash handler.");
char errorClass[21];
strncpy(errorClass, bsg_g_context->CPPException.name, sizeof(errorClass));
bsg_g_context->onCrash('e', errorClass);
bsg_g_context->onCrash('e', errorClass, crashContext());

BSG_KSLOG_DEBUG(
@"Crash handling complete. Restoring original handlers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

//#define BSG_KSLogger_LocalLevel TRACE
#include "BSG_KSLogger.h"
#include "BSG_KSCrashC.h"

#if BSG_KSCRASH_HAS_MACH

Expand Down Expand Up @@ -287,7 +288,7 @@ void *ksmachexc_i_handleExceptions(void *const userData) {
BSG_KSLOG_DEBUG("Calling main crash handler.");
char errorClass[21];
strncpy(errorClass, bsg_ksmachexceptionName(bsg_g_context->mach.type), sizeof(errorClass));
bsg_g_context->onCrash('e', errorClass);
bsg_g_context->onCrash('e', errorClass, crashContext());

BSG_KSLOG_DEBUG(
"Crash handling complete. Restoring original handlers.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#import "BSG_KSCrashSentry_NSException.h"
#import "BSG_KSCrashSentry_Private.h"
#include "BSG_KSMach.h"
#include "BSG_KSCrashC.h"

//#define BSG_KSLogger_LocalLevel TRACE
#import "BSG_KSLogger.h"
Expand Down Expand Up @@ -130,7 +131,7 @@ void bsg_recordException(NSException *exception) {
BSG_KSLOG_DEBUG(@"Calling main crash handler.");
char errorClass[21];
strncpy(errorClass, bsg_g_context->NSException.name, sizeof(errorClass));
bsg_g_context->onCrash('e', errorClass);
bsg_g_context->onCrash('e', errorClass, crashContext());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "BSG_KSMach.h"
#include "BSG_KSSignalInfo.h"
#include "BSG_KSCrashC.h"

//#define BSG_KSLogger_LocalLevel TRACE
#include "BSG_KSLogger.h"
Expand Down Expand Up @@ -118,7 +119,8 @@ void bsg_kssighndl_i_handleSignal(int sigNum, siginfo_t *signalInfo,
errorClass[i] = c;
}
}
bsg_g_context->onCrash('e', errorClass);

bsg_g_context->onCrash('e', errorClass, crashContext());

BSG_KSLOG_DEBUG(
"Crash handling complete. Restoring original handlers.");
Expand Down
Loading

0 comments on commit 00543a4

Please sign in to comment.