MACOS上的MACOSX M1 ARM64 Visual Studio代码无法启动带有C++应用程序的调试器



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

错误:无法启动调试。来自命令"的意外LLDB输出-exec运行";。进程已退出,状态为-1(附加失败((os/kern(参数无效((程序"/Users/torsi/vsc workspace/Helloworld"已退出,代码为42(0x0000002a(

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

我认为这是一个与这两项必需权利有关的权利问题我验证的未设置用于VSC应用程序。我使用代码签名通过引用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.2nApple 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: hostn    Triple: x86_64-apple-macosxnOS 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_T8101n  Hostname: 127.0.0.1nWorkingDir: /Users/torsi/vsc-workspacen"
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).

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

谢谢,Tom

Visual Studio Code目前不支持在Apple M1 CPU上进行本机LLDB调试。

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

最新更新