Live Attach
The debugger supports attaching to applications that are already running. This may be useful to debug workloads that show hang-like behavior, such as deadlocks, infinite loops, etc.
Suppose you have an executing application with process ID 12345 and you want to use the debugger to inspect its state. Use the attach <PID> command to attach the debugger to your application. Here’s an example:
The debugger attaches to both the host application that runs on the CPU and the workload(s) that were submitted by the application and run on the GPU(s). The inferiors that correspond to the host application and the devices are created and added to the debug session automatically by the auto-attach feature as usual. All the CPU and GPU threads are stopped by the debugger as part of the attach command. Once you get the GDB prompt, you can inspect the program state and resume the threads the same way as if the program was started from the debugger.