目录
一,调试目标
可执行文件
二,调试的前提条件
1》编译时,必须加"-g"
例如:gcc gdbtest.c -o gdbtest -g
2》调试时,源文件必须在同一个目录中
三,调试的错误
gdb只能调试可执行文件,所以,当程序有语法错误是不能用gdb调试的
gdb只能够调试以下错误:
1》逻辑错误
2》段错误
四,gdb调试器的相关命令
应为gdb为字符界面调试器,所以需要掌握调试的命令
1》进入gdb
root@ubuntu:~/day01_code$ gdb gdbtest
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "ap