[Error] VSCode C++ 디버깅 에러

박종범·2022년 1월 17일
0

에러메시지

Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed ((os/kern) invalid argument))
The program '/Users/parkjb/projects/cpp-project/main' has exited with code 42 (0x0000002a).

해결방법

CodeLLDB 익스텐션 설치

익스텐션 정보

Name: CodeLLDB
Id: vadimcn.vscode-lldb
Description: A native debugger powered by LLDB. Debug C++, Rust and other compiled languages.
Version: 1.6.10
Publisher: Vadim Chugunov
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb

CMake 사용안할 경우 - Launch.json 수정

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "clang++ - 활성 파일 빌드 및 디버그",
      "type": "cppdbg", // 이놈을 "lldb"로 바꿔줌
      "request": "launch",
      "program": "${fileDirname}/${fileBasenameNoExtension}",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "lldb",
      "preLaunchTask": "C/C++: clang++ 활성 파일 빌드"
    }
  ]
}

"type": "cppdbg" 에서 "type": "lldb"로 바꿔줌


TouchID로 인증하면 실행됨다


매번 TouchID로 인증하기 귀찮으면 아무 터미널에서 DevToolsSecurity -enable 해주자


입력 받아야되면 "externalConsole": true 해주자
VSC 안에 있는 콘솔에서 입력 받을수 있음

CMake 사용할 경우 - settings.json 수정

settings.json에 다음내용 추가해준다

"cmake.debugConfig": {
  "type": "lldb"
}

CMake 사용할 경우 Command Palette에서 CMake: Debug 또는 CMake: Run Without Debugging 사용할 것

0개의 댓글