アセンブリ言語とtime関数を使用してタイマーを作ろうとしているのですが、gdbで確認すると、自分の思ったとおりの動作で問題無く最後まで動作するのですが、いざ./program で動作させてみるとSegmentation fault (コアダンプ)が発生します。これはどのように捉えれば良いのでしょうか?また、動作させるにはどうすればいいでしょうか?
これがそのプログラムです。
.bss .comm sbuffer,8 .comm mbuffer,8 .data output1: .string "こちらはタイマーです。\n" output2: .string "分:" output3: .string "秒:" output4: .string "時間終了\n" output5: .string "時間を入力して下さい\n" coded: .ascii "%d\0" .text .globl _main _main: pushl %ebp movl %esp, %ebp subl $32, %esp xorl %eax, %eax getinput0: pushl $output1 call _printf getinput1: pushl $output5 call _printf getinput2: /*時間の所得*/ pushl $output2 call _printf pushl $mbuffer pushl $coded call _scanf pushl $output3 call _printf pushl $sbuffer pushl $coded call _scanf xorl %eax, %eax main1: /*秒への変換*/ movl $mbuffer, %esi movb (%esi), %al movb $60, %cl mul %cl movl $sbuffer, %esi movl (%esi), %ecx addl %ecx, %eax main2: movl %eax, %ebx pushl $0 call _time addl %eax, %ebx main3: /*タイマー部分*/ pushl $0 call _time cmpl %ebx, %eax ja main4 jmp main3 main4: pushl $output4 call _printf leave ret
自分の実行環境は
Cygwin 7.10.1-1
GDB 7.10.1
です
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/04/09 10:15
2018/04/09 10:16
2018/04/09 10:38
2018/04/09 12:06