Name

break

Synopsis

break [bp-spec]
break bp-specif condition
break bp-spec thread threadnum
break bp-spec thread threadnum ifcondition

Set a breakpoint. The first form sets an unconditional breakpoint; execution of the debuggee stops when the breakpoint is reached. The second form sets a conditional breakpoint: when the breakpoint is reached, GDB evaluates the condition. If the condition is true, execution stops. If it isn’t, the program continues. In either case, bp-spec is one of the items given in the following section.

The third and fourth forms are similar to the first and second ones respectively; however, they work on individual threads of control running within the debuggee. They specify that GDB should stop the program only when the given thread threadnum reaches the point specified by bp-spec.

Breakpoint Specifications

The following list shows the different forms that the break command can take.

break

Set a breakpoint at the next instruction in the current stack frame. If you are not in the innermost stack frame, control stops as soon as execution returns to that frame. This is like the finish command, except that finish doesn’t leave a breakpoint set. In the innermost frame, GDB stops when the breakpoint is reached. This is most useful inside loop bodies.

break function

Set a breakpoint at the first instruction of function.

break linenumber

Set a breakpoint at line linenumber in the current file.

break file : line

Set a breakpoint at line number line in source file file.

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.