DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
adb: absolute debugger

Setting breakpoints

Breakpoints are typically set to stop program execution at a specific place in the program, such as the beginning of a function, so that the contents of registers and memory can be examined. To set a breakpoint in a program, use the :br command. Breakpoints cause execution of the program to stop when it reaches the specified address. Control then returns to adb. The command has the following form:

address [, count ] :br command

In the above command line address must be a valid instruction address. count is a count of the number of times the breakpoint is to be skipped before it causes the program to stop, and command is the adb command to be executed when the breakpoint is taken.

The following command sets a breakpoint at the start of the function named ``main'':

   main:br
The breakpoint is taken just as control enters the function and before the function's stack frame is created.

A breakpoint with a count is typically used within a function that is called several times during execution of a program, or within the instructions that correspond to a for or while statement. Such a breakpoint lets the program continue to execute until the given function or instructions have been executed for the specified number of times. For example, the following command sets a breakpoint at the fifth repetition of the function ``light'':

   light,5:br
The breakpoint does not stop the function until it has been called at least five times.


NOTE: No more than 16 breakpoints at a time are allowed.


Next topic: Displaying breakpoints
Previous topic: Executing a program

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003