GDB warning "Failed to set controlling terminal" appears in VS Code Stable but not in VS Code Insiders

オープン
#14,680 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
静か
技術スタック
c, typescript, vscode

調査の方向性

まず、提供された launch.json と task.json を使って警告を再現し、その後 VS Code Stable と Insiders の間で GDB コマンドと MIEngine の詳細を比較します。C/C++ 拡張機能による --tty=${DbgTerm} の処理を調査し、Stable の動作が想定されたものか、リグレッションなのかを判断します。原因が特定され、警告の動作が一貫するようにするか文書化されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Environment

Environment

  • OS: Ubuntu Linux
  • Architecture: x86_64
  • VS Code Stable: 1.133.0
  • VS Code Insiders: 1.33.7
  • C/C++ extension: 1.32.2
  • GDB: GNU gdb (Ubuntu 15.1-1ubuntu1~24.04.1) 15.1
  • GCC: gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0

Bug Summary

When debugging a simple C program using GDB through the Microsoft C/C++ extension, VS Code Stable prints the following warning:

warning: GDB: Failed to set controlling terminal: Operation not permitted

However, the same project and debugging configuration do not produce this warning when using VS Code Insiders.

The C program itself runs normally in both versions.

For example, the program outputs:

Hello world!

After the program exits, VS Code Stable also shows:

[1] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-..." 1>"/tmp/Microsoft-MIEngine-Out-..."

Steps to Reproduce

  1. Open a simple C project in VS Code Stable.
  2. Configure cppdbg with GDB.
  3. Start debugging with F5.
  4. Observe the integrated terminal.

The following warning appears:

warning: GDB: Failed to set controlling terminal: Operation not permitted
  1. Open the same project with the same configuration in VS Code Insiders.
  2. Start debugging again.

The warning does not appear in VS Code Insiders.

Expected Behavior

The same debugging configuration should behave consistently between VS Code Stable and VS Code Insiders, or there should be an explanation for why GDB is unable to set the controlling terminal in the Stable version.

Actual Behavior

VS Code Stable:

warning: GDB: Failed to set controlling terminal: Operation not permitted

VS Code Insiders:

No warning

The program itself executes successfully in both cases.

Additional Information

The GDB command launched by VS Code is similar to:

/usr/bin/gdb --interpreter=mi --tty=${DbgTerm}

The warning seems to be related to the controlling terminal / TTY handling rather than the C program itself.

I also noticed that this behavior appeared after VS Code settings/extensions were synchronized. Before synchronization, I did not see this warning.

Is this expected behavior, or could this be a regression/change in the VS Code C/C++ extension or MIEngine?

I would like to understand why VS Code Stable attempts to set the controlling terminal in a way that results in:

Operation not permitted

while VS Code Insiders does not produce the warning.

Bug Summary and Steps to Reproduce

Steps to Reproduce

  1. Create a simple C project.
  2. Use the following .vscode/launch.json:
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": false,
      "program": "${workspaceFolder}/main.out",
      "cwd": "${workspaceFolder}",
      "MIMode": "gdb",
      "miDebuggerPath": "/usr/bin/gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "gcc"
    }
  ]
}
  1. Make sure /usr/bin/gdb is installed and available.
  2. Press F5 to start debugging.
  3. The program runs successfully, but the following warning appears in the terminal:
warning: GDB: Failed to set controlling terminal: Operation not permitted
  1. The same project and launch.json are opened in VS Code Insiders.
  2. Press F5 again.

The warning does not appear in VS Code Insiders.

The program itself runs normally in both versions and outputs:

Hello world!
Debugger Configurations
task.json:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "gcc",
            "type": "shell",
            "command": "gcc",
            "args": [
                "-g",
                "${workspaceFolder}/src/*.c",
                "${workspaceFolder}/main/*.c",
                "-o",
                "${workspaceFolder}/main.out",
                "-Wall",
                "-I${workspaceFolder}",
                "-I${workspaceFolder}/include",
                "-I${workspaceFolder}/src",
                "-I${workspaceFolder}/main"
            ],
            "problemMatcher": "$gcc",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}


launch.json:
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": false,
      "program": "${workspaceFolder}/main.out",
      "cwd": "${workspaceFolder}",
      "MIMode": "gdb",
      "miDebuggerPath": "/usr/bin/gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "logging": {
        "engineLogging": true,
        "trace": true,
        "traceResponse": true
      },
      "preLaunchTask": "gcc"
    }
  ]
}
Debugger Logs
## Debug Log

The C/C++ extension launches GDB with the following command:


"/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm


The terminal output contains the following warning:


&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"


The warning is printed to stderr.

The GDB version is:


GNU gdb (Ubuntu 15.1-1ubuntu1~24.04.1) 15.1


The C/C++ extension debug log also reports the following MIEngine version:


VS.Diagnostics.Debugger.ImplementationName: Microsoft.MIDebugEngine
VS.Diagnostics.Debugger.EngineVersion: 17.12.40402.1
VS.Diagnostics.Debugger.HostVersion: 17.12.40402.1
VS.Diagnostics.Debugger.AdapterId: cppdbg
VS.Diagnostics.Debugger.MIMode: gdb
VS.Diagnostics.Debugger.FrameworkVersion: 8.0.2526.11203


The program itself runs successfully and outputs:


Hello world!


The important difference is that the warning occurs when debugging with VS Code Stable, but does not occur when using VS Code Insiders with the same project and debugging configuration.
Other Extensions

No response

Additional Information

No response

主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/vscode-cpptools のほかの issue

microsoft/vscode-cpptools の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。