在gdb中,载入程序
$gcc -g main.c -o main
直接键入”gdb“启动gdb,然后在gdb中键入“file main”(main为可执行文件名) $gdb GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html可以使用gdb命令对main程序进行调试
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
(gdb)file main Reading symbols from /home/xwp/main...done. (gdb)