tags:

views:

133

answers:

5

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 bit much for this step of the journey. Thanks in advance.

+4  A: 

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.

bmargulies
My sentiments exactly, thanks.
vector
+1  A: 

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

Carl Norum
... eventually they'll come in handy ;-)
vector
+2  A: 

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.

Illianthe
... forgot about Code::Blocks!
vector
+1  A: 

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.

Murali VP
Just Vim for me, and I agree.
vector
+2  A: 

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
stefanB
Agree, seems like a good start. Thanks!
vector