next up previous contents index
Next: 4.4 Examining the Stack Up: 4 Debugging Previous: 4.2 Values and Expressions

4.3 Running and Stopping

 The debugger supports breakpoints and memorypoints. Breakpoints cause execution of the program to stop when the instruction at the breakpoint address is executed. Memorypoints cause the execution of the program to stop when the memorypoint address is read or written. To set a breakpoint, use the ``break'' command.

For example, to set a breakpoint at the library function SendMessage:

break SendMessage

Memorypoints require that an additional kernel module to be loaded before the feature may be used. This module is supplied in source form and is in the source directory src/modules/bp. In that directory, issue the make command to build the module bp.o. After that is completed, install the module using the command:

insmod bp.o

You must be the superuser to issue the previous command. After the module bp.o is installed in the kernel, memorypoints may be set.

For example, to stop when the variable x is accessed:

mp x

You may disable and enable breakpoints and memorypoints using the commands:

enable bp NUM
enable mp NUM
disable bp NUM
disable mp NUM

Number is the number that the debugger assigned to the breakpoint or memorypoint. The command, ``info break'', will give you a listing of all the breakpoints and memorypoints.

Additionally, breakpoints may have conditions attached to them.

For example, to stop at breakpoint 1 only if the contents of AVariable has the value 10:

condition 1 *AVariable = 10

To resume execution, you may use one of four commands. ``c'' or ``cont'' stands for continue and resumes execution of the program until the next breakpoint or memorypoint. ``s'' or ``step'' cause the next instruction to be executed. ``n'' or ``next'' is similar to step, but if the next instruction is a ``call'' instruction, execution is continued until the call returns. Finally, ``trace'' allows you to watch every single instruction as it executes.

You may also force execution of a library or native application function.

For example, to execute the solitaire program:

WinExec(``sol.exe'', 0)


next up previous contents index
Next: 4.4 Examining the Stack Up: 4 Debugging Previous: 4.2 Values and Expressions
Send corrections/suggestions via e-mail to: Rob Penrose