[arm-gnu] undefined instruction

Carlo Caione carlo.caione at gmail.com
Wed May 16 21:27:41 UTC 2012


On Wed, May 16, 2012 at 10:05 PM, Carlos O'Donell
<carlos_odonell at mentor.com> wrote:
[cut]

Ok, I think I have spotted the bug. And actually the problem seems to
me related to qemu-linaro (yes, I'm emulating a Cortex-A8 with qemu)
and not to CodeSourcery.
In fact in the code an exact point does exist in which the strlen
routine gets corrupted.


(gdb) target remote :1234
Remote debugging using :1234
0x40014000 in ?? ()
(gdb) disassemble __mmu_cache_flush,+48
Dump of assembler code from 0x402000d0 to 0x40200100:
   0x402000d0 <__mmu_cache_flush+0>:	mrc	15, 0, r10, cr0, cr1, {5}
   0x402000d4 <__mmu_cache_flush+4>:	tst	r10, #983040	; 0xf0000
   0x402000d8 <__mmu_cache_flush+8>:	mov	r10, #0
   0x402000dc <__mmu_cache_flush+12>:	beq	0x402000e8 <__mmu_cache_flush+24>
   0x402000e0 <__mmu_cache_flush+16>:	mcr	15, 0, r10, cr7, cr14, {0}
   0x402000e4 <__mmu_cache_flush+20>:	b	0x40200178 <iflush>
   0x402000e8 <__mmu_cache_flush+24>:	mcr	15, 0, r10, cr7, cr10, {5}
   0x402000ec <__mmu_cache_flush+28>:	push	{r0, r1, r2, r3, r4, r5,
r6, r7, r9, r10, r11}
   0x402000f0 <__mmu_cache_flush+32>:	mrc	15, 1, r0, cr0, cr0, {1}
   0x402000f4 <__mmu_cache_flush+36>:	ands	r3, r0, #117440512	; 0x7000000
   0x402000f8 <__mmu_cache_flush+40>:	lsr	r3, r3, #23
   0x402000fc <__mmu_cache_flush+44>:	beq	0x4020016c <finished>
End of assembler dump.
(gdb) b *0x402000ec
Breakpoint 1 at 0x402000ec
(gdb) c
Continuing.

Breakpoint 1, 0x402000ec in __mmu_cache_flush ()
(gdb) disassemble strlen
Dump of assembler code for function strlen:
   0x40205c84 <+0>:	mov	r3, r0
   0x40205c88 <+4>:	mov	r2, r3
   0x40205c8c <+8>:	add	r3, r3, #1
   0x40205c90 <+12>:	ldrb	r1, [r2]
   0x40205c94 <+16>:	cmp	r1, #0
   0x40205c98 <+20>:	bne	0x40205c88 <strlen+4>
   0x40205c9c <+24>:	rsb	r0, r0, r2
   0x40205ca0 <+28>:	bx	lr
End of assembler dump.
(gdb) stepi
0x402000f0 in __mmu_cache_flush ()
(gdb) disassemble strlen
Dump of assembler code for function strlen:
   0x40205c84 <+0>:	beq	0x40205d18 <memcpy>
   0x40205c88 <+4>:			; <UNDEFINED> instruction: 0xf03fe03a
   0x40205c8c <+8>:	andeq	r0, r0, r6
   0x40205c90 <+12>:	andeq	r0, r0, r4
   0x40205c94 <+16>:	andeq	r0, r0, r7
   0x40205c98 <+20>:	andeq	r0, r0, sp, lsl r0
   0x40205c9c <+24>:	ldrdmi	r0, [r0], -r3
   0x40205ca0 <+28>:			; <UNDEFINED> instruction: 0xffffffff
End of assembler dump.
(gdb)

So, is this a qemu-linaro bug?

Thank you,

--
Carlo



More information about the arm-gnu mailing list