Closed mtene closed 1 year ago
I'd like to add that we hit the same problem. Is there any update on this? I tried to play with the launch file and though I can attach cuda-gdb to a process it shows weird stuff in debug variables window.
Any update on this?
Hi @mtene, are you talking about attach config? In 2021, we released the ability to attach to a running application, here are the release notes and here is the official documentation for the same, hope this helps!
@nikitablack can you share some details on what you see?
@sanannavyaa thank you for the update, I can confirm that I was able to attach to a running process using the launch config described in the documentation:
{
"name": "Attach cuda-gdb",
"type": "cuda-gdb",
"request": "attach",
"processId": "${command:cuda.pickProcess}",
"program": "/path/to/exe",
"debuggerPath": "/path/to/cuda-gdb"
}
a problem is when vscode does this: ""configurations": [ { "name": "CUDA C++: Attach", "type": "cuda-gdb", "request": "attach", "processId":"${command:cuda.pickProcess}", " in the launch config, it fail with the ptrace permission for the same process. where cuda-gdb does not fail.
i have managed to add this piece of code in the .py: import prctl PR_SET_PTRACER_ANY = 0xffffffff prctl.set_ptracer(PR_SET_PTRACER_ANY)
this would make the process "tracable"/debuggable by any other process. That is why cuda-gdb can attach. However, why using the launch.json of vscode above cannot attach. do you have special checking if i go that round.
Hi @huynhducloi00 you might need to allow ptrace 0 on your system if you want to attach process.
echo 0 |sudo tee /proc/sys/kernel/yama/ptrace_scope
to use cuda-gdb attach also require ptrace persmission
Currently, the VSCode + NSight debugging experience only offers support for launching an application. Users need the possibility to also attach to an already existing process. This is core VSCode debugging functionality and is desired for programs that have complex launches, which are not covered by the "launch" option.