microsoft / microsoft/MIEngine

`cppdbg` / MIEngine loses debugger control with `gdb 17.1` in Linux dev container, while `gdb 16.2` works

Open
#1,607 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
C#
Stars
859
Forks
233
Avg merge
1d 6h
Merged PRs (30d)
3

Description

Summary

In a Linux VS Code dev container, cppdbg with MIMode: "gdb" starts gdb 17.1 and launches the inferior process, but VS Code never gains usable debugger control.

Observed behavior with gdb 17.1:

  • The debuggee process starts.
  • The VS Code debugger UI does not become operational.
  • Pause does not work.
  • The session does not finish normally.
  • In practice the gdb process must be killed manually.

The same setup works when either of these is true:

  • cppdbg uses gdb 16.2
  • the WebFreak GDB adapter is used instead of Microsoft cppdbg

That strongly suggests an MIEngine compatibility issue with gdb 17.1, rather than a generic container TTY or ptrace problem.

Environment

  • Host workflow: VS Code connected to a Linux dev container
  • VS Code version: 1.128.0
  • OS inside container: Ubuntu 26.04 (Resolute Raccoon)
  • gdb failing with cppdbg: GNU gdb (Ubuntu 17.1-2ubuntu1) 17.1
  • gdb working with cppdbg: GNU gdb (GDB) 16.2
  • GCC in container: gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0
  • VS Code extensions in container:
    • ms-vscode.cpptools 1.32.2-linux-x64
    • ms-vscode.cpp-devtools 0.5.13
    • ms-vscode.cmake-tools 1.23.52
    • webfreak.debug 0.27.0
    • vadimcn.vscode-lldb 1.12.2

Container run arguments:

[
  "--network=host",
  "--cap-add=SYS_PTRACE",
  "--security-opt=seccomp=unconfined",
  "--security-opt=apparmor=unconfined"
]

Relevant container facts already checked:

  • /dev/pts is mounted and usable
  • tty returns a valid pseudo-terminal
  • kernel.yama.ptrace_scope = 1
  • NoNewPrivs: 0

Minimal repro configuration

This reproduces with a standard cppdbg launch configuration using MIMode: "gdb":

{
  "name": "Linux Debug",
  "type": "cppdbg",
  "request": "launch",
  "program": "/path/to/test-binary",
  "cwd": "/path/to/workspace",
  "externalConsole": false,
  "MIMode": "gdb",
  "miDebuggerPath": "/usr/bin/gdb",
  "setupCommands": [
    {
      "description": "Enable pretty-printing for GDB.",
      "text": "-enable-pretty-printing",
      "ignoreFailures": true
    },
    {
      "description": "Disable debuginfod prompts.",
      "text": "-gdb-set debuginfod enabled off",
      "ignoreFailures": true
    }
  ]
}

The same configuration works after changing only:

"miDebuggerPath": "/opt/gdb-16.2/bin/gdb"

Observed behavior

With gdb 17.1:

  • VS Code starts gdb.
  • The inferior process is started.
  • The debugger does not attach in a usable way from the VS Code side.
  • Pause is non-functional.
  • The session remains stuck until gdb is killed.

Debug Console output:

=thread-group-added,id="i1"
GNU gdb (Ubuntu 17.1-2ubuntu1) 17.1
Copyright (C) 2025 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.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"

Integrated terminal output:

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

Expected behavior

cppdbg should be able to control the inferior normally with gdb 17.1, the same way it does with gdb 16.2:

  • stop on breakpoints
  • pause on demand
  • inspect state
  • terminate cleanly

Comparison matrix

Adapter GDB version Result
cppdbg 17.1 Fails: inferior starts, VS Code never gains usable control
cppdbg 16.2 Works
webfreak.debug 17.1 Works

Additional observations

Manual MI startup with gdb 17.1 works from the shell:

gdb --interpreter=mi --tty="$(tty)" -q /bin/true

That does not reproduce the freeze by itself, which again points away from a generic TTY problem and toward the interaction between MIEngine and gdb 17.1.

The container is already configured with the usual native-debugging allowances:

  • SYS_PTRACE
  • seccomp=unconfined
  • apparmor=unconfined

So this does not appear to be caused by missing ptrace/container permissions.

Regression suspicion

This looks like a compatibility or regression issue between Microsoft MIEngine and gdb 17.1.

The most relevant facts are:

  • cppdbg fails with gdb 17.1
  • cppdbg works with gdb 16.2
  • another GDB adapter works with gdb 17.1
  • plain shell MI startup with gdb 17.1 is possible

Requested guidance

Please clarify:

  1. Whether gdb 17.x is officially supported by the current cppdbg / MIEngine implementation.
  2. Whether there is a known MI protocol incompatibility or regression with gdb 17.1.
  3. Whether the Failed to set controlling terminal warning is expected in remote-container scenarios and, if so, why it results in a non-functional session only for cppdbg.
  4. Whether there is a recommended MIEngine setting or launch option for gdb 17.1 in remote Linux containers.

Contributor guide

No contributing guide indexed for this repository

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

Start by reproducing the comparison matrix in the issue: cppdbg with GDB 17.1 and 16.2, then the manual MI startup command. Read the MIEngine behavior around the reported launch, control, and terminal interaction; done means identifying the compatibility cause and restoring breakpoint, pause, inspection, and clean termination with GDB 17.1.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.