What causes signal 'SIGILL'?

好久不见. 提交于 2019-11-29 18:56:17

It works now. For anyone else struggling with Android/NDK/GCC/Eclipse, here's how I solved it:

  1. Bury a dead cat at midnight when full moon
  2. Restart the Android device emulator

Haven't verified if both steps are really necessary, and if not, which one is redundant.

It means the CPU attempted to execute an instruction it didn't understand. This could be caused by corruption I guess, or maybe it's been compiled for the wrong architecture (in which case I would have thought the O/S would refuse to run the executable). Not entirely sure what the root issue is.

It could be some un-initialized function pointer, in particular if you have corrupted memory (then the bogus vtable of C++ bad pointers to invalid objects might give that).

BTW gdb watchpoints & tracepoints, and also valgrind might be useful (if available) to debug such issues. Or some address sanitizer.

If you are migrating code from gcc to clang and start getting SIGILL or SIGTRAP in the last statement of some function, then make sure the function has a return statement if it has been declared with non-void return type.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!