1. Prepare ndk_r4, SDK 2.2, eclipse, and ant
2. I made some modifications to the hello-JNI code. Refer to the attachment code.
3. shell enters ndk/samples/
Run Android update project -- path hello-JNI
Enter ndk/samples/Hello-JNI
Run ndk-build
Run ant debug
Start the android simulator (which can be started from eclipse)
Run ADB install bin/HelloJni-debug.apk
4. Use eclipse to create an android project named hellojni. Copy all the files under ndk/samples/Hello-JNI to the directory where the Eclipse project is located, and compile
5. Start ndk-GDB in Shell
6. set breakpoints in the hello-jni.c and execute B 30 in the shell
7. Execute continue in Shell
8. Open Eclipse/ddms, find hello-JNI, and click attach.
9. Set a breakpoint in the Java program of eclipse
10. button in the dot Simulator
11. The Code breakpoint in eclipse Java is hit
12. Eclipse point continnue, ndk-GDB command line can see that the hello-jni.c breakpoint is hit
Then there is the conventional GDB debugging command.
List-display code
X-view memory
P-view Variables
B-set breakpoints
Cont-program continues to run
S-one-step execution, but can be tracked into the function
N-one-step execution, but does not enter the Function