1

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.

5 Answers 5

4

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

2

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.

1 Comment

... forgot about Code::Blocks!
1

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

1 Comment

... eventually they'll come in handy ;-)
1

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.

1 Comment

Just Vim for me, and I agree.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.