Re: precise debugging of inline asm
<lynx.abraxas <at> freenet.de>
2008-06-08 12:36:48 GMT
On 01/06/08 19:27:26, Claudio Fontana wrote:
> On x86, try for example
>
> (gdb) disassemble $eip $eip+20
>
> Also see
> (gdb) info registers
Thanks Claudio Fontana. That did the trick. So the first line of output from
disassemble $eip $eip+20 is then the line where the segfault occured? In this
example "mov %cx,(%esi,%edx,2)"?
(gdb) disassemble $eip $eip+20
Dump of assembler code from 0x87b29f8 to 0x87b2a0c:
0x087b29f8 <.lable1+3>: mov %cx,(%esi,%edx,2)
0x087b29fc <.lable1+7>: inc %edx
0x087b29fd <.lable1+8>: jne 0x87b29ca <.lable0>
0x087b29ff <.lable1+10>: mov %ebp,0xffffffd0(%ebp)
0x087b2a02 <.lable1+13>: pop %ebx
0x087b2a03 <.lable1+14>: mov %eax,0xffffffa8(%ebp)
0x087b2a06 <.lable1+17>: addl $0x1,0xffffffb0(%ebp)
0x087b2a0a <.lable1+21>: cmpl $0x2f,0xffffffb0(%ebp)
End of assembler dump.
Well investigating that I think I should be sure of what each line does so
here I have some more questions:
As in the code below, will gcc not use registers in the clobber list as
registers for %0 - %5 ?
Or asked differently: How would one code an asm swap?
(Continue reading)