My favorites | Sign in
Project Home Issues
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 40941: SIGILL in GDB when debugging on 4.1.2
3 people starred this issue and may be notified of changes. Back to list
Status:  Released
Closed:  Dec 2012

Sign in to add a comment
Reported by, Dec 4, 2012
NOTE: This form is only for reporting bugs found in the development tools
while developing Android applications (Emulator, DDMS, Eclipse support,
ant scripts...). Use the Developer templates for issues with Android

Please describe the problem in detail, with the following information (if
Host OS: Windows7, Ubuntu 10.x
SDK tools version (available in the "About" section of the 'android' tool
UI): R21
Eclipse version: N/A
ADT plug-in version: N/A
Platform targeted by your project: armeabi-v7a
Version of the platform running in the emulator: N/A

1. Obtain device with 4.1.2 installed
2. Initiate debugging of some JNI-dependent app with GDB. You will need to ensure that GDB is attached to the inferior process, before any of your JNI solibs get loaded.  (Eclipse debugging of JNI will achieve this for you.)
3. Tell GDB to (c)ontinue

GDB should operate as expected

GDB crashes with SIGILL, once the inferior process' first JNI solib gets loaded.

Starting in Android 4.1.2, /system/bin/linker advertises the address of
rtld_db_dlactivity as a dynsym.  But changes in GDB's bfd code strip out
the Thumb ISA flag from its reported symbol address.  Since on Android the
'rtld_db_dlactivity' function is compiled as Thumb, this causes GDB to
errantly set an ARM breakpoint on code that will execute when the
processor is in Thumb mode, leading to a SIGILL.
Dec 4, 2012
I have a fix to share for this issue.  But first I am going to test (both base behavior, and the fix) on 4.2.1
Dec 5, 2012
Project Member #2
(No comment was entered for this change.)
Dec 5, 2012
It appears this is *not* a problem in 4.2.1; just 4.1.2

In 4.1.2, when /system/bin/linker advertised 'rtld_db_dlactivity' as a dynsym, that
caused GDB's enable_break() to take a different decision path, tickling a bug in GDB that was previously dormant.

But in 4.2.1, GDB takes yet a different decision path, which again bypasses the GDB bug.  I suspect this is because in 4.2.1, you have merged in my previous fix:

So, it seems that the fix that I have to offer will only be relevant to devices which remain at 4.1.2
Dec 12, 2012
My fix for this is now available at:
Dec 12, 2012
Project Member #5
Fixed by Ryan submitted:
Dec 12, 2012
Project Member #6
(No comment was entered for this change.)
Status: FutureRelease
Mar 21, 2013
Project Member #7
(No comment was entered for this change.)
Status: Released
Apr 9, 2013
I am still experiencing SIGILL while debugging in 4.1 emulator.

Detailed Information
1. OS: Ubuntu 12.04.2 LTS, (i3 64 bit)
1. NDK: r8e
2. Emulator: 
     - Target = 4.1 - API level 16
     - SD Card: 1024 MiB
     - Skin: Built-in WVGA800
     - Abstract LCD density: 240
     - Max VM Application heap size: 48
     - Device RAM size: 512

3. Application:
   Testing with a simple Hello World binary project (BUILD_EXECUlTABLE).
SRC: hello.c
void func(void)
    printf("hello from func\n");

int main(int argc, char * argv[])

    int ret = 0;

    printf("hello from main\n");
    printf("bye from main\n");
    return ret;


# This file is jni/

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

# I want ARM, not thumb.

# Name of the local module
LOCAL_MODULE    := hello 
# The files that make up the source code
LOCAL_SRC_FILES := hello.c 


5. GDB setup
   - Running the gdbserver provided in <ndk-r8e>/prebuilt/android-arm/gdbserver/
      # ./gdbserver :4444 ./hello
   - adb forward tcp:4444 tcp:4444
   - GDB: target remote :4444
   - GDB: symbol-file obj/local/armeabi/hello

6. GDB Output:
Remote debugging from host
0x400036e0 in ?? ()
libthread_db:td_ta_new: Probing system for platform bug.
libthread_db:td_ta_new: Running as root, nothing to do.
(gdb) b main
Cannot access memory at address 0x0
Breakpoint 1 at 0x8484: file jni/hello.c, line 19.
(gdb) c

Breakpoint 1, main (argc=1, argv=0xbe9d5cb4) at jni/hello.c:19
19	    printf("hello from main\n");
(gdb) n

Program received signal SIGILL, Illegal instruction.
main (argc=<optimized out>, argv=0xbe9d5cb4) at jni/hello.c:19
19	    printf("hello from main\n");
(gdb) n

Program received signal SIGILL, Illegal instruction.
main (argc=<optimized out>, argv=<optimized out>) at jni/hello.c:20
20	    func();
(gdb) n

Child terminated with signal = 0x4 (SIGILL)
GDBserver exiting

Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.

Apr 9, 2013
Thank you for that information, Aseem.   It possibly might be that your SIGILL has a different root cause.   I will look into this when I can.
Dec 13, 2013
compile the c++ source files with -march=armv4 . GDB don't understand some armv7 instructions. 

In build/core/combo/arm/ put -march=armv4 and then do mm -B showcommands to check if it was used in compilation. Then gdbserver can handle it. Gdbserver has problems with high arm instruction set versions. If your gcc got problems with lack of some instructions on armv4 (can't compile) then try armv5 then v6. The lower the better for the gdbserver.

Sign in to add a comment

Powered by Google Project Hosting