### 27.9 gdb/mi Catchpoint Commands

This section documents gdb/mi commands for manipulating catchpoints.

#### The `-catch-load` Command

##### Synopsis

          -catch-load [ -t ] [ -d ] regexp

Add a catchpoint for library load events. If the ‘`-t`’ option is used, the catchpoint is a temporary one (see Setting Breakpoints). If the ‘`-d`’ option is used, the catchpoint is created in a disabled state. The ‘`regexp`’ argument is a regular expression used to match the name of the loaded library.

##### gdb Command

The corresponding gdb command is ‘`catch load`’.

##### Example

         -catch-load -t foo.so
         ^done,bkpt={number="1",type="catchpoint",disp="del",enabled="y",
         what="load of library matching foo.so",catch-type="load",times="0"}
         (gdb)

#### The `-catch-unload` Command

##### Synopsis

          -catch-unload [ -t ] [ -d ] regexp

Add a catchpoint for library unload events. If the ‘`-t`’ option is used, the catchpoint is a temporary one (see Setting Breakpoints). If the ‘`-d`’ option is used, the catchpoint is created in a disabled state. The ‘`regexp`’ argument is a regular expression used to match the name of the unloaded library.

##### gdb Command

The corresponding gdb command is ‘`catch unload`’.

##### Example

         -catch-unload -d bar.so
         ^done,bkpt={number="2",type="catchpoint",disp="keep",enabled="n",
         what="load of library matching bar.so",catch-type="unload",times="0"}
         (gdb)