#10375: arm: ghci hits an illegal instruction -------------------------------------+------------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.3 Component: Runtime System | Version: 7.10.1 (Linker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: arm Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by erikd): Notice that when it crashes the back trace looks like: {{{ (gdb) bt #0 0xb6ff0024 in ?? () #1 0x70000000 in ?? () }}} The address of the previous function (the value `0x70000000`) is a bit strange. If comes from the link register, `lr`: {{{ (gdb) info registers r0 0xb6ff0018 3070165016 r1 0x28 40 r2 0x1 1 r3 0x70000000 1879048192 r4 0x2350b50 37030736 r5 0xb38c4a0c 3012315660 r6 0xb5187d24 3038280996 r7 0xb38c4b30 3012315952 r8 0xb2ad2c38 2997693496 r9 0x7fffffff 2147483647 r10 0x1e6cef4 31903476 r11 0xb38c4750 3012314960 r12 0x235036c 37028716 sp 0xb59fcd70 0xb59fcd70 lr 0x70000000 1879048192 pc 0xb6ff0024 0xb6ff0024 cpsr 0x400f0010 1074724880 }}} So lets run the program under GDB and break on `$lr == 0x70000000` : {{{ (gdb) break main Breakpoint 1 at 0x93b08 (gdb) r Starting program: /home/erikd/Git/ghc-upstream/inplace/lib/bin/ghc-stage2 -B/home/erikd/Git/ghc-upstream/inplace/lib --interactive [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux- gnueabihf/libthread_db.so.1". Breakpoint 1, 0x00093b08 in main () (gdb) watch $lr == 0x70000000 Watchpoint 2: $lr == 0x70000000 (gdb) c Continuing. [New Thread 0xb6bff460 (LWP 5344)] [New Thread 0xb61ff460 (LWP 5345)] [New Thread 0xb59ff460 (LWP 5346)] Program received signal SIGILL, Illegal instruction. strlen () at ../ports/sysdeps/arm/armv6t2/strlen.S:82 82 ../ports/sys }}} so we're back to `SIGILL`, but the assembly looks mostly sane: {{{ (gdb) disass 0xb6fe8800 Dump of assembler code for function strlen: 0xb6fe8800 <+0>: pld [r0] 0xb6fe8804 <+4>: strd r4, r5, [sp, #-8]! 0xb6fe8808 <+8>: bic.w r1, r0, #7 0xb6fe880c <+12>: mvn.w r12, #0 0xb6fe8810 <+16>: ands.w r4, r0, #7 0xb6fe8814 <+20>: pld [r1, #32] 0xb6fe8818 <+24>: bne.w 0xb6fe88ae <strlen+174> 0xb6fe881c <+28>: mov.w r4, #0 => 0xb6fe8820 <+32>: mvn.w r0, #7 0xb6fe8824 <+36>: ldrd r2, r3, [r1] 0xb6fe8828 <+40>: pld [r1, #64] ; 0x40 0xb6fe882c <+44>: add.w r0, r0, #8 }}} I'm not sure why GDB thinks this is within the `strlen` function. If I disassemble `strlen` I get the same assembler instructions, but at a different address: {{{ (gdb) disass strlen Dump of assembler code for function strlen: 0xb6dbdb40 <+0>: pld [r0] 0xb6dbdb44 <+4>: strd r4, r5, [sp, #-8]! 0xb6dbdb48 <+8>: bic.w r1, r0, #7 0xb6dbdb4c <+12>: mvn.w r12, #0 0xb6dbdb50 <+16>: ands.w r4, r0, #7 0xb6dbdb54 <+20>: pld [r1, #32] 0xb6dbdb58 <+24>: bne.w 0xb6dbdbee <strlen+174> 0xb6dbdb5c <+28>: mov.w r4, #0 0xb6dbdb60 <+32>: mvn.w r0, #7 0xb6dbdb64 <+36>: ldrd r2, r3, [r1] 0xb6dbdb68 <+40>: pld [r1, #64] ; 0x40 0xb6dbdb6c <+44>: add.w r0, r0, #8 }}} This does not make sense! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10375#comment:57> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler