gdb虽然很强大,但是却略显单调。其实gdb有很多前端图形界面。那么选哪个呢?请看GDB图形界面大PK。
TUI
![image_1b54hipghpqg176a1vd5133l1p3r13.png-27.6kB](http://static.zybuluo.com/shenyuflying/beiufda6on7jxe25kf5nqlxg/image_1b54hipghpqg176a1vd5133l1p3r13.png)
gdb原生的图形模式,支持gdb所有的特性。
使用方法:
gdb attach pid 之后ctrl+x a
cgdb
![image_1b54jn7f11bincfncgpqjs1vbt34.png-26.1kB](http://static.zybuluo.com/shenyuflying/xrtnvqcgnjc5u5s92fdxie4f/image_1b54jn7f11bincfncgpqjs1vbt34.png)
可以认为是TUI模式的增强版,具有代码高亮、查找等等功能。同时也支持gdb所有的特性。
如果之前对gdb和vim比较熟悉的话,用这个就会很顺手。
使用方法:
cgdb attach pid
ddd
![image_1b54hghu7ibvrhn1g27ra1cq2m.png-39kB](http://static.zybuluo.com/shenyuflying/6wybyzwxwgsrs94nipn6mjar/image_1b54hghu7ibvrhn1g27ra1cq2m.png)
采用gdb作为后端,强大之处在于能够图形化显示程序中的结构体。
使用方法:
ddd [options...] executable-file [core-file | process-id]
insight
![image_1b54hg2kn170q15ebk4q1pr1ji89.png-144.1kB](http://static.zybuluo.com/shenyuflying/qe9ek0yb52h43pl4df9z2ei1/image_1b54hg2kn170q15ebk4q1pr1ji89.png)
Nemiver
![image_1b54iglhg1vq6cog15oqnd61in51g.png-137kB](http://static.zybuluo.com/shenyuflying/i67fi7vfxpy0st8m1pspgvdb/image_1b54iglhg1vq6cog15oqnd61in51g.png)
界面比上面几个好看点,但是不知道如何输入gdb命令
使用方法:
nemiver --attach=<pid|process name>
KDevelop
![image_1b54mesls1d1u10okgksqoo19l23h.png-178.3kB](http://static.zybuluo.com/shenyuflying/hr7xsop7me5qv8s65isaydj0/image_1b54mesls1d1u10okgksqoo19l23h.png)
使用方法:
还没搞明白如何attach到进程。
总结
一般使用gdb的TUI模式就可以,这个每台机器上都有,也可以远程用终端调试。最简单的就是最强大的。如果觉得TUI模式太单调的话,可以用cgdb。