我试图在vs代码中设置cuda编程,但遇到了这个问题,cuda gdb只返回了一个错误。我试着用普通gdb运行它,这很有效。我正在使用wsl。
运行";CUDA C++:启动";在调试控制台中输出:
warning: File "/usr/lib/debug/.build-id/45/87364908de169dec62ffa538170118c1c3a078.debug" has no build-id, file skipped
warning: File "/usr/lib/debug/.build-id/ce/016c975d94bc4770ed8c62d45dea6b71405a2c.debug" has no build-id, file skipped
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: File "/usr/lib/debug/.build-id/c0/f40155b3f8bf8c494fa800f9ab197ebe20ed6e.debug" has no build-id, file skipped
warning: File "/usr/lib/debug/.build-id/18/78e6b475720c7c51969e69ab2d276fae6d1dee.debug" has no build-id, file skipped
warning: File "/usr/lib/debug/.build-id/fe/91b4090ea04c1559ff71dd9290062776618891.debug" has no build-id, file skipped
Cannot find user-level thread for LWP 4949: generic error
只需在终端中运行Cuda gdb即可输出以下内容:
BFD: /usr/lib/debug/.build-id/45/87364908de169dec62ffa538170118c1c3a078.debug: unable to initialize decompress status for section .debug_aranges
BFD: /usr/lib/debug/.build-id/45/87364908de169dec62ffa538170118c1c3a078.debug: unable to initialize decompress status for section .debug_aranges
warning: File "/usr/lib/debug/.build-id/45/87364908de169dec62ffa538170118c1c3a078.debug" has no build-id, file skipped
BFD: /usr/lib/debug/.build-id/ce/016c975d94bc4770ed8c62d45dea6b71405a2c.debug: unable to initialize decompress status for section .debug_aranges
BFD: /usr/lib/debug/.build-id/ce/016c975d94bc4770ed8c62d45dea6b71405a2c.debug: unable to initialize decompress status for section .debug_aranges
warning: File "/usr/lib/debug/.build-id/ce/016c975d94bc4770ed8c62d45dea6b71405a2c.debug" has no build-id, file skipped
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
BFD: /usr/lib/debug/.build-id/c0/f40155b3f8bf8c494fa800f9ab197ebe20ed6e.debug: unable to initialize decompress status for section .debug_aranges
BFD: /usr/lib/debug/.build-id/c0/f40155b3f8bf8c494fa800f9ab197ebe20ed6e.debug: unable to initialize decompress status for section .debug_aranges
warning: File "/usr/lib/debug/.build-id/c0/f40155b3f8bf8c494fa800f9ab197ebe20ed6e.debug" has no build-id, file skipped
BFD: /usr/lib/debug/.build-id/18/78e6b475720c7c51969e69ab2d276fae6d1dee.debug: unable to initialize decompress status for section .debug_aranges
BFD: /usr/lib/debug/.build-id/18/78e6b475720c7c51969e69ab2d276fae6d1dee.debug: unable to initialize decompress status for section .debug_aranges
warning: File "/usr/lib/debug/.build-id/18/78e6b475720c7c51969e69ab2d276fae6d1dee.debug" has no build-id, file skipped
BFD: /usr/lib/debug/.build-id/fe/91b4090ea04c1559ff71dd9290062776618891.debug: unable to initialize decompress status for section .debug_aranges
BFD: /usr/lib/debug/.build-id/fe/91b4090ea04c1559ff71dd9290062776618891.debug: unable to initialize decompress status for section .debug_aranges
warning: File "/usr/lib/debug/.build-id/fe/91b4090ea04c1559ff71dd9290062776618891.debug" has no build-id, file skipped
Hello World1
Hello World2
Hello World3
Cannot find user-level thread for LWP 4077: generic error
(cuda-gdb)
我的任务.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: nvcc build active file",
"command": "/usr/bin/nvcc",
"args": [
"-g",
"-G",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /usr/bin/nvcc"
}
]
}
我的启动json:
{
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/maintest",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "CUDA C++: Launch",
"type": "cuda-gdb",
"request": "launch",
"program": "${workspaceFolder}/maintest"
}
]
}
更新wsl并更改为wsl版本2修复了它,但是由于cuda gdb还不支持wsl,因此cuda特定的函数不可调试:(