Open sourav-dey opened 4 years ago
Can you run DevToolsSecurity -status
in your terminal, and what does it output?
> DevToolsSecurity -status
> Developer mode is currently disabled.
Thank you!
Can you enable DevToolsSecurity? You can do that by running DevToolsSecurity -enable
. There will be an elevated prompt.
Do you still encounter the issue when you start debugging after that?
> sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer DevToolsSecurity -enable
> Password:
> Developer mode is now enabled.
> DevToolsSecurity -status
> Developer mode is currently enabled.
Yes, I am still having the same issue.
@sourav-dey Thanks for all the info. I will need to grab a new machine and see if I can reproduce this issue.
What version of XCode are you using?
Cool, sure. I am using XCode Version 11.3.1 (11C504)
From @lmapii
any news on this one? can't debug anymore :( Unable to start debugging. Unexpected LLDB output from command "-exec-run". Command 'exec-run'. Invalid process during debug session Developer mode is already enabled.
@WardenGnaw no, this was on mac os catalina 10.15.4. i'm with @Ulchie on this one - this seems to be a timing issue. i know how ridiculous this sounds but the problem disappeared at some point (i haven't changed anything in the installation). meaning the famous sentence "i didn't do anything" seems to apply :/
From @peza8
Exact same issue as @lmapii
@WardenGnaw Experiencing issue on Catalina 10.15.2. Sadly haven't had the same luck as Imapii. Happy to do any tests you need @WardenGnaw .
@peza8 Could you provide some additional info for me?
What version of VS Code are you using? Version of the C/C++ extension? Version of XCode you have installed? Also can you share the logs from the debug console when you add following to your launch.json?
"logging": {
"engineLogging": true
}
Hey @WardenGnaw , here's the info:
1. VSCode version: Version: 1.44.2 Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd Date: 2020-04-16T17:07:18.473Z (2 wks ago) Electron: 7.1.11 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 19.2.0
2. Version of the C/C++ extension: 0.27.1
3. Xcode version: 11.3.1
4. Logs are attached: VSCode terminal non-launch issue debug logs.txt
Other [potentially] useful info:
lldb
command in a terminal also works perfectly.@peza8 Your issue is that you are using miDebuggerArgs
and it is treating the first argument as your executable.
(866) ->-file-exec-and-symbols "set" 1: (879) ->^error,msg="Command 'file-exec-and-symbols'. Target binary 'set' is invalid. error: unable to find executable for 'set'"
You will want to use setupCommands
for set startup-with-shell enable
@WardenGnaw - This does cause an external terminal window to open, but the application still doesn't run. Updated logs attached. VSCode terminal non-start issue debug logs.txt
@peza8 I think can repro this.
The issue seems to be when we have "externalConsole": true
it seems to hang and do nothing.
Can you hit a breakpoint in your main function if you set "externalConsole": false
?
Yes, that what I tried to indicate in my second bullet of the section Other [potentially] useful info: in this message above.
With "externalConsole": false
the debugger works perfectly => Can indeed hit breakpoint in main.
Do you also have the update where your default shell is now zsh?
The VScode update? or Catalina? Which default setting are you referring to? @WardenGnaw ?
Issue title change 👍 +1
The macOS Catalina update where it defaults the Terminal App to zsh.
I am investigating what is causing -exec-run
to hang and trying to find the differences. I have a machine running macOS Catalina and XCode using the latest C/C++ extension that does not have the update where the default shell is zsh and works with externalConsole: true
.
When LLDB launches the external console, it uses an apple script that calls into bash.
https://github.com/llvm/llvm-project/blob/f203100ebe22bf97a4268a562cdbef22d14db915/lldb/source/Host/macosx/objcxx/Host.mm#L154. But lldb-mi
does not hang on -exec-run
if commands are given directly via a terminal.
The issue is when VSCode launches the debug adapter, then the debug adapter launches lldb-mi
, then lldb-mi
launches Terminal
. There is a prompt that should appear, but somehow the DebugAdapter is not forwarding this permissions request.
The work around is to have VS Code launch the terminal once. You can do this by adding and running this tasks in your tasks.json
:
{
"label": "Open Terminal",
"type": "shell",
"command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'",
"problemMatcher": []
}
You can run this specific task using Command + Shift + p
. Type Tasks
and look for Tasks: Run Tasks
then select Open Terminal
.
Once you allow this permission, then the external console should appear when you debug.
@WardenGnaw There is a typo in your task, there is an extra a
before \nendtask
that breaks osascript. Workaround worked for me, thanks.
Workaround works! Well done and thank you @WardenGnaw !
so useful, thanks
I'm running into what appears to be the same issue, but the workaround suggested by @WardenGnaw doesn't work for me.
I ran the "Open Terminal" task as suggested, and I got the prompt as expected:
However, when I start the debugging session, I just get two empty terminal windows and the debugger doesn't stop at the breakpoint:
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": "gcc - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"preLaunchTask": "C/C++: gcc build active file",
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
}
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Here's the output from the debug console:
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (163) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'\n"},"seq":2}
1: (163) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions ExePath='/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1'\n"},"seq":4}
1: (187) LaunchOptions ExePath='/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions WorkingDirectory='/Users/chris/Projects/k_and_r'\n"},"seq":6}
1: (187) LaunchOptions WorkingDirectory='/Users/chris/Projects/k_and_r'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions ExeArguments=''\n"},"seq":8}
1: (187) LaunchOptions ExeArguments=''
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions MIMode='lldb'\n"},"seq":10}
1: (187) LaunchOptions MIMode='lldb'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions MIDebuggerPath='/Users/chris/.vscode/extensions/ms-vscode.cpptools-0.29.0-insiders/debugAdapters/lldb-mi/bin/lldb-mi'\n"},"seq":12}
1: (188) LaunchOptions MIDebuggerPath='/Users/chris/.vscode/extensions/ms-vscode.cpptools-0.29.0-insiders/debugAdapters/lldb-mi/bin/lldb-mi'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions WaitDynamicLibLoad='false'\n"},"seq":14}
1: (188) LaunchOptions WaitDynamicLibLoad='false'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions ExternalConsole='true'\n"},"seq":16}
1: (188) LaunchOptions ExternalConsole='true'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions>\n"},"seq":18}
1: (188) LaunchOptions>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions</LocalLaunchOptions>\n"},"seq":20}
1: (188) LaunchOptions</LocalLaunchOptions>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (283) Starting: \"/Users/chris/.vscode/extensions/ms-vscode.cpptools-0.29.0-insiders/debugAdapters/lldb-mi/bin/lldb-mi\" --interpreter=mi\n"},"seq":22}
1: (283) Starting: "/Users/chris/.vscode/extensions/ms-vscode.cpptools-0.29.0-insiders/debugAdapters/lldb-mi/bin/lldb-mi" --interpreter=mi
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (303) DebuggerPid=11970\n"},"seq":24}
1: (303) DebuggerPid=11970
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (316) ->(gdb)\n"},"seq":26}
1: (316) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (330) <-1001-interpreter-exec console \"version\"\n"},"seq":28}
1: (330) <-1001-interpreter-exec console "version"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (331) ->~\"lldb-1103.0.22.10\\nApple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)\\n\"\n"},"seq":30}
1: (331) ->~"lldb-1103.0.22.10\nApple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (332) ->1001^done\n"},"seq":32}
1: (332) ->1001^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (332) ->(gdb)\n"},"seq":34}
1: (332) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (335) 1001: elapsed time 5\n"},"seq":36}
1: (335) 1001: elapsed time 5
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (337) <-1002-gdb-set auto-solib-add on\n"},"seq":38}
1: (337) <-1002-gdb-set auto-solib-add on
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (338) ->1002^done\n"},"seq":40}
1: (338) ->1002^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (338) ->(gdb)\n"},"seq":42}
1: (338) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (338) 1002: elapsed time 0\n"},"seq":44}
1: (338) 1002: elapsed time 0
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (339) <-1003-gdb-set solib-search-path \"/Users/chris/Projects/k_and_r/exercises/exercise_1-1:\"\n"},"seq":46}
1: (339) <-1003-gdb-set solib-search-path "/Users/chris/Projects/k_and_r/exercises/exercise_1-1:"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (339) ->1003^done\n"},"seq":48}
1: (339) ->1003^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (339) ->(gdb)\n"},"seq":50}
1: (339) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (339) 1003: elapsed time 0\n"},"seq":52}
1: (339) 1003: elapsed time 0
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (339) <-1004-environment-cd /Users/chris/Projects/k_and_r\n"},"seq":54}
1: (339) <-1004-environment-cd /Users/chris/Projects/k_and_r
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (340) ->1004^done,path=\"/Users/chris/Projects/k_and_r\"\n"},"seq":56}
1: (340) ->1004^done,path="/Users/chris/Projects/k_and_r"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (340) ->(gdb)\n"},"seq":58}
1: (340) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (342) 1004: elapsed time 2\n"},"seq":60}
1: (342) 1004: elapsed time 2
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (342) <-1005-gdb-set new-console on\n"},"seq":62}
1: (342) <-1005-gdb-set new-console on
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (342) ->1005^done\n"},"seq":64}
1: (342) ->1005^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (342) ->(gdb)\n"},"seq":66}
1: (342) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (342) 1005: elapsed time 0\n"},"seq":68}
1: (342) 1005: elapsed time 0
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (342) <-1006-file-exec-and-symbols /Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1\n"},"seq":70}
1: (342) <-1006-file-exec-and-symbols /Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (622) ->1006^done\n"},"seq":72}
1: (622) ->1006^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (622) 1006: elapsed time 279\n"},"seq":74}
1: (622) 1006: elapsed time 279
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (622) ->(gdb)\n"},"seq":76}
1: (622) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (622) <-1007-interpreter-exec console \"platform status\"\n"},"seq":78}
1: (622) <-1007-interpreter-exec console "platform status"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (622) ->=library-loaded,id=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1\",target-name=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1\",host-name=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1\",symbols-loaded=\"1\",symbols-path=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.dSYM/Contents/Resources/DWARF/exercise_1-1\",loaded_addr=\"-\",size=\"4096\"\n"},"seq":80}
1: (622) ->=library-loaded,id="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1",target-name="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1",host-name="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1",symbols-loaded="1",symbols-path="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.dSYM/Contents/Resources/DWARF/exercise_1-1",loaded_addr="-",size="4096"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (623) ->~\" Platform: host\\n Triple: x86_64h-apple-macosx\\nOS Version: 10.15.5 (19F101)\\n Kernel: Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64\\n Hostname: 127.0.0.1\\nWorkingDir: /Users/chris/Projects/k_and_r\\n\"\n"},"seq":82}
1: (623) ->~" Platform: host\n Triple: x86_64h-apple-macosx\nOS Version: 10.15.5 (19F101)\n Kernel: Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64\n Hostname: 127.0.0.1\nWorkingDir: /Users/chris/Projects/k_and_r\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (623) ->1007^done\n"},"seq":84}
1: (623) ->1007^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (624) ->(gdb)\n"},"seq":86}
1: (624) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (625) 1007: elapsed time 2\n"},"seq":88}
1: (625) 1007: elapsed time 2
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (626) <-1008-break-insert -f main\n"},"seq":90}
1: (626) <-1008-break-insert -f main
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (627) ->1008^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000100000f48\",func=\"main\",file=\"exercise_1-1.c\",fullname=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c\",line=\"5\",pending=[\"main\"],times=\"0\",original-location=\"main\"}\n"},"seq":92}
1: (627) ->1008^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000f48",func="main",file="exercise_1-1.c",fullname="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c",line="5",pending=["main"],times="0",original-location="main"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (627) ->(gdb)\n"},"seq":94}
1: (627) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (627) ->=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000100000f48\",func=\"main\",file=\"exercise_1-1.c\",fullname=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c\",line=\"5\",pending=[\"main\"],times=\"0\",original-location=\"main\"}\n"},"seq":96}
1: (627) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000f48",func="main",file="exercise_1-1.c",fullname="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c",line="5",pending=["main"],times="0",original-location="main"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (627) ->(gdb)\n"},"seq":98}
1: (627) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (629) 1008: elapsed time 2\n"},"seq":100}
1: (629) 1008: elapsed time 2
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (636) Send Event AD7EngineCreateEvent\n"},"seq":102}
1: (636) Send Event AD7EngineCreateEvent
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (638) Send Event AD7ProgramCreateEvent\n"},"seq":104}
1: (638) Send Event AD7ProgramCreateEvent
--> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Launch","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"16.5.10612.1","VS.Diagnostics.Debugger.HostVersion":"16.5.10612.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Launch.Duration":524,"VS.Diagnostics.Debugger.Launch.IsCoreDump":false,"VS.Diagnostics.Debugger.VisualizerFileUsed":false,"VS.Diagnostics.Debugger.SourceFileMappings":0,"VS.Diagnostics.Debugger.MIMode":"lldb"}},"seq":106}
--> R (launch-2): {"type":"response","request_seq":2,"success":true,"command":"launch","body":{},"seq":108}
--> E (initialized): {"type":"event","event":"initialized","body":{},"seq":110}
<-- C (setBreakpoints-3): {"command":"setBreakpoints","arguments":{"source":{"name":"exercise_1-1.c","path":"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c"},"lines":[6],"breakpoints":[{"line":6}],"sourceModified":false},"type":"request","seq":3}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (678) <-1009-break-insert -f exercise_1-1.c:6\n"},"seq":113}
1: (678) <-1009-break-insert -f exercise_1-1.c:6
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (679) ->1009^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000100000f56\",func=\"main\",file=\"exercise_1-1.c\",fullname=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c\",line=\"6\",pending=[\"exercise_1-1.c:6\"],times=\"0\",original-location=\"exercise_1-1.c:6\"}\n"},"seq":115}
1: (679) ->1009^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000f56",func="main",file="exercise_1-1.c",fullname="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c",line="6",pending=["exercise_1-1.c:6"],times="0",original-location="exercise_1-1.c:6"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (679) ->(gdb)\n"},"seq":117}
1: (679) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (679) 1009: elapsed time 1\n"},"seq":119}
1: (679) 1009: elapsed time 1
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (679) ->=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000100000f56\",func=\"main\",file=\"exercise_1-1.c\",fullname=\"/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c\",line=\"6\",pending=[\"exercise_1-1.c:6\"],times=\"0\",original-location=\"exercise_1-1.c:6\"}\n"},"seq":121}
1: (679) ->=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000f56",func="main",file="exercise_1-1.c",fullname="/Users/chris/Projects/k_and_r/exercises/exercise_1-1/exercise_1-1.c",line="6",pending=["exercise_1-1.c:6"],times="0",original-location="exercise_1-1.c:6"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (679) ->(gdb)\n"},"seq":123}
1: (679) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (687) Send Event AD7BreakpointBoundEvent\n"},"seq":125}
1: (687) Send Event AD7BreakpointBoundEvent
--> R (setBreakpoints-3): {"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"verified":true,"line":6}]},"seq":127}
--> E (breakpoint): {"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":1,"verified":true,"line":6}},"seq":129}
<-- C (setFunctionBreakpoints-4): {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4}
--> R (setFunctionBreakpoints-4): {"type":"response","request_seq":4,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]},"seq":132}
<-- C (configurationDone-5): {"command":"configurationDone","type":"request","seq":5}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (730) Send Event AD7LoadCompleteEvent\n"},"seq":136}
1: (730) Send Event AD7LoadCompleteEvent
--> R (configurationDone-5): {"type":"response","request_seq":5,"success":true,"command":"configurationDone","body":{},"seq":135}
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"Warning: Debuggee TargetArchitecture not detected, assuming x86_64.\n"},"seq":139}
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (733) <-1010-exec-run\n"},"seq":141}
1: (733) <-1010-exec-run
<-- C (threads-6): {"command":"threads","type":"request","seq":6}
--> R (threads-6): {"type":"response","request_seq":6,"success":true,"command":"threads","body":{"threads":[]},"seq":144}
The issue is when VSCode launches the debug adapter, then the debug adapter launches
lldb-mi
, thenlldb-mi
launchesTerminal
. There is a prompt that should appear, but somehow the DebugAdapter is not forwarding this permissions request.The work around is to have VS Code launch the terminal once. You can do this by adding and running this tasks in your
tasks.json
:{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
You can run this specific task using
Command + Shift + p
. TypeTasks
and look forTasks: Run Tasks
then selectOpen Terminal
.Once you allow this permission, then the external console should appear when you debug.
This one just solved my problem 😁
Tried the proposed solution. I am not being prompted to allow terminal, instead the terminal opens up with just hello. No luck on my end. Any ideas?
Tried the proposed solution. I am not being prompted to allow terminal, instead the terminal opens up with just hello. No luck on my end. Any ideas?
change "externalConsole": false, to "externalConsole": true, in launch.json
this works for me with @KingOfDuck solution
The issue is when VSCode launches the debug adapter, then the debug adapter launches
lldb-mi
, thenlldb-mi
launchesTerminal
. There is a prompt that should appear, but somehow the DebugAdapter is not forwarding this permissions request.The work around is to have VS Code launch the terminal once. You can do this by adding and running this tasks in your
tasks.json
:{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
You can run this specific task using
Command + Shift + p
. TypeTasks
and look forTasks: Run Tasks
then selectOpen Terminal
.Once you allow this permission, then the external console should appear when you debug.
This workaround doesn't work on macOS Big Sur , running on the new M1 arm chip.
The issue is when VSCode launches the debug adapter, then the debug adapter launches
lldb-mi
, thenlldb-mi
launchesTerminal
. There is a prompt that should appear, but somehow the DebugAdapter is not forwarding this permissions request.The work around is to have VS Code launch the terminal once. You can do this by adding and running this tasks in your
tasks.json
:{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
You can run this specific task using
Command + Shift + p
. TypeTasks
and look forTasks: Run Tasks
then selectOpen Terminal
.Once you allow this permission, then the external console should appear when you debug.
Not working the workaround for me. Any update with this issue?
thank you, this solved it for me!
The issue is when VSCode launches the debug adapter, then the debug adapter launches
lldb-mi
, thenlldb-mi
launchesTerminal
. There is a prompt that should appear, but somehow the DebugAdapter is not forwarding this permissions request.The work around is to have VS Code launch the terminal once. You can do this by adding and running this tasks in your
tasks.json
:{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
You can run this specific task using
Command + Shift + p
. TypeTasks
and look forTasks: Run Tasks
then selectOpen Terminal
.Once you allow this permission, then the external console should appear when you debug.
THANK YOU SO MUCH! This solved it for me
For anyone still having this issue. After you follow the steps to make the terminal pop up. Make sure you have the configuration "externalConsole": true,
same issue with MacBook m1, console opens but nothing appears, only that: Launching: '/Users/carlos/Documents/vscode/test/test' Working directory: '/Users/carlos/Documents/vscode/test' 1 arguments: argv[0] = '/Users/carlos/Documents/vscode/test/test'
The same issue on m1.
Same issue here: it works on Intel Mac, it doesn't on M1. Seriously tho, the fact that one has to use an external console is annoying.
The issue is when VSCode launches the debug adapter, then the debug adapter launches
lldb-mi
, thenlldb-mi
launchesTerminal
. There is a prompt that should appear, but somehow the DebugAdapter is not forwarding this permissions request.The work around is to have VS Code launch the terminal once. You can do this by adding and running this tasks in your
tasks.json
:{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
You can run this specific task using
Command + Shift + p
. TypeTasks
and look forTasks: Run Tasks
then selectOpen Terminal
.Once you allow this permission, then the external console should appear when you debug.
after doing this terminal window appears but it gets stuck and shows this:
@ahmadrazakhawaja: that's a problem of white spaces - not of the M1 chip. Your working directory seems to contain many spaces ("1.3 Linux Socket in C"), and it's always a very bad idea to have spaces in your path. If not escaped properly they'll cause troubles when used as arguments in a command... and guess what happened ?
@TommyPec: Thanks, Sorry for disturbing for such a trivial issue. Yup you were right fixing the spaces solved the problem. Just to be clear I have the intel Mac.
与MacBook M1相同的问题,控制台打开但什么也没出现,仅是: 启动:'/ Users / carlos / Documents / vscode / test / test' 工作目录:'/ Users / carlos / Documents / vscode / test'1 参数: argv [0] ='/ Users / carlos / Documents / vscode / test / test'
Yes, This workaround doesn't work on macOS Big Sur, running on the new M1 arm chip.
I've had success using the following extension for debugging on M1 mac (both by Remote-SSHing into the mac and also locally on the Mac), if others are running into this problem give it a try:
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
Hello. The fix posted by @WardenGnaw (running a task that just opens the terminal) worked for me when I needed it one or two months ago. However, recently, the problem came back, perhaps due to a recent OSX update (I am on 11.5.2).
I get a terminal that opens up, but no output occurs. When I finish debugging, the external terminal shows the zsh prompt and runs normally. Otherwise, the internal debug console and the debugging process work as expected, as far as I know.
@jackcasey067
I get a terminal that opens up, but no output occurs. When I finish debugging, the external terminal shows the zsh prompt and runs normally. Otherwise, the internal debug console and the debugging process work as expected, as far as I know.
Your issue is similar to https://github.com/microsoft/vscode-cpptools/issues/8008. If you are using the version between v1.6.0-insiders to v1.6.0-insiders3, there is an issue where the external terminal script was failed to be published. It will be fixed in the next release.
Here is the workaround: https://github.com/microsoft/vscode-cpptools/issues/8008#issuecomment-902205591
Thanks for the quick update. I can confirm that downgrading to the default build (instead of insiders) worked for me.
I'm having similar problems to everyone else on macOS Big Sur 11.5.2 with an Intel processor. I asked about it on this thread and was directed here.
Basically I can run programs in the integrated terminal through the ./HelloWorld
command; but if I click on "start debugging" under the run tab I run into issues.
My launch.json file currently has "externalConsole": true,
and my tasks.json file has { "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
.
When I run the build task, I get this result:
And when I run the debugger (and step past the breakpoints), I get this result:
The new terminal labeled "Skyler -- cppdbg: Hello World" does nothing when I type into it.
Any other workarounds I can try? I'm currently downgraded to "default," so that's not the issue.
I have this issue when debugging inside a dev container, the host machine is MacOS BigSur, and the container image is Ubuntu 20.04. So the workaround can't work out. Any idea?
I'm having similar problems to everyone else on macOS Big Sur 11.5.2 with an Intel processor. I asked about it on this thread and was directed here.
Basically I can run programs in the integrated terminal through the
./HelloWorld
command; but if I click on "start debugging" under the run tab I run into issues.My launch.json file currently has
"externalConsole": true,
and my tasks.json file has{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
.When I run the build task, I get this result:
And when I run the debugger (and step past the breakpoints), I get this result:
The new terminal labeled "Skyler -- cppdbg: Hello World" does nothing when I type into it.
Any other workarounds I can try? I'm currently downgraded to "default," so that's not the issue.
@SkylerMime I am able to use debugger with this plugin (lldb-plugin).
In my launch.json I had to create launch config for this plugin. I have tested with both internal and external terminals.
{
"name": "LLDB Plugin Launch",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/demo",
"terminal": "external",
"args": ["-arg1", "-arg2"],
}
I'm having similar problems to everyone else on macOS Big Sur 11.5.2 with an Intel processor. I asked about it on this thread and was directed here. Basically I can run programs in the integrated terminal through the
./HelloWorld
command; but if I click on "start debugging" under the run tab I run into issues. My launch.json file currently has"externalConsole": true,
and my tasks.json file has{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
. When I run the build task, I get this result:And when I run the debugger (and step past the breakpoints), I get this result:
The new terminal labeled "Skyler -- cppdbg: Hello World" does nothing when I type into it. Any other workarounds I can try? I'm currently downgraded to "default," so that's not the issue.
@SkylerMime I am able to use debugger with this plugin (lldb-plugin).
In my launch.json I had to create launch config for this plugin. I have tested with both internal and external terminals.
{ "name": "LLDB Plugin Launch", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/demo", "terminal": "external", "args": ["-arg1", "-arg2"], }
This worked for me on MacOS Big Sur with below clang version.
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
@SkylerMime I am able to use debugger with this plugin (lldb-plugin).
In my launch.json I had to create launch config for this plugin. I have tested with both internal and external terminals.
{ "name": "LLDB Plugin Launch", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/demo", "terminal": "external", "args": ["-arg1", "-arg2"], }
I tried this plugin, but I'm getting the error "unable to find executable for '/Users/Skyler/CppPrograms/demo'"
@SkylerMime I am able to use debugger with this plugin (lldb-plugin). In my launch.json I had to create launch config for this plugin. I have tested with both internal and external terminals.
{ "name": "LLDB Plugin Launch", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/demo", "terminal": "external", "args": ["-arg1", "-arg2"], }
I tried this plugin, but I'm getting the error "unable to find executable for '/Users/Skyler/CppPrograms/demo'"
That is coming because you are using hard coded values for the key: program
. So, it is looking for the file demo in your current workspace folder.
Instead of that, I would suggest you to use the following (I'm personally using the following config for launch.json file and everything works perfectly smooth):
{
"version": "0.2.0",
"configurations":[
{
"name": "clang++ - Build and debug active file",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": ["-arg1", "-arg2"],
}
]
}
I hope that helps you. 🙌😎
I've had success using the following extension for debugging on M1 mac (both by Remote-SSHing into the mac and also locally on the Mac), if others are running into this problem give it a try:
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
Thanks! it is working. Using this extension and adding "stdio" property into its launch task, I can redirect input file to the c++ program for debugging.
The issue is when VSCode launches the debug adapter, then the debug adapter launches
lldb-mi
, thenlldb-mi
launchesTerminal
. There is a prompt that should appear, but somehow the DebugAdapter is not forwarding this permissions request.The work around is to have VS Code launch the terminal once. You can do this by adding and running this tasks in your
tasks.json
:{ "label": "Open Terminal", "type": "shell", "command": "osascript -e 'tell application \"Terminal\"\ndo script \"echo hello\"\nend tell'", "problemMatcher": [] }
You can run this specific task using
Command + Shift + p
. TypeTasks
and look forTasks: Run Tasks
then selectOpen Terminal
.Once you allow this permission, then the external console should appear when you debug.
I think this solution from @WardenGnaw is missing a step for anybody who is using a custom shell installed via macports or homebrew. I happened to run across https://trac.macports.org/wiki/howto/bash-completion which states:
Add /opt/local/bin/bash to the file /etc/shells, otherwise it will be impossible to use AppleScript to tell Terminal to execute scripts (like 'osascript -e "tell application \"Terminal\" to do script \"echo hello\""').
macOS will only allow AppleScript to tell Terminal to execute scripts if the user's $SHELL
is listed in /etc/shells
. I use bash installed via homebrew (/usr/local/bin/bash
) which is not included in /etc/shells
by default.
Once I added /usr/local/bin/bash
to /etc/shells
, using "externalConsole": true
started working for me.
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/bash <-- I had to add this line
@SkylerMime I am able to use debugger with this plugin (lldb-plugin). In my launch.json I had to create launch config for this plugin. I have tested with both internal and external terminals.
{ "name": "LLDB Plugin Launch", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/demo", "terminal": "external", "args": ["-arg1", "-arg2"], }
I tried this plugin, but I'm getting the error "unable to find executable for '/Users/Skyler/CppPrograms/demo'"
That is coming because you are using hard coded values for the key:
program
. So, it is looking for the file demo in your current workspace folder. Instead of that, I would suggest you to use the following (I'm personally using the following config for launch.json file and everything works perfectly smooth):{ "version": "0.2.0", "configurations":[ { "name": "clang++ - Build and debug active file", "type": "lldb", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": ["-arg1", "-arg2"], } ] }
I hope that helps you. 🙌😎
It works really nice! I checked!
Type: Debugger OS: MacOS Version: 10.15.3 Debugger: LLDB cpptools version: Version 0.27.0-insiders2
launch.json:
tasks.json:
Logs:
Opens up a external terminal window with log:
Followed: https://code.visualstudio.com/docs/cpp/config-clang-mac Now I need to run twice or thrice sometimes for the debugger to work properly with the same code.