I had a case of miscompilation that boiled down to this code:
.text .align 3 .global main .type main, @function main: nop stqd $lr,16($sp) ai $sp, $sp, -176 lnop nop lqd $lr,16($sp) nop bi $lr
This is obviously wrong. But when single-stepping the code, there seems to be an offset. Setting a break on main, results the breakpoint being set on the 'ai' instruction. Similarly, the SPU exits when single stepping the 'ai', when error happens in the 'bi' as the SPU returns to some "random" address. And even if I add a few nop/lnop:s after the 'ai', it will still be stepping the 'ai' that makes the SPU return. Does spu-gcc, as or ld do optimization on assembly files?
Program compiled wiht 'spu-gcc m.s -o m'
This is the relevant gdb output
Using host libthread_db library "/lib64/libthread_db.so.1". (gdb) display /i $pc (gdb) break main Breakpoint 1 at 0x168 (gdb) run Starting program: /home/kraiskil/temp/m (no debugging symbols found) [snip] Breakpoint 1, 0x00000168 in main () 1: x/i $pc 0x168 <main+8>: ai $1,$1,-176 (gdb) stepi <cross-architecture call>
Why is there an offset?
Could be old tools (using Ubuntu 8.10 on PS3, spu-gcc 4.1.1, ppu-gdb 184.108.40.20670623-cvs). But I'd really not like to update in case it breaks something, and newer tools don't help :)
Thank you in advance,