作者:万象新动HR | 来源:互联网 | 2023-07-23 08:33
下载完cgdb之后,进入cgdb目录,执行:
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
在第一步出现如下错误,则按下面方法解决:
出现错误:
configure: error: CGDB requires curses.h or ncurses/curses.h to build.
解决方案:
yum install ncurses-devel
出现错误:
configure: error: Please install makeinfo before installing
解决方案:
yum install texinfo
如果是 CentOS 8.0 及以上系统,需要先执行:
yum config-manager --set-enabled PowerTools
出现错误:
configure: error: Please install help2man
解决方案:
yum install help2man
出现错误:
configure: error: CGDB requires GNU readline 5.1 or greater to link.
If you used --with-readline instead of using the system readline library,
make sure to set the correct readline library on the linker search path
via LD_LIBRARY_PATH or some other facility.
解决方案:
yum install readline-devel
出现错误:
configure: error: Please install flex before installing
解决方案:
yum install flex
安装好了以后,输入"cgdb 要调试的程序名“即可以进行调试,比如我这里调试mysql源码:
zhangyl 2016.11.30日补充:
cgdb不足之处:
cgdb中调用gdb的print命令无法显示字符串类型中的中文字符,要么显示乱码,要么不显示,这给程序调试带来了很大的困扰。
这点需要注意!!!