ETC

VSCode GDB 라이브러리, 헤더 연결 방법

Makefile로 라이브러리가 생성되는 프로젝트를 

VScode로 열어서 테스트 프로그램을 작성한다.

 

해당 라이브러리 및 헤더 파일을 컴파일 및 디버깅 시에 요구하기 때문에 아래 2개 파일에 관련 내용을 적는다.

그리고 F5를 누르면 정상적으로 동작한다. 

 

task.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc 활성 파일 빌드",
            "command": "/usr/bin/gcc",
            "args": [
                "-fdiagnostics-color=always",                
                "-g",
                "${file}",                
                "-o",
                "${workspaceFolder}/build/bin/${fileBasenameNoExtension}.debug",
                "-L${workspaceFolder}/build/lib/",
                "-lconcurrent",
                "-lpthread",
                "-lm",
                "-lnuma",
                "-latomic",
                "-I${workspaceFolder}/libconcurrent/includes",
                "-I${workspaceFolder}/libconcurrent"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "디버깅을 위한 SIM 벤치마크 빌드"
        }        
    ],
    "version": "2.0.0"
}

 

launch.json

{
    // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
    // 기존 특성에 대한 설명을 보려면 가리킵니다.
    // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gcc - 활성 파일 빌드 및 디버그",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/bin/${fileBasenameNoExtension}.debug",
            "args": [                
            ],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",            
            "environment": [
                {
                    "name": "LD_LIBRARY_PATH",
                    "value": "${workspaceFolder}/build/lib/"
                }
            ],
            "externalConsole": false,
            "MIMode": "gdb",            
            "setupCommands": [
                {
                    "description": "gdb에 자동 서식 지정 사용",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "디스어셈블리 버전을 Intel(으)로 설정",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: gcc 활성 파일 빌드",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

'ETC' 카테고리의 다른 글

VSCODE EXTENTION  (0) 2022.02.21
VSCode에서 pthread.h 인식 안될 때 해결 방법  (0) 2022.01.25
VSCode 테마 추천 "TextPad"  (0) 2021.10.13
Windows 11 Insider Preview 설치 후기  (0) 2021.07.06
Latest MESA install on Ubuntu  (0) 2021.07.04