I implemented the android NDK recently to hide my app keys and secrets. Since I did that whenever I run my app in debug mode in android studio, my breakpoints get interrupted with sigsegv (signal sigsegv: invalid address (fault address: 0x8)). This occurs when any of my processes access the NDK at all. I'm baffled as to what's happening as I am very new with the NDK. My C code is extremely simple, and looks something like:
#include <jni.h>
JNIEXPORT jstring JNICALL
Java_com_my_company_co_utilities_UtilFuncs_getSecretOne(JNIEnv *env, jobject instance) {
return (*env)-> NewStringUTF(env, "my_secret_1");
}
JNIEXPORT jstring JNICALL
Java_com_my_company_co_utilities_UtilFuncs_getSecretTwo(JNIEnv *env, jobject instance) {
return (*env)-> NewStringUTF(env, "my_secret_2");
}
JNIEXPORT jstring JNICALL
JJava_com_my_company_co_utilities_UtilFuncs_getKeyOne(JNIEnv *env, jobject instance) {
return (*env)-> NewStringUTF(env, "my_key_1");
}
JNIEXPORT jstring JNICALL
Java_com_my_company_co_utilities_UtilFuncs_getKeyTwo(JNIEnv *env, jobject instance) {
return (*env)->NewStringUTF(env, "my_key_2");
}
and I access it in my static UtilFuncs class like:
static {
System.loadLibrary("keys");
}
public static native String getSecretOne();
public static String getSecret() {
return getSecretOne();
}
It works perfectly when I run the app normally, but it has made debug unusable entirely because of these sigsegv: invalid address errors coming up when I'm trying to read watch variables. Anyone encounter this before or have any idea what I'm doing wrong?
from Android NDK throwing signal sigsegv: invalid address in debug mode
No comments:
Post a Comment