microsoft / microsoft/vscode-cpptools

[vscode-gdb-debug] gdb stuck at launch - any command gives "Unable to perform this action because the process is running"

Open
#13,667 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment
  • OS and version: Alma Linux 8
  • VS Code: 1.99.3
  • C/C++ extension: 1.25.3
  • C/C++ extension pack: 1.3.1
  • GDB version: 14.2
Bug Summary and Steps to Reproduce

Bug Summary:

I'm using VS Code for C++ for around 6 months. But so far, I have not tried gdb from vs code. Ealier in emacs, I used to debug using gud-gdb interface. So, I tried defining a launch.json for my application. However, I have not been able to successfully setup gdb with vs code.

We have a large C++ code base. I just want gdb to get launched and load the binary (not start the run). This is because, I have a gdb python script that I use to setup PATH and LD_LIBRARY_PATH depending upon MYPROG_HOME env variables and I want to use that. Also I need to set args (differently with different switches depending upon my test case) before running the program.

I have tried following launch.json -

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "GDB Debug Manual Mode",
            "type": "cppdbg",
            "request": "launch",
            // "program": "${BUILD_PATH}/bin-linux64/myprog-G",
            "program": <full-path to myprog-G>,
            "cwd": "<test dir where I want to debug>",
            "MIMode": "gdb",
            "miDebuggerPath": "<path to gdb>",
            "stopAtEntry": true,
            "stopAtConnect": true,
            "launchCompleteCommand": "None",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
            ]
        }

    ]
}

But when I invoke gdb from the Run and Debug option, gdb prompt comes up. But when I try any gdb commands (like show env MYPROG_HOME), it gives me below error message: -

Unable to perform this action because the process is running.

Please let me know what I may be missing because of which it is not working. Let me know if I can any additional diagnostics to understand why it is stuck.

Debugger Configurations
Please refer the bug summary section above.
Debugger Logs
I tried enabling logging and when the gdb prompt comes, if I type "show env PATH", I get following o/p -


show env PATH
<--   C (evaluate-25): {"command":"evaluate","arguments":{"expression":"show env PATH","context":"repl"},"type":"request","seq":25}
--> R (evaluate-25): {"type":"response","request_seq":25,"success":false,"command":"evaluate","message":"Failed to handle EvaluateRequest","body":{"error":{"id":1105,"format":"Unable to perform this action because the process is running."}},"seq":215}
Unable to perform this action because the process is running.
Other Extensions

No response

Additional Information

No response

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 supplied launch.json configuration and the VS Code Run and Debug cppdbg entry point, then inspect the GDB MI log for the evaluate request that reports the process as running. Done means determining whether the behavior is caused by the configuration or the extension and documenting a reproducible setup with the additional diagnostics needed for a fix.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.