CUDA Debugger does not work on WSL2 or Docker, but works on Windows + Visual Studio 2022

Hello everyone,

I am trying to set up debugging on a station with the following configuration:

  • Windows 11
  • NVidia T500 laptop GPU.
  • WSL2 with Ubuntu 20.04 and Ubuntu 18.04.

CUDA debugging works fine within Visual Studio Community 2019 and Visual Studio 2022 (local development under Windows).

However, when I launch cuda-gdb in WSL2, it fails:

cuda-gdb ./test_cuda_program

Reading symbols from ./test_cuda_program...
(cuda-gdb) r
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/".
HOST starting...
[Detaching after fork from child process 159]
fatal:  One or more CUDA devices cannot be used for debugging. Please consult the list of supported CUDA devices for more details. (error code = CUDBG_ERROR_INVALID_DEVICE(0xb)


  • A cuda-gdb session inside a CUDA Docker container running in WSL2
  • VSCode connected to WSL2
  • VSCode connected to a CUDA Docker container running in WSL2

Otherwise, nvcc compilation and running compiled CUDA code works fine under WSL2 and under a CUDA Docker container running in WSL2.

CUDA Toolkit Documentation mentions this: “CUDA debugging or profiling tools are not supported in WSL 2. This capability will be added in a future release.”

Does this mean that as of time of writing it is not possible to debug CUDA code with cuda-dbg or with Nsight Visual Studio Code Edition if the target runs under WSL2 or a CUDA Docker container under WSL2?

Related post: Cuda-gdb not working for kernel code under WSL2

Yes, we do not yet support cuda-gdb.

Is there any known (approximate) time frame for this support to become available?


driver 520+ had support cuda-gdb.

Hi, can you provide further information about your GPU, driver version, cuda version. Thank you very much.