android-dev-ext icon indicating copy to clipboard operation
android-dev-ext copied to clipboard

JDWP command failed for jni

Open hyx0408 opened this issue 3 years ago • 2 comments

Prepared: Lcom/android/gles3jni/GLES3JNIView$Renderer;
Prepared: Lcom/android/gles3jni/GLES3JNIView$1;
Prepared: Lcom/android/gles3jni/GLES3JNILib;
JDWP command failed 'Linetable:GLES3JNILib,init'. Error 511
JDWP command failed 'Linetable:GLES3JNILib,resize'. Error 511
JDWP command failed 'Linetable:GLES3JNILib,step'. Error 511

Did this affect lldb to load the native jni library? After "System.loadlibrary("libmyjni")" run, there is no module named libmyjni.so in my lldb target. Do you know how to make lldb work with jni so?

hyx0408 avatar Jul 29 '22 08:07 hyx0408

The Android debugger extension only works for pure Java and Kotlin code - the JDWP commands won't work for JNI libraries or native code.

Once the native library is loaded, you should be able to use lldb to debug the native code, but I think it requires the lldb binary to be copied the device, manually launched and then attached to as a remote process.

adelphes avatar Aug 02 '22 20:08 adelphes

The Android debugger extension only works for pure Java and Kotlin code - the JDWP commands won't work for JNI libraries or native code.

Once the native library is loaded, you should be able to use lldb to debug the native code, but I think it requires the lldb binary to be copied the device, manually launched and then attached to as a remote process.

Obviously, you are right. But now I'm suffering from two other problems. The first one is the JNI library is zipped into base.apk, so that it's a not normal library which lldb failed to load. I work around the problem by pushing the JNI library into /data/app/xx/xxx/lib/arm64 which is another path for finding a library for Android. The second one is if lldb was attached to the process and then the library was loaded, lldb will not load it. However, in the local Linux environment, after dlopen, the library will be loaded.

hyx0408 avatar Aug 03 '22 02:08 hyx0408