I built android source code, and built a simple c++ file. Then remote debug it on emulator.
But I always got the error: Program received signal SIGILL, Illegal instruction.
It works well when no break point is set.
If any break point is hit, the SIGILL will be triggered.
I build Android-6.0.1_r11 on Mac OSX
my c++ source code is below:
// ******** external/test/test.cpp ******** //
#include <stdio.h>
int main() {
for(int i=0; i<10; i++){
printf("%d\n", i);
}
return 0;
}
// ******** external/test/Android.mk ********/
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Test
LOCAL_SRC_FILES := \
test.cpp \
LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)
Then build and push the files to the emulator:
$ mmm external/test
$ emulator&
$ add push out/debug/target/product/generic/obj/EXECUTABLES/Test_intermediates/LINKED/Test /data/local/tmp
$ adb shell chmod 755 /data/local/tmp/*
the debug steps is below:
(TARGET) $ adb shell /data/local/tmp/gdbserver :1234 /data/local/tmp/test/Test
(HOST) $ ./prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-gdb out/debug/target/product/generic/obj/EXECUTABLES/Test_intermediates/LINKED/Test
(gdb) b main
Breakpoint 1 at 0xb6f7a5f4: file external/testservice/TestA.cpp, line 3.
(gdb) n
Cannot find bounds of current function
(gdb) c
Continuing.
Breakpoint 1, main () at external/testservice/TestA.cpp:3
3 int main() {
(gdb) n
4 for(int i=0; i<10; i++){
(gdb) n
5 printf("%d\n", i);
(gdb) n
4 for(int i=0; i<10; i++){
(gdb) n
5 printf("%d\n", i);
(gdb) n
4 for(int i=0; i<10; i++){
(gdb) n
Program received signal SIGILL, Illegal instruction.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/cbdbdde6-2d99-48df-8f45-85c85eff1826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.