microsoft / microsoft/vscode-cpptools

gdb debug with sudo privilege can't pause or set new breakpoint

Open
#9,659 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

debugger more info needed
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Issue Type: Bug

User logged in has sudo privilege, and been setted NOPASSWD in /etc/sudoers.
The snippet of launch.json is:

      "name": "gdb launch",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/lib/app",
      "args": [],
      "stopAtEntry": true,
      "cwd": "${workspaceFolder}/lib",
      "environment": [],
      "externalConsole": false,
      "miDebuggerPath": "${workspaceFolder}/.vscode/gdb.sh",
      "MIMode": "gdb",

Where gdb.sh is :

    #!/bin/bash
    sudo gdb "$@"

When debugging through gdb in remote ssh mode, vscode can't pause or set new breakpoint.
But there is no problem while loginning as root.

Environment:
Linux username-VirtualBox 5.4.0-110-generic #124~18.04.1-Ubuntu SMP Fri Apr 22 12:01:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
VSCode and all extensions are the up to date till this issue.

Extension version: 1.11.4
VS Code version: Code 1.69.2 (3b889b090b5ad5793f524b5d1d39fda662b96a2a, 2022-07-18T16:12:52.460Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
Remote OS version: Linux x64 5.4.0-110-generic

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided launch.json and .vscode/gdb.sh under remote SSH, then compare behavior with a root login. Start by tracing how the extension communicates with the sudo-launched GDB process, focusing on pause and breakpoint commands. Done means the cause is identified and non-root users with the stated sudo setup can pause and set breakpoints, or the limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.