This topic only applies to Intel® MIC Architecture.
void attach_idb() {
volatile int loop = 1;
do {
volatile int a = 1;
} while (loop);
}
Call attach_idb() before the portion of code you want to debug is executed. The function attach_idb() must be executed in an offloaded region. After attaching to the process on the card, set a breakpoint inside the while-loop and continue execution. Once stopped there, set loop to 0, set breakpoints as required by your debugging session and continue execution.
To debug an application on the coprocessor only.
The debugger attaches to the application's process and stops it.
If the target-side application is dynamically linked against shared objects that are not part of the compiler or driver, and that need LD_LIBRARY_PATH to be set in order to find them, set a breakpoint before the libraries are loaded. When the debugger stops at that location, you can use the command set environment LD_LIBRARY_PATH to set that variable. Do the same for other environment variables that the application might need.