MACOSX M1 ARM64 Visual Studio Code on MACOS Fails to start debugger w/ C++ application

0

I am seeing the following error from the console window on VSC.

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/torsi/vsc-workspace/Helloworld' has exited with code 42 (0x0000002a).

But if I run lldb from the command-line the application is fully debuggable.

I believe this is an entitlement issue having to do with these two required entitlements that I verified are not set for the VSC applications. I used codesign to verify the entitlements for the application by reference the .app directory of VSC.

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

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

Here is the logging output from 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).

How do I set the entitlements? if this is the problem?

Thanks, Tom

macos
visual-studio-code
apple-m1
asked on Stack Overflow Apr 25, 2021 by Tom Orsi • edited Apr 25, 2021 by Tom Orsi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0