开发者

Learning C : noob suitable debugger

开发者 https://www.devze.com 2022-12-11 00:07 出处:网络
Greetings! Finally stared learning C and I think the time has come to start working with a debugger. At this time I\'m using Gvim for editor and command line for compiling. After trying few debuggers

Greetings! Finally stared learning C and I think the time has come to start working with a debugger. At this time I'm using Gvim for editor and command line for compiling. After trying few debuggers ( KDbg, ddd,insight ) running gdb seems to be the simplest and least overwhelming at the moment.

I'm I on the right path or is there a better way to go about it?

I also tried NetBeans and Anjuta, but they feel like a little 开发者_JAVA百科bit much for this step of the journey. Thanks in advance.


If you are comfy on a command line, then gdb will load you with the least conceptual chaff.

If you are on Windows, well, Visual Studio is pretty friendly.

Eclipse's CDT is not bad, but it takes some learning to get your project into it to the point where you can debug.


vim/gvim + gdb is a good path

Quite often you will be left with remote connection to a linux box and gdb so it's quite useful to know how to use gdb from command line.

If you're debugging on a local box with GUI you might try ddd or any other gui debugger. Gui debuggers provide easier ways of inspecting values of variables in memory for example if you have nested structures. However if you are linking additional libraries and you want to jump into them gdb is easier compared to for example Visual Studio.

If you setup Makefile in your project directory you can simply from inside vim use:

:mak

To build your code and it will jump into the first warning/error. You can move to next error with:

:cn

Or view list of errors:

:cope

Jump between open multiple subwindows:

ctrl-w ctrl-w

Hide list of errors, go to the window that shows errors and:

:clo


I'm using gdb for my university assignments, and it's going pretty well. For the most part, the debuggers in the IDEs you've listed (NetBeans, Anjuta) actually rely on an external program such as gdb for the debugging.

There are graphical interfaces for gdb; however, I personally find many of them to be pretty clunky. Hooking up gdb with Code::Blocks did turn out pretty well though, for me.


Learning gdb can't hurt, certainly. It's pretty ubiquitous. A nice GUI debugger can certainly speed things up.


It is probably overwhelming at the beginning but it still is a good idea to use gdb, this will help you debug in any system with no IDEs installed. If you are an emacs user, you can even single step visually.

0

精彩评论

暂无评论...
验证码 换一张
取 消