Add configurable debuginfod settings to prevent GDB hangs#1561
Open
WardenGnaw wants to merge 2 commits into
Open
Add configurable debuginfod settings to prevent GDB hangs#1561WardenGnaw wants to merge 2 commits into
WardenGnaw wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable debuginfod launch option to control GDB’s debuginfod behavior (enable/disable + request timeout) to prevent long hangs when DEBUGINFOD_URLS points to unreachable servers.
Changes:
- Added new launch options/schemas for
debuginfod(JSON + XML/XSD) with validation and runtime clamping of negative timeouts. - Updated MIEngine initialization to only enable debuginfod when configured, and updated local process launch to apply debuginfod-related environment variables.
- Added new integration tests + a dedicated debuggee to validate “disabled” and “timeout” scenarios.
Show a summary per file
| File | Description |
|---|---|
| test/CppTests/Tests/DebuginfodTests.cs | Adds integration tests validating debuginfod disable/timeout prevents hangs. |
| test/CppTests/Tests/DebuggeeMonikers.cs | Adds a moniker for the new debuginfod debuggee. |
| test/CppTests/OpenDebug/CrossPlatCpp/LaunchCommand.cs | Extends test launch args to support debuginfod and setupCommands. |
| test/CppTests/debuggees/debuginfod/src/debuginfod_test.cpp | New debuggee that steps into stdlib code to trigger debuginfod lookups. |
| src/MIDebugPackage/OpenFolderSchema.json | Adds debuginfod to the JSON launch schema with minimum: 0 for timeout. |
| src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs | Makes set debuginfod enabled on conditional on EnableDebuginfod. |
| src/MICore/Transports/LocalTransport.cs | Applies debuginfod env vars (timeout/disable) when launching local GDB. |
| src/MICore/LaunchOptions.xsd.types.designer.cs | Adds XML attributes for EnableDebuginfod and DebuginfodTimeout to generated option types. |
| src/MICore/LaunchOptions.xsd | Adds XSD attributes + minInclusive=0 validation for DebuginfodTimeout. |
| src/MICore/LaunchOptions.cs | Adds runtime option properties and initializes them from JSON/XML launch options. |
| src/MICore/JsonLaunchOptions.cs | Adds debuginfod JSON model (DebuginfodSettings) to parsed launch options. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Files not reviewed (1)
- src/MICore/LaunchOptions.xsd.types.designer.cs: Language not supported
- Files reviewed: 10/11 changed files
- Comments generated: 2
chuckries
approved these changes
May 19, 2026
| }, | ||
| "debuginfod": { | ||
| "type": "object", | ||
| "description": "Controls GDB's debuginfod behavior for automatic downloading of debug symbols.", |
Member
There was a problem hiding this comment.
I think you are going to need to edit loc/lci/OpenFolderSchema.json.lci for these changes. Example: https://github.com/microsoft/MIEngine/pull/1517/changes
## Why is this change being made? Fixes microsoft/vscode-cpptools#14458 MIEngine commit f169b02 added `set debuginfod enabled on` unconditionally in GetInitializeCommands(). On systems where DEBUGINFOD_URLS points to an unreachable server (e.g. debuginfod.ubuntu.com which is currently down), subsequent GDB commands block for 90+ seconds waiting for the network request to time out, causing GDB to appear hung on launch. ## Summarize what changed - Added a `debuginfod` launch option (JSON: `{ enabled: bool, timeout: int }` XML: `EnableDebuginfod`/`DebuginfodTimeout` attributes) defaulting to enabled with a 30-second timeout. - When enabled (timeout > 0): sets DEBUGINFOD_TIMEOUT and DEBUGINFOD_MAXTIME environment variables on the GDB process to cap network requests. - When enabled (timeout = 0): no timeout override is applied; GDB/libdebuginfod defaults are used. - When disabled: clears DEBUGINFOD_URLS on the GDB process so debuginfod connections are never attempted, even if the system has the env var set. - `set debuginfod enabled on` is now conditional on the EnableDebuginfod setting. - Added XSD schema validation (minInclusive=0) and JSON schema (minimum: 0). - Negative timeout values are clamped to the default (30) at runtime. ## How was the change tested? - [x] Changes reviewed by Copilot CLI (using /review) - [x] All 36 MICoreUnitTests pass - [x] Integration tests (DebuginfodTests) pass in WSL with GDB 12.1: - DebuginfodDisabledDoesNotHang: steps into std::regex with unreachable server, verifies launch completes in < 10s - DebuginfodTimeoutPreventsHang: steps into std::regex with 5s timeout, verifies launch completes in < 30s - [x] All existing CppTests pass (Sample, Execution, Breakpoint, Environment) - [x] Verified via TCP listener that debuginfod URLs are actually queried during step-into-library operations Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c048f2e to
99c3239
Compare
| PipeLaunchOptions pipeOptions = new PipeLaunchOptions( | ||
| pipePath: pipeProgram, | ||
| pipeArguments: EnsurePipeArguments(pipeArgs, debuggerPath, gdbPathDefault, quoteArgs), | ||
| pipeArguments: EnsurePipeArguments(pipeArgs, debuggerPath, gdbPathDefault, quoteArgs, debuginfodPrefix), |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this change being made?
Fixes microsoft/vscode-cpptools#14458
MIEngine commit f169b02 added
set debuginfod enabled onunconditionally in GetInitializeCommands(). On systems where DEBUGINFOD_URLS points to an unreachable server (e.g. debuginfod.ubuntu.com which is currently down), subsequent GDB commands block for 90+ seconds waiting for the network request to time out, causing GDB to appear hung on launch.Summarize what changed
debuginfodlaunch option (JSON:{ enabled: bool, timeout: int }XML:EnableDebuginfod/DebuginfodTimeoutattributes) defaulting to enabled with a 30-second timeout.set debuginfod enabled onis now conditional on the EnableDebuginfod setting.How was the change tested?