- 论坛徽章:
- 0
|
嗯运行试了一下,我的是x86。感觉象是调用的还是三个参数的open,于是跟进反汇编里看了一下。
栈里第三个参数正好是循环变量i
mov %edx,0x8(%esp)
所以导致open的文件属性呈周期性变化。看来两个参数的open在新的glibc里面不怎么可靠了,还是一直用三个的吧。
- 0x08048404 <+0>: push %ebp
- 0x08048405 <+1>: mov %esp,%ebp
- 0x08048407 <+3>: and $0xfffffff0,%esp
- 0x0804840a <+6>: sub $0x220,%esp
- 0x08048410 <+12>: movl $0x0,0x21c(%esp)
- 0x0804841b <+23>: movl $0x0,0x21c(%esp)
- 0x08048426 <+34>: jmp 0x804846c <main+104>
- 0x08048428 <+36>: mov $0x8048540,%eax
- 0x0804842d <+41>: mov 0x21c(%esp),%edx
- 0x08048434 <+48>: mov %edx,0x8(%esp)
- 0x08048438 <+52>: mov %eax,0x4(%esp)
- 0x0804843c <+56>: lea 0x1c(%esp),%eax
- 0x08048440 <+60>: mov %eax,(%esp)
- 0x08048443 <+63>: call 0x8048300 <sprintf@plt>
- 0x08048448 <+68>: movl $0x41,0x4(%esp)
- 0x08048450 <+76>: lea 0x1c(%esp),%eax
- 0x08048454 <+80>: mov %eax,(%esp)
- 0x08048457 <+83>: call 0x8048310 <open@plt>
- 0x0804845c <+88>: mov %eax,(%esp)
- 0x0804845f <+91>: call 0x8048340 <close@plt>
- 0x08048464 <+96>: addl $0x1,0x21c(%esp)
- 0x0804846c <+104>: cmpl $0x31,0x21c(%esp)
- 0x08048474 <+112>: jle 0x8048428 <main+36>
- 0x08048476 <+114>: leave
- 0x08048477 <+115>: ret
复制代码 |
|