microsoft / microsoft/vscode-cpptools

During debug, Ctrl + C on application throws "close failed in file object destructor: sys.excepthook is missing lost sys.stderr"

Open
#6,379 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Type: Debugger

  • OS and Version: RHEL8
  • VS Code Version: 1.50.1
  • C/C++ Extension Version: 1.0.1

In my cppdbg debug session, the application starts in terminal with the debug console opened. The launch.json looks like this :

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Debugger",
            "type": "cppdbg",
            "request": "launch",
            "program": "/path/to/application/app_file",
            "args": [
                "-W",
                "101",
                "-N"
            ],
            "stopAtEntry": false,
            "cwd": "/path/to/application",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "linux": {
                "miDebuggerPath": "/bin/gdb"
            },
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Handle SIGALRM",
                    "text": "handle SIGALRM pass nostop noprint",
                    "ignoreFailures": true
                },
                {
                    "description": "Handle SIGUSR1",
                    "text": "handle SIGUSR1 pass nostop noprint",
                    "ignoreFailures": true
                },
            ]
        }
    ]
}

In the application, if i hit 'Ctrl + C', i expect it to drop into the gdb prompt. It is what happens when i debug the application outside of VSCODE.

STEPS outside off VSCODE -

gdb <app_file>
run
Ctrl + C here and the prompt drops to GDB

But when i "Ctrl + C" the application in in my vscode debug session, the session aborts.
I see this message on the terminal:

bash-4.4$ close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

And this on the debug console:

ERROR: GDB exited unexpectedly. Debugging will now abort.

How do i get the vscode to drop to gdb on "Ctrl + C"? What am i missing ?

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 failure using the reported launch.json configuration, the cppdbg debugger, and GDB, then compare Ctrl+C behavior with the command-line session. Done means Ctrl+C interrupts the application without aborting the VS Code debug session or producing the reported terminal and debug-console errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.