microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

Unable to debug C++ code in Mac M1 Max #11397

Open HacksPloiter opened 1 year ago

HacksPloiter commented 1 year ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: The program is not able to handle inputs while debugging. I am getting "Unable to perform this action because the process is running." I had raised a ticket to VS code. They did some analysis and told me to raise issue here. Kindly help.

Steps to reproduce:

  1. Write a simple C++ program.
  2. Click on debugger.
  3. Provide input in the debug console.
  4. Show an error in red "Unable to perform this action because the process is running."

Expected behavior: It should be able to take input and let me debug.

Configuration and Logs

c_cpp_properties.json:
{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64"
        }
    ],
    "version": 4
}

launch.json:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "enter program name, for example ${workspaceFolder}/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb"
        }
    ]
}

tasks.json:
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Other Extensions

No response

Additional context

No response

toysoldiers000 commented 1 year ago

do you mean u can't input data using vscode? if so, u can refer this page:

https://github.com/microsoft/vscode-cpptools/issues/5079#issuecomment-920334065

by install codelldb Extension then change "type:cppdbg" into "type:lldb" in launch.json.