免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1260 | 回复: 1
打印 上一主题 下一主题

AT&T 用div影响输出奇怪问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-05 10:34 |只看该作者 |倒序浏览
.section .data
dividend:
        .quad 8335
divisor:
        .int 25
quotient:
        .int 0
remainder:
        .int
output:
        .asciz "The quotient is %d, and the remainder is %d\n"
.section .text
.globl _start
_start:
        nop

        movl dividend, %eax
        movl dividend+4, %edx
        divl divisor
        movl %eax, quotient
        movl %edx, remainder
        pushl remainder
        pushl quotient
        pushl $output
        call printf
        add $12, %esp
        pushl $0
        call exit

-----------------------------------------------
无言了,又一个奇怪的问题,用gdb调试,
去到call printf之前寄存器的值均无问题,
---------------------------------
(gdb) info reg
eax            0x14d        333
ecx            0xbf9df194        -1080168044
edx            0xa        10
ebx            0x11dfc0        1171392
esp            0xbf9df184        0xbf9df184
ebp            0x0        0x0
esi            0xbf9df19c        -1080168036
edi            0x80481b8        134513080
eip            0x80481e6        0x80481e6 <_start+46>
eflags         0x286        [ PF SF IF ]
cs             0x73        115
ss             0x7b        123
ds             0x7b        123
es             0x7b        123
fs             0x0        0
gs             0x33        51

---------------------------------
程序执行后只出现在个空行! 然后发觉是eax与edx 影响printf输出,但不知原因是什么?
请大虾们指教指教!

论坛徽章:
0
2 [报告]
发表于 2007-07-06 09:09 |只看该作者
remainder:
        .int 0
补回了,现在没有问题了!
但奇怪的是GDB调试的时候总时候默认就给了补值它!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP