Shared Library GDB/MI Catchpoint Commands (Debugging with GDB)

Next: Ada Exception GDB/MI Catchpoint Commands, Up: GDB/MI Catchpoint Commands [Contents][Index]

#### 27.9.1 Shared Library GDB/MI 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)