nm not list static method from android native code

68 Views Asked by At

I have below android native code:

#include <jni.h>
#include <string>
#include <android/log.h>

#define TAG "MyExam"
#define LOGD(msg) __android_log_print(ANDROID_LOG_DEBUG,TAG,msg);

int testOne() {
    LOGD("one");
    return 1;
}

static int testTwo() {
    LOGD("TWO");
    return 2;
}

extern "C" JNIEXPORT jstring JNICALL
Java_com_sample_jniexam_MainActivity_stringFromJNI(
        JNIEnv* env,
        jobject /* this */) {
    std::string hello = "Hello from C++";
    LOGD("JNI");
    testOne();
    testTwo();
    return env->NewStringUTF(hello.c_str());
}

But when try to run nm to list symbols, the static method testTwo() not found!

nm -gD --demangle ./app/build/intermediates/merged_native_libs/debug/out/lib/armeabi-v7a/libjniexam.so |grep test
000081ed T testOne()

Which tool should I use to list static method symbols?

Update

Thanks for @dimich's comment, after check the debug symbol file, I found below result:

$ nm ./app/build/intermediates/cmake/debug/obj/armeabi-v7a/libjniexam.so |grep test
000081ed T _Z7testOnev
000082e1 t _ZL7testTwov

What does the 'T' and 't' mean in this output?

0

There are 0 best solutions below