You copied the Doc URL to your clipboard.

break

Sets an execution breakpoint at a specific location. You can also specify a conditional breakpoint by using an if statement that stops only when the conditional expression evaluates to true.

This command records the ID of the breakpoint in a new debugger variable, $<n> , where <n> is a number. You can use this variable, in a script, to delete or modify the breakpoint behavior. If $<n> is the last or second-to-last debugger variable, then you can also access the ID using $ or $$ respectively.

Note

Breakpoints that are set within a shared object or kernel module become pending when the shared object or kernel module is unloaded.

Use set breakpoint to control the automatic breakpoint behavior when using this command.

Syntax

break [-d] [-p] [[<filename>:] <location> | *<address>][[thread|core] <number>...] [if <expression>]

Where:

-d

Disables the breakpoint immediately after creation.

-p

Specifies whether or not the resolution of an unrecognized breakpoint location results in a pending breakpoint being created.

<filename>

Specifies the file.

<location>

Specifies the location:

<line_num>

is a line number.

<function>

is a function name.

<label>

is a label name.

+<offset> | -<offset>

Specifies the line offset from the current location.

*<address>

Specifies the address. This can be either an address or an expression that evaluates to an address.

<number>

Specifies one or more threads or processors to apply the breakpoint to. You can use $thread to refer to the current thread. If <number> is not specified then all threads are affected.

<expression>

Specifies an expression that is evaluated when the breakpoint is hit.

If no arguments are specified then a breakpoint is set at the current PC.

You can use info breakpoints to display the number and status of all breakpoints and watchpoints.

Examples

break *0x8000                     # Set breakpoint at address 0x8000
break *0x8000 thread $thread      # Set breakpoint at address 0x8000 on
                                  # current thread
break *0x8000 thread 1 3          # Set breakpoint at address 0x8000 on
                                  # threads 1 and 3
break main                        # Set breakpoint at address of main()
break SVC_Handler                 # Set breakpoint at address of label SVC_Handler
break +1                          # Set breakpoint at address of next source line
break my_File.c:main              # Set breakpoint at address of main() in my_File.c
break my_File.c:10                # Set breakpoint at address of line 10 in my_File.c
break function1 if x>0         # Set conditional breakpoint that stops when x>0
break *0x80000000 if $thread==32  # Set conditional breakpoint that stops execution
                                  # when thread ID is 32.
break *0x80000000 if $pid==928    # Set conditional breakpoint that stops execution
                                  # when process ID is 928.