Can I use Eclipse CDT to debug a prebuilt C++ executable?

On Linux, I have some C++ programs built with my own makefiles, and I'm looking for some GUI debuggers to debug them at source level.

Previously I use KDbg(2.5.2) on openSUSE(12.3). It works but with some very annoying limitation, eg, I cannot set a breakpoint when the debugged program is not trapped by Kdbg -- I mean, in order to set a new breakpoint, I have to set it before the program is launched or the program pauses on hitting an already set breakpoint.

Now I try to use Eclipse CDT. I got eclipse-cpp-juno-SR2-linux-gtk.tar.gz but find that I don't know how to load my executable so to start debugging.

I googled with words like 『eclipse debug pre-built C binary』, but few seems to care about this feature.

Can Eclipse CDT really do that? If Eclipse CDT can't, is there any better alternatives to KDbg? Please help.

在这里输入图像描述


According to hint from this answer, https://stackoverflow.com/a/248119/151453 , I finally figure out how to do it.

The key point is: In the Eclipse CDT project, create/edit a Launch Configuration so to tell the debugger what executable to load.

Now I have to admit, Eclipse CDT does quite well in C++ code debugging far better than KDbg.

Some screen shot below, on openSUSE 12.3 .

F: ChjKeep  chj.dev 桌面 AUTO-SNAP 向导prjtype.pngF: ChjKeep  chj.dev 桌面 AUTO-SNAP  CDT-prjdir.pngF: ChjKeep  chj.dev 桌面 AUTO-SNAP  CDT-prjwiz-finish.pngF: ChjKeep  chj.dev 桌面 AUTO-SNAP  CDT-菜单prjprop.pngF: ChjKeep  chj.dev 桌面 AUTO-SNAP  CDT-prjprop-runsetting.pngF: ChjKeep  chj.dev 桌面 AUTO-SNAP  CDT-PRJ-exepath.png

Now we can Run -> Debug (F11) F: ChjKeep  chj.dev 桌面 AUTO-SNAP  CDT要约开关兼pers.png

Debugger automatically pauses the program at main()'s first statement.

F: ChjKeep  chj.dev 桌面 AUTO-SNAP  CDT  - 暂停 -  main.png


The Stand-alone Debugger is an Eclipse application which packages the Eclipse plug-ins from the CDT (C/C++ Development Tools) project into an application that can be started from a command-line script:

bash /path/scripts/cdtdebug.sh -e executable [args]

链接地址: http://www.djcxy.com/p/61672.html

上一篇: 缓存当前用户特定页面

下一篇: 我可以使用Eclipse CDT来调试预构建的C ++可执行文件吗?