builtin_trap
buildin_trap()を呼ぶサンプル(hello.c)を作成し、
ndk-buildでビルドした。
SIGABRTになった。
#include <stdio.h> int main(int argc, char *argv[]) { printf("start\n"); __builtin_trap(); printf ("end\n"); return 0 ; }
01-14 03:08:18.122: A/libc(15262): Fatal signal 6 (SIGABRT) at 0x00003b9e (code=-6), thread 15262 (hello) 01-14 03:08:18.232: I/DEBUG(173): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 01-14 03:08:18.232: I/DEBUG(173): Build fingerprint: 'unknown' 01-14 03:08:18.232: I/DEBUG(173): Revision: '11' 01-14 03:08:18.232: I/DEBUG(173): pid: 15262, tid: 15262, name: hello >>> ./hello <<< 01-14 03:08:18.232: I/DEBUG(173): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 01-14 03:08:18.242: I/DEBUG(173): r0 00000000 r1 00003b9e r2 00000006 r3 00000000 01-14 03:08:18.242: I/DEBUG(173): AM write failure (32 / Broken pipe) 01-14 03:08:18.242: I/DEBUG(173): r4 00000006 r5 00000000 r6 00003b9e r7 0000010c 01-14 03:08:18.242: I/DEBUG(173): r8 00008571 r9 00000000 sl 00000000 fp 00000000 01-14 03:08:18.242: I/DEBUG(173): ip b6ef5fd8 sp be92ca30 lr b6ebefe5 pc b6ecdf90 cpsr 00070010 01-14 03:08:18.242: I/DEBUG(173): d0 0000000000000073 d1 0000000000000074 01-14 03:08:18.242: I/DEBUG(173): d2 0000000000000061 d3 0000000000000072 01-14 03:08:18.242: I/DEBUG(173): d4 0000000000000000 d5 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d6 0000000000000000 d7 6a230c0000000000 01-14 03:08:18.242: I/DEBUG(173): d8 0000000000000000 d9 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d10 0000000000000000 d11 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d12 0000000000000000 d13 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d14 0000000000000000 d15 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d16 41da89485539ba5e d17 3f50624dd2f1a9fc 01-14 03:08:18.242: I/DEBUG(173): d18 41a046a74c000000 d19 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d20 0000000000000000 d21 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d22 0000000000000000 d23 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d24 0000000000000000 d25 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d26 0000000000000000 d27 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d28 0000000000000000 d29 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): d30 0000000000000000 d31 0000000000000000 01-14 03:08:18.242: I/DEBUG(173): scr 00000010 01-14 03:08:18.242: W/NativeCrashListener(771): Couldn't find ProcessRecord for pid 15262 01-14 03:08:18.252: I/DEBUG(173): backtrace: 01-14 03:08:18.252: I/DEBUG(173): #00 pc 00021f90 /system/lib/libc.so (tgkill+12) 01-14 03:08:18.252: I/DEBUG(173): #01 pc 00012fe1 /system/lib/libc.so (pthread_kill+48) 01-14 03:08:18.252: I/DEBUG(173): #02 pc 000131f5 /system/lib/libc.so (raise+10) 01-14 03:08:18.252: I/DEBUG(173): #03 pc 00011f2b /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): #04 pc 00021844 /system/lib/libc.so (abort+4) 01-14 03:08:18.252: I/DEBUG(173): #05 pc 0000057b /data/hello 01-14 03:08:18.252: I/DEBUG(173): #06 pc 0000e34b /system/lib/libc.so (__libc_init+50) 01-14 03:08:18.252: I/DEBUG(173): #07 pc 000005a4 /data/hello 01-14 03:08:18.252: I/DEBUG(173): #08 pc 00020bbf [stack] 01-14 03:08:18.252: I/DEBUG(173): stack: 01-14 03:08:18.252: I/DEBUG(173): be92c9f0 1a131100 01-14 03:08:18.252: I/DEBUG(173): be92c9f4 170f1200 01-14 03:08:18.252: I/DEBUG(173): be92c9f8 00000016 01-14 03:08:18.252: I/DEBUG(173): be92c9fc 94280c5a 01-14 03:08:18.252: I/DEBUG(173): be92ca00 b6ef61d8 /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): be92ca04 00289020 [heap] 01-14 03:08:18.252: I/DEBUG(173): be92ca08 00000006 01-14 03:08:18.252: I/DEBUG(173): be92ca0c b6ed12df /system/lib/libc.so (__sflush+56) 01-14 03:08:18.252: I/DEBUG(173): be92ca10 b6ef61d8 /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): be92ca14 00000008 01-14 03:08:18.252: I/DEBUG(173): be92ca18 b6f04324 01-14 03:08:18.252: I/DEBUG(173): be92ca1c b6ed1371 /system/lib/libc.so (fflush+64) 01-14 03:08:18.252: I/DEBUG(173): be92ca20 b6ef61d8 /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): be92ca24 00000001 01-14 03:08:18.252: I/DEBUG(173): be92ca28 b6eece4d /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): be92ca2c b6ed1ea7 /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): #00 be92ca30 00000006 01-14 03:08:18.252: I/DEBUG(173): be92ca34 00000000 01-14 03:08:18.252: I/DEBUG(173): be92ca38 00003b9e 01-14 03:08:18.252: I/DEBUG(173): be92ca3c b6ef5fd8 /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): be92ca40 b6ef5fd8 /system/lib/libc.so 01-14 03:08:18.252: I/DEBUG(173): be92ca44 b6ebefe5 /system/lib/libc.so (pthread_kill+52) 01-14 03:08:18.252: I/DEBUG(173): #01 be92ca48 00000006 01-14 03:08:18.252: I/DEBUG(173): be92ca4c 00000000 01-14 03:08:18.252: I/DEBUG(173): be92ca50 00000001 01-14 03:08:18.252: I/DEBUG(173): be92ca54 b6ebf1f9 /system/lib/libc.so (raise+14) 01-14 03:08:18.252: I/DEBUG(173): #02 be92ca58 be92ca64 [stack] 01-14 03:08:18.252: I/DEBUG(173): be92ca5c b6ebdf2f /system/lib/libc.so
$ arm-eabi-readelf -a ./libs/armeabi/hello ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x8570 Start of program headers: 52 (bytes into file) Start of section headers: 37172 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 9 Size of section headers: 40 (bytes) Number of section headers: 23 Section header string table index: 22 Relocation section '.rel.dyn' at offset 0x490 contains 5 entries: Offset Info Type Sym.Value Sym. Name 00010fe8 00000815 R_ARM_GLOB_DAT 00008e20 __aeabi_unwind_cpp_pr0 00010fec 00000a15 R_ARM_GLOB_DAT 00000000 __cxa_call_unexpected 00010ff0 00000d15 R_ARM_GLOB_DAT 00008e10 __aeabi_unwind_cpp_pr2 00010ff8 00001215 R_ARM_GLOB_DAT 00000000 __gnu_Unwind_Find_exid 00010ffc 00001315 R_ARM_GLOB_DAT 00008e18 __aeabi_unwind_cpp_pr1 Relocation section '.rel.plt' at offset 0x4b8 contains 8 entries: Offset Info Type Sym.Value Sym. Name 00010fc4 00000916 R_ARM_JUMP_SLOT 00000000 __cxa_begin_cleanup 00010fc8 00000b16 R_ARM_JUMP_SLOT 00008518 memcpy 00010fcc 00000c16 R_ARM_JUMP_SLOT 00008524 puts 00010fd0 00000e16 R_ARM_JUMP_SLOT 00008530 abort 00010fd4 00000f16 R_ARM_JUMP_SLOT 0000853c __libc_init 00010fd8 00001016 R_ARM_JUMP_SLOT 00000000 __cxa_type_match 00010fdc 00001116 R_ARM_JUMP_SLOT 00008554 __cxa_atexit 00010fe0 00001216 R_ARM_JUMP_SLOT 00000000 __gnu_Unwind_Find_exid Unwind table index '.ARM.exidx' at offset 0x1a2c contains 25 entries: Symbol table '.dynsym' contains 20 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00011010 0 NOTYPE LOCAL DEFAULT ABS _bss_end__ 2: 00011010 0 NOTYPE LOCAL DEFAULT ABS __bss_start__ 3: 00011010 0 NOTYPE LOCAL DEFAULT ABS __bss_end__ 4: 00011010 0 NOTYPE LOCAL DEFAULT ABS __bss_start 5: 00011010 0 NOTYPE LOCAL DEFAULT ABS __end__ 6: 00011010 0 NOTYPE LOCAL DEFAULT ABS _edata 7: 00011010 0 NOTYPE LOCAL DEFAULT ABS _end 8: 00008e20 8 FUNC GLOBAL DEFAULT 9 __aeabi_unwind_cpp_pr0 9: 00000000 0 NOTYPE WEAK DEFAULT UND __cxa_begin_cleanup 10: 00000000 0 NOTYPE WEAK DEFAULT UND __cxa_call_unexpected 11: 00008518 0 FUNC GLOBAL DEFAULT UND memcpy 12: 00008524 0 FUNC GLOBAL DEFAULT UND puts 13: 00008e10 8 FUNC WEAK DEFAULT 9 __aeabi_unwind_cpp_pr2 14: 00008530 0 FUNC GLOBAL DEFAULT UND abort 15: 0000853c 0 FUNC GLOBAL DEFAULT UND __libc_init 16: 00000000 0 NOTYPE WEAK DEFAULT UND __cxa_type_match 17: 00008554 0 FUNC GLOBAL DEFAULT UND __cxa_atexit 18: 00000000 0 FUNC WEAK DEFAULT UND __gnu_Unwind_Find_exidx 19: 00008e18 8 FUNC WEAK DEFAULT 9 __aeabi_unwind_cpp_pr1 Histogram for bucket list length (total of 17 buckets): Length Number % of total Coverage 0 5 ( 29.4%) 1 6 ( 35.3%) 31.6% 2 5 ( 29.4%) 84.2% 3 1 ( 5.9%) 100.0% No version information found in this file.