KDbg

Contents


Introduction

KDbg is a front-end for gdb, the GNU debugger.

At the moment there is not much documentation available.

For the really brave there's documentation about how KDbg can understand types like QString.

What's it that I see here?

The main window of KDbg consist of four panes:

The upper left pane shows the source code. Mostly, source code windows are opened automatically. To open a souce code window manually choose File|Open Source from the menu. You can switch the opened source code windows by choosing an open source file from the Window menu.

The lower left pane displays the backtrace (aka stack frames), i.e. the functions that the program has entered, but not left yet. The innermost frame (where the program currently executes) is shown at the top. Double-click on a stack frame to inspect the variables of that frame.

The upper right pane displays the local variables. Whenever the progam stops, KDbg displays the values of the local variables in this pane.

The lower right pane displays expressions of your choice (such expression is also called a watch). To add an expression, type it into the edit field and press Enter or click Add. To remove an expression, click on it (choose the root of the expression) and click Del.

The gearwheel in the toolbar indicates whether gdb is working, in which case it rotates. It rotates fast while KDbg wouldn't accept execution commands, and it rotates slowly while KDbg gets the variable values.

Using KDbg

To debug a program, choose File|Executable from the menu. The program is loaded. An xterm window is opened which will show the output of the debuggee. If you want to debug a core dump, you must first load the executable that produced the core dump, then choose File|Core Dump from the menu. Now KDbg goes to the point in the program that caused the core dump.

To run the program with arguments, choose Execution|Arguments and type in the arguments. Next time the program is started, the arguments will be passed on.

In the menu Execution you find the commands that you need to run the program, step through code, and to interrupt the program (Break) while it is running. The important commands (Run and all kinds of Step) are bound to function keys. For efficient debugging I strongly recommend that you get used to using them.
The functions are not configurable, but perhaps you want to contribute a bit of code that does it?

In the menu Breakpoint you find commands to set, clear, disable, and enable permanent and temporary breakpoints. You can display a list of active breakpoints. You can also set a breakpoint by clicking at the left end of the source line (using the left mouse button), and you can enable and disable a breakpoint by clicking it using the middle mouse button.

The breakpoint list

The breakpoint list can be displayed using Breakpoint|List. The breakpoint location is shown for each breakpoint. A red icon in front of the entry indicates that the breakpoint is disabled, a green icon indicates an enabled breakpoint.

Tip: You can use breakpoints as bookmarks: Just set a breakpoint and disable it. Later, you can quickly come back to that breakpoint by double-clicking it in the breakpoint list (or select it and click View Code). Since breakpoints are persistent (i.e. KDbg remembers them across invocations of a program), you get them back next time you invoke KDbg for that particular program.

Author

KDbg is written by Johannes Sixt with the help of many others.