【问题标题】:MACOSX M1 ARM64 Visual Studio Code on MACOS Fails to start debugger w/ C++ applicationMACOS 上的 MACOS M1 ARM64 Visual Studio 代码无法启动带有 C++ 应用程序的调试器
【发布时间】:2021-04-25 03:57:09
【问题描述】:

我在 VSC 的控制台窗口中看到以下错误。

错误:无法开始调试。命令“-exec-run”的意外 LLDB 输出。进程以状态 -1 退出(附加失败((os/kern)无效参数)) 程序“/Users/torsi/vsc-workspace/Helloworld”已退出,代码为 42 (0x0000002a)。

但如果我从命令行运行 lldb,则应用程序是完全可调试的。

我认为这是与这两个必需的权利有关的权利问题 我验证的不是为 VSC 应用程序设置的。我使用 codesign 通过引用 VSC 的 .app 目录来验证应用程序的权利。

<key>com.apple.security.network.client</key>

<key>get-task-allow</key>

这是 lldb 的日志输出:

1: (245) LaunchOptions{"name":"clang++ - Build and debug active file","type":"cppdbg","request":"launch","targetArchitecture":"arm64","program":"/Users/torsi/vsc-workspace/Helloworld","args":[],"stopAtEntry":true,"cwd":"/Users/torsi/vsc-workspace","environment":[],"externalConsole":false,"MIMode":"lldb","preLaunchTask":"clang++ build active file","logging":{"engineLogging":true},"__configurationTarget":5,"__sessionId":"7b7e7bcf-4626-413b-aec8-0b1bf19605b9","miDebuggerPath":"/Users/torsi/.vscode/extensions/ms-vscode.cpptools-1.3.1/debugAdapters/lldb-mi/bin/lldb-mi"}
1: (420) Starting: "/Users/torsi/.vscode/extensions/ms-vscode.cpptools-1.3.1/debugAdapters/lldb-mi/bin/lldb-mi" --interpreter=mi
1: (485) DebuggerPid=39408
1: (506) ->(gdb)
1: (549) <-1001-interpreter-exec console "version"
1: (551) ->~"lldb-1200.0.44.2\nApple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)\n"
1: (553) ->1001^done
1: (554) ->(gdb)
1: (564) 1001: elapsed time 17
1: (571) <-1002-gdb-set auto-solib-add on
1: (572) ->1002^done
1: (572) ->(gdb)
1: (578) 1002: elapsed time 7
1: (580) <-1003-gdb-set solib-search-path "/Users/torsi/vsc-workspace:"
1: (580) ->1003^done
1: (580) ->(gdb)
1: (580) 1003: elapsed time 0
1: (581) <-1004-environment-cd /Users/torsi/vsc-workspace
1: (581) ->1004^done,path="/Users/torsi/vsc-workspace"
1: (581) ->(gdb)
1: (585) 1004: elapsed time 4
1: (585) <-1005-file-exec-and-symbols /Users/torsi/vsc-workspace/Helloworld
1: (811) ->1005^done
1: (811) ->(gdb)
1: (811) ->=library-loaded,id="/Users/torsi/vsc-workspace/Helloworld",target-name="/Users/torsi/vsc-workspace/Helloworld",host-name="/Users/torsi/vsc-workspace/Helloworld",symbols-loaded="1",symbols-path="/Users/torsi/vsc-workspace/Helloworld.dSYM/Contents/Resources/DWARF/Helloworld",loaded_addr="-",size="16384"
1: (811) 1005: elapsed time 226
1: (812) <-1006-interpreter-exec console "platform status"
1: (812) ->~"  Platform: host\n    Triple: x86_64-apple-macosx\nOS Version: 10.16 (20D80)\n    Kernel: Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101\n  Hostname: 127.0.0.1\nWorkingDir: /Users/torsi/vsc-workspace\n"
1: (812) ->1006^done
1: (813) ->(gdb)
1: (818) 1006: elapsed time 6
1: (821) <-1007-break-insert -f main
1: (823) ->1007^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100003f60",func="main",file="Helloworld.cpp",fullname="/Users/torsi/vsc-workspace/Helloworld.cpp",line="8",pending=["main"],times="0",original-location="main"}
1: (823) ->(gdb)
1: (823) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100003f60",func="main",file="Helloworld.cpp",fullname="/Users/torsi/vsc-workspace/Helloworld.cpp",line="8",pending=["main"],times="0",original-location="main"}
1: (823) ->(gdb)
1: (828) 1007: elapsed time 7
1: (847) Send Event AD7EngineCreateEvent
1: (852) Send Event AD7ProgramCreateEvent
1: (895) Send Event AD7LoadCompleteEvent
1: (902) <-1008-exec-run
1: (5954) ->1008^error,msg="process exited with status -1 (attach failed ((os/kern) invalid argument))"
1: (5955) ->(gdb)
1: (5959) 1008: elapsed time 5056
1: (6005) Send Event AD7MessageEvent
ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed ((os/kern) invalid argument))
1: (6018) <--gdb-exit
1: (6019) ->^exit
1: (6019) ->=thread-group-exited,id="i1"
1: (6019) ->(gdb)
1: (6022) <-logout
1: (6043) Send Event AD7ProgramDestroyEvent
The program '/Users/torsi/vsc-workspace/Helloworld' has exited with code 42 (0x0000002a).

如何设置权利?如果这是问题所在?

谢谢, 汤姆

【问题讨论】:

  • Tapping Mic ,这东西开了吗?

标签: macos visual-studio-code apple-m1


【解决方案1】:

截至今天,Visual Studio Code 不支持在 Apple M1 CPU 上进行原生 LLDB 调试。

来源:https://github.com/microsoft/vscode-cpptools/issues/7035

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-03
    • 2017-05-17
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 2021-03-02
    • 2023-01-30
    相关资源
    最近更新 更多