Debugging C/C++ with Kdbg (+ Kdevelop issues)

Kdbg is a graphical debugger – more precisely, it is the graphical interface for the excellent gdb debugger. I like a lot Microsoft Visual C++ 6.0 for its debugging abilities but Kdbg is just as good. So how do we use it?

First you need to compile your c/c++ source with “-g”(this is very important). E.g

gcc test.c -g

where test.c is the name of your source. You can after that odd your usual “-o” flags … as usual (this is meant to be a simple simple guide, so I’ll skip whatever is not required)

Next, invoke the Kdbg debugger as follows:

kdbg a.out

OnceKdbg is open, set your breakpoints on the lines required and click start and step over, step into,… as appropriate. It works like a charm.



For those who don’t know, KDevelop is a very nice IDE and according to me even better than Ms Visual C++.

So if you use KDevelop , debugging should be pretty easy – it’s done by itself. However, for Input/Output console applications, there’s a small twist. By default, if there’s some input to be done, the debugger will halt and won’t move even if u bang your head against it. The solution is quite simple though.

Go to: Project -> Project Options -> Debugger tab and check “Enable separate terminal for application IO”.

That should do it.


7 responses to “Debugging C/C++ with Kdbg (+ Kdevelop issues)

  1. Hi!
    Thanks a lot for I/O Option in the Debugger! I was really about to bang my head against the screen… 😉

  2. I just installed the KDevelop4 yesterday (4/23/13). However, there’s no such things as Project -> Project Options! It has Run->Configure Lauches, but no Debugger options at all!

  3. Pingback: Why doesn’t debugger stop at breakpoint? | An external memory dump·

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s