Channi Studies

[C++] vscode 디버깅 세팅 기록 본문

C++/기타

[C++] vscode 디버깅 세팅 기록

Chan Lee 2023. 12. 23. 17:44

2023.12.23 기준

M2 MAC

 

디버깅 관련 파일들 기록

codelldb extension 사용 중

 

//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": [                
        {                   
            "type": "lldb",
            "request": "launch", 
            "name": "Debug",  
            "program": "${fileDirname}/${fileBasenameNoExtension}", 
            "args": [],                        
            "cwd": "${fileDirname}"               
         }    
    ]
}
// tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ 활성 파일 빌드",
            "command": "/usr/bin/clang++",
            "args": [
                "-std=c++20",
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-gdwarf-2",
                "${fileDirname}/**.cpp",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "컴파일러: /usr/bin/clang++"
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++ 활성 파일 빌드",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-gdwarf-2",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "디버거에서 생성된 작업입니다."
        },
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ 활성 파일 빌드",
            "command": "/usr/bin/clang++",
            "args": [
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "컴파일러: /usr/bin/clang++"
        }
    ]
}