Shared Library GDB/MI Catchpoint Commands (Debugging with GDB)
From Get docs
Gdb/docs/latest/gdb/Shared-Library-GDB 002fMI-Catchpoint-Commands
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)