Skip to content

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

Open
@soumen-ghosh

Description

@soumen-ghosh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdebuggerhelp wantedCan be fixed in the public (open source) repo.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions