KDbg - User's Manual - How Do I...?
Author: Johannes Sixt

Contents

# How Do I...?

#### ... set breakpoints?

There's more than one way to set a breakpoint:

- You can set it in the source window by clicking on the "active area" at the far left of the line.
- You can set it by selecting the line in the source window and choosing an option from the Breakpoint menu.
- You can set it in the breakpoint list.

If you can't set breakpoints, maybe the program is currently running. You can't set breakpoints while the program is running. Stop it first using Execution|Break. If you still can't set breakpoints, make sure that you have compiled and linked your program with debugging information enabled.

#### ... display the value of a global variable or an arbitrary expression?

Use the Watch window.

#### ... set watchpoints?

Watchpoints are manipulated in the breakpoint list.

#### ... use a core dump?

First load the executable using File|Executable, then specify the core dump using File|Core dump.

#### ... debug a program that's caught in an endless loop?

Start the program and let it run until it is in the endless loop. Then switch to KDbg and choose Execution|Break. You've just caught the nasty program in flagranti!

#### ... achieve that the program passes over a breakpoint a number of times before it stops?

In the breakpoint list select the breakpoint; then click Conditional and specify the number of times to skip the breakpoint in the Ignore count field.

#### ... set environment variables for the executable?

Select Execution|Arguments and specify the environment variables in the program arguments dialog.

#### ... set a working directory for the executable?

Select Execution|Arguments and specify the working directory in the program arguments dialog.

#### ... get rid of this terminal window?

Select Settings|This Program and switch to the Output tab. Select Only output, simple terminal emulation and click OK. Now restart the program (choose it from the list under File|Recent Executables). The program output goes now to the built-in output window and stdin is redirected to `/dev/null`.

You must do this for every new program that you debug.

Important: You should not do this if your program expects input from the terminal (usually stdin) or if its output requires nifty terminal emulation (more than carriage-return and line-feed). The built-in output window does not support input and terminal emulation.