microsoft / microsoft/vscode-cpptools

Attach GDB to process freezes

Open
#7,163 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am trying to setup my launch.json in order to be able to debug my executable from another process. In this regard, I've defined the following configuration:

{ 
            "name": "(gdb) Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "D:\\c-tmp\\count.exe",
            "processId": "${command:pickProcess}",
            "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true,
                    "set follow-fork-mode":"child"
                }
            ]
        }

If I launch this config, I'm able to connect with the desired process, but whenever I am trying to launch the program, the debugged process will freeze until I stop the debugger.

I addition I cannot find my debug breakpoint activated on vscode side, though it is connected:

grafik

Can someone help me tweak my config properly?

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

Start with the launch.json configuration using the cppdbg attach request, processId picker, and GDB path, then reproduce the freeze when launching the attached program. Investigate why the process remains stopped and why breakpoints do not activate; done means attaching no longer freezes execution and the configured breakpoint becomes active.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.