第一是从so文件里面查找。导出表以及符号。
另外一种就是 一般会在JNI_OnLoad里面注册 native函数。
native函数定义如下。
typedef struct {
const char* name;
const char* signature;
void* fnPtr;
} JNINativeMethod;jint RegisterNatives(jclass clazz, const JNINativeMethod* methods,
jint nMethods)static JNINativeMethod methods[] = {
{"getNativeString", "()Ljava/lang/String;", reinterpret_cast<void*>(getString)}
};因此只要在JNI_OnLoad里面断点RegisterNatives函数就能得到methods数组。进而从fnptr中得到函数地址~~~
本文介绍了如何通过JNI_OnLoad函数中的RegisterNatives方法来注册本地方法,并解释了如何通过设置断点来查找这些方法。此外,还展示了具体的JNINativeMethod结构体以及注册示例。

2603

被折叠的 条评论
为什么被折叠?



