microsoft / microsoft/vscode-cpptools

getRemoteProcessesExtendedRemote() sensitive to gdb warnings

Aperta
#13,673 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

debugger help wanted
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Environment
  • OS and version: Ubuntu 24.04 LTS
  • VS Code:
Version: 1.100.3
Commit: 258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3
Date: 2025-06-02T13:30:54.273Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.8.0-60-generic snap
  • C/C++ extension: 1.25.3
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version:
$ gdb --version
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Bug Summary and Steps to Reproduce

Bug Summary:

I am attempting to attach to a gdbserver instance from vscode. My process looks something like this:

  1. Start debugger which kicks off a task that launches a gdbserver instance. I am using bazel run --run_under='gdbserver :14000 so it is not possible for me to have vscode launch gdbserver on a binary directly.
  2. vscode will call gdb -ex "target extended-remote :14000" -ex "info os processes" -batch to get the remote processes
  3. gdb will output a warning like warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. to stderr. This is not an error - the actual gdb invocation for debugging will have the set sysroot / call.
  4. https://github.com/microsoft/vscode-cpptools/blob/3fc041daf68b871bd147ab89b8049111bfedd00c/Extension/src/Debugger/attachToProcess.ts#L199 sees len(stderr) !== 0 and considers the remote process query a failure.

As said above, this warning is okay. I'm not sure what the best way to fix this is.

Debugger Configurations
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "bazel-run-gdbserver",
      "type": "shell",
      "command": "bazel run -c dbg --run_under='gdbserver :14000' ${input:pickBazelTarget}",
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "isBackground": true,
      "problemMatcher": {
        "background": {
          "activeOnStart": true,
          "beginsPattern": "^exec ${PAGER:-/usr/bin/less}.*",
          "endsPattern": "^Listening on port.*",
        },
        "pattern": {
          "regexp": "",
        }
      }
    }
  ],
  "inputs": [
    {
      "id": "pickBazelTarget",
      "type": "command",
      "command": "bazel.pickTarget",
      "args": {
        "query": "kind('cc_binary|cc_test', //...:*)",
        "placeHolder": "Select Bazel target",
      }
    },
  ]
}

launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug Bazel Target (Attach)",
      "type": "cppdbg",
      "request": "attach",
      "program": "dummy_binary", // not important, we're not reading symbols from this anyway
      "MIMode": "gdb",
      "useExtendedRemote": true,
      "miDebuggerServerAddress": ":14000",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Set local sysroot",
          "text": "set sysroot /",
          "ignoreFailures": true
        },
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          "description": "Enable break on all exceptions",
          "text": "catch throw",
          "ignoreFailures": true
        },
        {
          "description": "Set search directory",
          "text": "dir ${workspaceFolder}",
          "ignoreFailures": true
        },
        {
          "description": "bazel-out -> bazel/out",
          "text": "set substitute-path bazel-out bazel/out",
          "ignoreFailures": true
        },
      ],
      "preLaunchTask": "bazel-run-gdbserver",
    }
  ]
}
Debugger Logs
N/A
Other Extensions

BazelBuild.vscode-bazel 0.11.0. Extension is used to help launch the helper task.

Additional Information

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in Extension/src/Debugger/attachToProcess.ts intorno alla riga 199 e segui l’invocazione di getRemoteProcessesExtendedRemote(), che esegue GDB con target extended-remote e info os processes. Riproduci il comando usando un gdbserver che emetta l’avviso documentato, quindi verifica che l’avviso non causi più un errore, mentre gli errori autentici nella query dei processi continuino a causarlo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
devtools
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.