1 2 | $ ./eg1 Floating point exception (core dumped) |
1 2 3 4 5 6 | ... Core was generated by `./eg1'. Program terminated with signal 8, Floating point exception. ... #0 0x80483ea in wib (no1=8, no2=8) at eg1.c:7 7 result = no1 / diff; |
1 2 3 | (gdb) bt #0 0x80483ea in wib (no1=8, no2=8) at eg1.c:7 #1 0x8048435 in main (argc=1, argv=0xbffff9c4) at eg1.c:21 |
1 2 3 4 5 6 7 8 9 | (gdb) frame 1 #1 0x8048435 in main (argc=1, argv=0xbffff9c4) at eg1.c:21 21 result = wib(value, div); (gdb) info locals value = 8 div = 8 result = 4 i = 2 total = 6 |
1 2 3 4 5 6 7 8 9 10 | #include int main(int argc, char *argv[]) { int i; for(i = 0; i < 60; i++) { sleep(1); } return 0; } |
1 2 | ./eg2 & [3] 1283 |
1 2 3 4 5 6 | ... /home/seager/gdb/1283: No such file or directory. Attaching to program: /home/seager/gdb/eg2, Pid 1283 ... 0x400a87f1 in __libc_nanosleep () from /lib/libc.so.6 (gdb) |
1 2 3 4 5 6 7 8 9 | (gdb) backtrace #0 0x400a87f1 in __libc_nanosleep () from /lib/libc.so.6 #1 0x400a877d in __sleep (seconds=1) at ../sysdeps/unix/sysv/linux/sleep.c:78 #2 0x80483ef in main (argc=1, argv=0xbffff9c4) at eg2.c:7 (gdb) frame 2 #2 0x80483ef in main (argc=1, argv=0xbffff9c4) at eg2.c:7 7 sleep(1); (gdb) print i $1 = 50 |
1 2 3 4 5 6 7 8 9 | Breakpoint 1, wib (no1=8, no2=8) at eg1.c:7 7 result = no1 / diff; (gdb) print diff $1 = 0 (gdb) set diff=1 (gdb) continue Continuing. 0 wibed by 16 equals 10 Program exited normally. |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |