Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
584 Discussions

Visual Studio Code debug session hangs on stepping over DPC++ function queue(DeviceSelector.select_d

Illya
Novice
1,912 Views

OS: Ubuntu 20.04.5 LTS 64bit

Platform: Latitude 7320, 16Gb RAM, Intel i71185G7, GPU Mesa Intel Xe TGLGt2

Visual Studio Code: 1.71.2

Visual Studio Code extensions: Microsoft C/C++ pack, all Intel oneAPI extension except 'GDB with GPU Debug Support for Intel® oneAPI Toolkits'

Intel oneAPI toolkits: Base + necessary prerequisites given in the setup instructions

Context: Using an Intel oneAPI code example simple-add, a project is setup to build the two code samples buffers and usm. Using the DPC++ compiler to build debug executables (-O0 optimisation), they work and execute as expected. Set up debug session (see launch.json below), the debug sessions using gdb-oneapi can step over or into lines of code in the DPC++ sample using the Visual Studio Code debug panel.

The problem in brief: Visual Studio Code debug session hangs on stepping over DPC++ function queue(DeviceSelector.select_device(),...).

In detail: Using the Visual Studio Code debug panel a debug session can proceed through the code stepping over or into functions. When the DPC++ function queue(DeviceSelector.select_device(),...) is reached and stepped into or over, the IDE reports running and hangs, the GUI debug panel is partially ghosted out. The debug session does not continue (or stop at any following break points) and so need to abort the debug session.

Start a new debug session and again using the debug panel step in or over code to get to the point just before entering the function queue(DeviceSelector.select_device(),...), now type in the debug console terminal gdb command -exec step the code executes. A whole load of threads are reported to be created, and the debug session can continue using the GUI debug panel and the rest of the code can be stepped through as expected.

Using the gdb-oneapi debugger as a stand alone session from a terminal window, debugging works as expected, no hanging.

Not able to step in the DPC++ function select_device() and any deeper whole debugging by any debug method, as only have the DPC++ header files.

Injecting a gdb command from the debug console window should not be required to achieve a successful debug session.

Is this a problem with gdb-oneAPI and or Visual Studio Code?

The launch.json for the project is:

{
"name": "C/C++: dpc++ build and debug simple-add-usm",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/${config:programNameUsm}_d",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "simple-add-usm Debug C/C++: dpcpp build active file",
"miDebuggerPath": "/opt/intel/oneapi/debugger/latest/gdb/intel64/bin/gdb-oneapi"
},
{
"name": "C/C++: dpc++ build and debug simple-add-buffers",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/${config:programNameBuffers}_d",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "simple-add-buffers Debug C/C++: dpcpp build active file",
"miDebuggerPath": "/opt/intel/oneapi/debugger/latest/gdb/intel64/bin/gdb-oneapi"
}

 

 

0 Kudos
2 Replies
Illya
Novice
1,899 Views

The Gui debug hang is solved by added the following to the launch.json file:

"setupCommands": [
{
"description": "Disable target async",
"text": "set target-async off",
"ignoreFailures": true
}

 

0 Kudos
VarshaS_Intel
Moderator
1,890 Views

Hi,


Glad to know that your issue is resolved. Thanks for sharing the solution with us. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards,

Varsha


0 Kudos
Reply