将程序加载到调试器中,使用如下命令:
[root@localhost c]
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/c/testadd...done.
设置断点 b main是将断点设置在mian函数这一行 l命令查看源码 r命令运行程序
s命令跳入函数 p命令打印内容 finish命令跳出函数 n命令单步执行程序 c命令继续执行程序 quit退出调试
|