Using the internal debugger

KDevelop Felhasználói Kézikönyv -Fordítás alatt: Referencia Kézikönyv a Unix operációs rendszer alatt futó KDevelop Integrált Fejlesztői Környezethez, 1.0 Verzió
Vissza | Fejezet 12. A belső nyomkövető | Tovább

# 12.2. Using the internal debugger

## 12.2.1. Changes made in the tree and output view window

If you choose the internal debugger, four tabs are added to your tree and output view windows.

### 12.2.1.1. On the tree view window

- VAR tab : A tree view of the local variables at the current place in the program you have stopped at. You can also see local variables in the function that called this functions. The VAR tab also contains a watch window. This allows you to see the value of global variables, or perhaps you may want to see only one local variable rather than the variable in a large list of local variables.

### 12.2.1.2. On the output view window

- breakpoint : A list of breakpoints set and their current state.

- framestack : The calling stack.

- disassemble : A machine instruction view of the code showing the current instruction to be executed.

## 12.2.2. Changes made in the Debug menu and on the panel

### 12.2.2.1. On the panel

Two normal and two dropdown buttons to control the debugger functions will be accessible as soon as you start the debugger.

### 12.2.2.2. In the Debug menu

When you start debugging, ten items to control the debugger will be enabled.

Available functions:

- Run: Continue the program from the current point.

- Run to cursor: Execute the program up to the current cursor position

- Step over: Execute one line of code stopping on the next line of code in the same surce file. This will run any functions encountered until the above condition is met.

- Step over i(nstruction): Execute one machine instruction as above.

- Step in: Execute exactly one source line of code. This means you will "step into" the current function, if necessary

- Step in i(nstruction): Execute one machine instruction as above.

- Step out: Run to the end of the current stack frame (function)

- Viewers: Allows a variety of views into the data. Currently implemented views are:

  1. Memory address

  2. Disassemble code

  3. Current registers

  4. Current libraries

- Interrupt: Stop the application executing.

- Stop: Stop the application executing and exit the debugger.

## 12.2.3. Details

### 12.2.3.1. Breakpoints

Breakpoints can be set against source lines in a file (referred to as breakpoints) or on variables in the source (referred to as watchpoints). Both types of breakpoints can be set at anytime, however watchpoints on local variables only have meaning in the variables local scope. Watchpoints have more meaning when you are dealing with global variables.

### 12.2.3.2. Set/Unset breakpoints

Simple one click set/unset. Click on the "icon" border to the left of the text in the editor at the line you want the breakpoint. Click again on this line to unset the breakpoint.

### 12.2.3.3. Alternative beakpoint manipulating via menus

By right clicking on a breakpoint in the breakpoint list or on a breakpoint in the editors icon border you will get a menu of breakpoint options. This allows you to remove this breakpoint, clear all breakpoints, or edit the breakpoint.

### 12.2.3.4. Editing breakpoints

Use the above menu to display the edit breakpoint dialog. This contains the following fields :

1. Conditional: Enter the condition that must be met before gdb will interrupt the program execution.

2. Ignore count: How many times you want the code to past through this breakpoint before gdb interrupts the program execution.

3. Enable: When enabled gdb will break at this breakpoint. When disabled gdb will not break here.

### 12.2.3.5. Clear all breakpoints

Removes all the breakpoints for this program.

### 12.2.3.6. Set/Unset watchpoints

In the VAR view click with the Right Mouse button on a variable. A popup menu will be displayed allowing you to set a watchpoint on the local variable. This functionality is limited to the scope that the local variable is in. As the variable goes out of scope the program breaks and the watchpoint is deleted.

WARNING: This is known to be problematic, so use caution when setting watchpoints on local variables.

The watchpoint can also be set by a right mouse click on a previously entered watch variable, and selecting "toggle watchpoint"

### 12.2.3.7. Set/Unset Watch variables

At the bottom of the VAR view there is the "Watch" field where you can enter the variable name you wish to see display in the watch list. Enter the variable name and type "enter" or click on the "Add" button alongside the field. Right Mouse clicking on the watch variable in the treeview will bring up a menu so that you can remove the variable from the list.

You can also enter a watch variable by right mouse clicking on a variable name in the editor window. This displays a popup menu with "watch: variable name" on it.

### 12.2.3.8. Changing variable values

This is done via the watch variable. If you have a variable "test" then to set "test" to 5 type "test=5" in the watch field and add it to the list. Note that "test" will be set to "5" EVERY time the program stops at a breakpoint, so once you have set the variable, usually you should remove the item from the watch view.

Vissza | Tartalom | Tovább
A belső nyomkövető | Fel | The floating toolbar