0
flds
指令應該將值存儲在寄存器st0
中。我正在調試我沒有編碼的共享庫。有時flds
指令對st0
沒有任何影響。下面是gdb
輸出的情況下,當它的工作和一個案件,當它失敗。在破碎的情況下,fstat
寄存器是0x2261而不是0x2061。 0x200標誌表示什麼?Mac OSX上的flds指令失敗
工作版本:
0x6d9b4f : flds -0x4(%ebp) 0x6d9b52 : leave 0x6d9b53 : ret (gdb) info registers fstat st0 st1 st2 st3 st4 st5 st6 st7 fstat 0x2061 8289 st0 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st1 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st2 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st3 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st4 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st5 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st6 780250362506194 (raw 0x4030b1688c6c5af48000) st7 1 (raw 0x3fff8000000000000000) (gdb) ni 0x006d9b52 in Startup() 1: x/3i $pc 0x6d9b52 : leave 0x6d9b53 : ret 0x6d9b54 : push %ebp (gdb) info registers fstat st0 st1 st2 st3 st4 st5 st6 st7 fstat 0x1861 6241 st0 -1584 (raw 0xc009c600000000000000) st1 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st2 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st3 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st4 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st5 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st6 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st7 780250362506194 (raw 0x4030b1688c6c5af48000)
破碎的版本:
0x6d9b4f : flds -0x4(%ebp) 0x6d9b52 : leave 0x6d9b53 : ret (gdb) info registers fstat st0 st1 st2 st3 st4 st5 st6 st7 fstat 0x2261 8801 st0 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st1 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st2 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st3 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st4 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st5 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st6 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st7 -nan(0xc000000000000000) (raw 0xffffc000000000000000) (gdb) ni 0x006d9b52 in Startup() 1: x/3i $pc 0x6d9b52 : leave 0x6d9b53 : ret 0x6d9b54 : push %ebp (gdb) info registers fstat st0 st1 st2 st3 st4 st5 st6 st7 fstat 0x1a61 6753 st0 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st1 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st2 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st3 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st4 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st5 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st6 -nan(0xc000000000000000) (raw 0xffffc000000000000000) st7 -nan(0xc000000000000000) (raw 0xffffc000000000000000)
謝謝你的幫助。我現在已經解決了這個問題。正如你所說,在這兩種情況下堆棧已經損壞。問題是庫在我的代碼中調用了一個回調函數,它返回一個float而不是int。 – user3359929
幹得好,感謝您的更新。瞭解你如何設法解決問題總是很好的。 – Jester