Tutorial: Debugging with Intel® Distribution for GDB*

Set up a Remote Debugging Session

For remote debugging, configure machines and terminals the following way:

Run the gdbserver

  1. Launch the remote machine, where the debuggee program will run.

  2. Set correct values for PATH and LD_LIBRARY_PATH environment variables.

  3. Start gdbserver-gt the following way:

    gdbserver-gt --attach :1234 2
    where:
    • the port number 1234 is used to establish the TCP connection between gdbserver-gt and gdb-oneapi;
    • the session id 2 is used to attach gdbserver-gt to the debuggee program.

      Note

      This parameter defines the process identifier of the debugging target for the standard gdbserver.

Run the Debuggee Program

  1. On the remote machine, launch another terminal and set the following environment variable to inform the NEO runtime about the session ID:

    export IGFXDBG_OVERRIDE_CLIENT_PID=2

    Important

    The value used here must be equal to the session id used when starting gdbserver-gt.

  2. Set correct values for PATH and LD_LIBRARY_PATH environment variables.

  3. Run the program you want to debug. It will be stopped by gdbserver-gt and will look as if the program hangs.

    ./parallel-for-1D

Run the Client

  1. On your local machine, launch a new terminal and set correct values for PATH and LD_LIBRARY_PATH environment variables.

  2. Start gdb-oneapi:

    gdb-oneapi -q

  3. Connect to the gdbserver:

    target remote <server-ip-number>:1234
    The output should look as follows:
    Remote debugging using :1234
    0x00000000ffffd020 in ?? ()

Now you are all set to debug the GPU kernel.