[android] What causes signal 'SIGILL'?

I'm porting some C++ code to Android using NDK and GCC. The code basically runs. At one point, when debugging in Eclipse, the call

Dabbler::Android::Factory* pFactory = new Dabbler::Android::Factory;

causes this error:

Thread [1] (Suspended: Signal 'SIGILL' received. Description: Illegal instruction.) 
    1 <symbol is not available> 0x812feb44

What does that mean? Has the compiler generated illegal code for some reason? I have a breakpoint in the constructor (which does nothing), and it's not hit. I have already done a full rebuild.

What could I be doing wrong to cause this problem?

This question is related to android c++ android-ndk porting

The answer is


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.


Make sure that all functions with non-void return type have a return statement.

While some compilers automatically provide a default return value, others will send a SIGILL or SIGTRAP at runtime when trying to leave a function without a return value.


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to c++

Method Call Chaining; returning a pointer vs a reference? How can I tell if an algorithm is efficient? Difference between opening a file in binary vs text How can compare-and-swap be used for a wait-free mutual exclusion for any shared data structure? Install Qt on Ubuntu #include errors detected in vscode Cannot open include file: 'stdio.h' - Visual Studio Community 2017 - C++ Error How to fix the error "Windows SDK version 8.1" was not found? Visual Studio 2017 errors on standard headers How do I check if a Key is pressed on C++

Examples related to android-ndk

Running Node.Js on Android [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113] Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm System.loadLibrary(...) couldn't find native library in my case How to use su command over adb shell? java.lang.ClassNotFoundException: Didn't find class on path: dexpathlist Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down? Android studio, gradle and NDK How to use adb pull command? How to compile and run a C/C++ program on the Android system

Examples related to porting

How to make CREATE OR REPLACE VIEW work in SQL Server? Strict Standards: Only variables should be assigned by reference PHP 5.4 What causes signal 'SIGILL'? What is the bit size of long on 64-bit Windows?