NVIDIA / nsight-vscode-edition

A Visual Studio Code extension for building and debugging CUDA applications.
Other
68 stars 11 forks source link

Launch/Attach with Debugger Args / Environment Vars #27

Closed collinmccarthy closed 1 year ago

collinmccarthy commented 1 year ago

Hello,

With type=cppdbg we can configure with environment and miDebuggerArgs. I would like to do the same when launching and attaching via type=cuda-gdb. To use cuda-gdb on our cluster, I need to pass in --cuda-use-lockfile=0 as a debugger argument and/or set TMPDIR=${workspaceFolder}/../cuda-gdb as an environment variable.

I tried using the following in my launch.json but the status bar is missing the current threadblock focus and I'm not sure if it is working 100% correctly under the hood.

// Works, but missing some features, and may have other problems?
{
  "name": "debug",
  "type": "cppdbg",
  "request": "launch",
  "program": "${workspaceFolder}/build-Debug/bin/test",
  "environment": [
    {"name": "TMPDIR", "value": "${workspaceFolder}/../cuda-gdb-tmp"},
  ],
  "MIMode": "gdb",
  "miDebuggerPath": "/usr/local/cuda-11.7/bin/cuda-gdb",
  "miDebuggerArgs": "--cuda-use-lockfile=0",
},

Is this the recommended way to do this? Or, is this possible with type=cuda-gdb and I'm missing it? If not, please consider it a feature request. I really like debugging in VSCode and don't want to have to resort to the command line tool when I need to use these features.

Thank you, -Collin

sanannavyaa commented 1 year ago

Hi @collinmccarthy! Currently, we support setting environment variables using envFile. Here is the documentation. Alternately, you could set "initCommands" = ["set environment TMPDIR= ${workspaceFolder}/../cuda-gdb-tmp"] in your launch.json. We currently do not support setting miDebuggerArgs, but will consider this is a feature request.

sanannavyaa commented 1 year ago

Hi @collinmccarthy as of our latest release we support setting "environment".