insight 是 gdb 的UI前端。
安装:
echo "deb http://ppa.launchpad.net/sevenmachines/dev/ubuntu natty main" | sudo tee -a /etc/apt/sources.list > /dev/null
echo "deb-src http://ppa.launchpad.net/sevenmachines/dev/ubuntu natty main" | sudo tee -a /etc/apt/sources.list > /dev/null
sudo apt-get update
sudo apt-get install insight
使用:
cmake -DCMAKE_BUILD_TYPE:STRING=Debug ../src 可以link到源代码,这样在insight里就可以看到了。
注意:由于insight用的是老版本gdb,而ubuntu14.04自带新版本g++,在insight里无法查看local variables.所以要让g++生成老版本调试信息。
DWARF4 is now the default when generating DWARF debug information.
When -g is used on a platform that uses DWARF debugging information, GCC
will now default to -gdwarf-4 -fno-debug-types-section.
GDB 7.5, Valgrind 3.8.0 and elfutils 0.154 debug information consumers
support DWARF4 by default. Before GCC 4.8 the default version used was
DWARF2. To make GCC 4.8 generate an older DWARF version use -g together
with -gdwarf-2 or -gdwarf-3. The default for Darwin and VxWorks is still
-gdwarf-2 -gstrict-dwarf.
So you need to use GDB 7.5 or compile with
-g -gdwarf-2