NVIDIA / nsight-vscode-edition

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

Could nsight-vscode attach to a process? #3

Closed feihugis closed 3 years ago

feihugis commented 3 years ago

I tried to attach to a process using below configure, but the debug task was just hanging there.

    {
      "name": "(cuda-gdb) Attach",
      "type": "cuda-gdb",
      "request": "attach",
      "program": "/opt/conda/bin/python",
      "pid": 13498,
    },
feihugis commented 3 years ago

I was able to attach to a process by using the config below:

    {
      "name": "(gdb) Attach",
      "type": "cppdbg",
      "request": "attach",
      "program": "/opt/conda/bin/python",
      "processId": "${command:pickProcess}",
      "MIMode": "gdb",
      "miDebuggerPath": "/usr/local/cuda/bin/cuda-gdb",
      "setupCommands": [
          {
              "description": "Enable pretty-printing for gdb",
              "text": "-enable-pretty-printing",
              "ignoreFailures": true
          }
      ]
    },
huynhducloi00 commented 6 months ago

why does it need to be run as superuser? "Superuser access is required to attach to a process. Attaching as superuser can potentially harm your computer. Do you want to continue? [y/N]"

The thing is that my process has this marked: import prctl PR_SET_PTRACER_ANY = 0xffffffff prctl.set_ptracer(PR_SET_PTRACER_ANY)

This basically makes it debuggable by any other debugger