Up: Inferiors Connections and Programs   [Contents][Index]


4.9.1 Inferior-Specific Breakpoints

When debugging multiple inferiors, you can choose whether to set breakpoints for all inferiors, or for a particular inferior.

break locspec inferior inferior-id
break locspec inferior inferior-id if …

locspec specifies a code location or locations in your program. See Location Specifications, for details.

Use the qualifier ‘inferior inferior-id’ with a breakpoint command to specify that you only want GDB to stop when a particular inferior reaches this breakpoint. The inferior-id specifier is one of the inferior identifiers assigned by GDB, shown in the first column of the ‘info inferiors’ output.

If you do not specify ‘inferior inferior-id’ when you set a breakpoint, the breakpoint applies to all inferiors of your program.

You can use the inferior qualifier on conditional breakpoints as well; in this case, place ‘inferior inferior-id’ before or after the breakpoint condition, like this:

(gdb) break frik.c:13 inferior 2 if bartab > lim

Inferior-specific breakpoints are automatically deleted when the corresponding inferior is removed from GDB. For example:

(gdb) remove-inferiors 2
Inferior-specific breakpoint 3 deleted - inferior 2 has been removed.

A breakpoint can’t be both inferior-specific and thread-specific (see Thread-Specific Breakpoints), or task-specific (see Ada Tasks); using more than one of the inferior, thread, or task keywords when creating a breakpoint will give an error.