-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46ab256
commit a0b7291
Showing
6 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cmake_minimum_required(VERSION 3.4.1) | ||
|
||
set(THIRD_PARTY_DIR "${CMAKE_SOURCE_DIR}/libs") | ||
set(THIRD_PARTY_LIB_DIR "${THIRD_PARTY_DIR}/libs") | ||
set(THIRD_PARTY_INCLUDE_DIR "${THIRD_PARTY_DIR}/include") | ||
|
||
include_directories( | ||
${THIRD_PARTY_INCLUDE_DIR}/breakpad/breakpad | ||
) | ||
|
||
add_library(breakpad STATIC IMPORTED) | ||
set_target_properties(breakpad PROPERTIES IMPORTED_LOCATION ${THIRD_PARTY_LIB_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libbreakpad_client.a) | ||
|
||
find_library( | ||
log-lib | ||
log ) | ||
|
||
add_library( | ||
nativecrashhandler | ||
SHARED | ||
CrashHandler.cpp ) | ||
|
||
target_link_libraries( | ||
nativecrashhandler | ||
breakpad | ||
${log-lib} ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "client/linux/handler/exception_handler.h" | ||
#include "client/linux/handler/minidump_descriptor.h" | ||
#include <jni.h> | ||
#include <android/log.h> | ||
|
||
/* | ||
* Triggered automatically after an attempt to write a minidump file to the breakpad folder. | ||
*/ | ||
static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor, | ||
void *context, | ||
bool succeeded) { | ||
|
||
// Allow system to log the native stack trace. | ||
__android_log_print(ANDROID_LOG_INFO, "CelestiaCrashReporter", | ||
"Wrote breakpad minidump at %s succeeded=%d\n", descriptor.path(), | ||
succeeded); | ||
return false; | ||
} | ||
|
||
extern "C" | ||
JNIEXPORT void JNICALL | ||
Java_space_celestia_mobilecelestia_utils_CrashHandler_setupNativeCrashesListener(JNIEnv *env, | ||
jclass clazz, | ||
jstring path) { | ||
const char *dumpPath = (char *) env->GetStringUTFChars(path, NULL); | ||
google_breakpad::MinidumpDescriptor descriptor(dumpPath); | ||
new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1); | ||
env->ReleaseStringUTFChars(path, dumpPath); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
app/src/main/java/space/celestia/mobilecelestia/utils/CrashHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package space.celestia.mobilecelestia.utils; | ||
|
||
public class CrashHandler { | ||
public native static void setupNativeCrashesListener(String path); | ||
} |