microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.54k stars 1.56k forks source link

[macOS Catalina] Unable to debug with 'externalConsole': true #5079

Open sourav-dey opened 4 years ago

sourav-dey commented 4 years ago

Type: Debugger OS: MacOS Version: 10.15.3 Debugger: LLDB cpptools version: Version 0.27.0-insiders2

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": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/AmazLeet.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb",
            "logging": {
                "trace": true,
                "traceResponse": true,
                "engineLogging": true
            }
        }
    ]
}

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "Build with Clang",
        "type": "shell",
        "command": "clang++",
        "args": [
          "-std=c++17",
          "-stdlib=libc++",
          "AmazLeet.cpp",
          "-o",
          "AmazLeet.out",
          "--debug"
        ],
        "group": {
          "kind": "build",
          "isDefault": true
        }
      }
    ]
  }

Logs:

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (160) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'\n"},"seq":2}
1: (160) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (173) LaunchOptions  ExePath='/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out'\n"},"seq":4}
1: (173) LaunchOptions  ExePath='/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (173) LaunchOptions  WorkingDirectory='/Users/sodey/CLionProjects/amazon-leet'\n"},"seq":6}
1: (173) LaunchOptions  WorkingDirectory='/Users/sodey/CLionProjects/amazon-leet'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (174) LaunchOptions  ExeArguments=''\n"},"seq":8}
1: (174) LaunchOptions  ExeArguments=''
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (174) LaunchOptions  MIMode='lldb'\n"},"seq":10}
1: (174) LaunchOptions  MIMode='lldb'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (174) LaunchOptions  MIDebuggerPath='/Users/sodey/.vscode/extensions/ms-vscode.cpptools-0.27.0-insiders2/debugAdapters/lldb-mi/bin/lldb-mi'\n"},"seq":12}
1: (174) LaunchOptions  MIDebuggerPath='/Users/sodey/.vscode/extensions/ms-vscode.cpptools-0.27.0-insiders2/debugAdapters/lldb-mi/bin/lldb-mi'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (174) LaunchOptions  WaitDynamicLibLoad='false'\n"},"seq":14}
1: (174) LaunchOptions  WaitDynamicLibLoad='false'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (174) LaunchOptions  ExternalConsole='true'\n"},"seq":16}
1: (174) LaunchOptions  ExternalConsole='true'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (174) LaunchOptions>\n"},"seq":18}
1: (174) LaunchOptions>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (175) LaunchOptions</LocalLaunchOptions>\n"},"seq":20}
1: (175) LaunchOptions</LocalLaunchOptions>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (306) Starting: \"/Users/sodey/.vscode/extensions/ms-vscode.cpptools-0.27.0-insiders2/debugAdapters/lldb-mi/bin/lldb-mi\" --interpreter=mi\n"},"seq":22}
1: (306) Starting: "/Users/sodey/.vscode/extensions/ms-vscode.cpptools-0.27.0-insiders2/debugAdapters/lldb-mi/bin/lldb-mi" --interpreter=mi
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (328) DebuggerPid=41251\n"},"seq":24}
1: (328) DebuggerPid=41251
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (773) ->(gdb)\n"},"seq":26}
1: (773) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (792) <-1001-interpreter-exec console \"version\"\n"},"seq":28}
1: (792) <-1001-interpreter-exec console "version"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (794) ->~\"lldb-1100.0.30.12\\nApple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)\\n\"\n"},"seq":30}
1: (794) ->~"lldb-1100.0.30.12\nApple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (796) ->(gdb)\n"},"seq":34}
1: (796) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (798) 1001: elapsed time 7\n"},"seq":36}
1: (798) 1001: elapsed time 7
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (801) <-1002-gdb-set auto-solib-add on\n"},"seq":38}
1: (801) <-1002-gdb-set auto-solib-add on
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (801) ->1002^done\n"},"seq":40}
1: (801) ->1002^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (802) ->(gdb)\n"},"seq":42}
1: (802) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (802) 1002: elapsed time 0\n"},"seq":44}
1: (802) 1002: elapsed time 0
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (802) <-1003-gdb-set solib-search-path \"/Users/sodey/CLionProjects/amazon-leet:\"\n"},"seq":46}
1: (802) <-1003-gdb-set solib-search-path "/Users/sodey/CLionProjects/amazon-leet:"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (803) ->1003^done\n"},"seq":48}
1: (803) ->1003^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (803) 1003: elapsed time 0\n"},"seq":50}
1: (803) 1003: elapsed time 0
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (803) ->(gdb)\n"},"seq":52}
1: (803) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (803) <-1004-environment-cd /Users/sodey/CLionProjects/amazon-leet\n"},"seq":54}
1: (803) <-1004-environment-cd /Users/sodey/CLionProjects/amazon-leet
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (805) ->1004^done,path=\"/Users/sodey/CLionProjects/amazon-leet\"\n"},"seq":56}
1: (805) ->1004^done,path="/Users/sodey/CLionProjects/amazon-leet"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (805) ->(gdb)\n"},"seq":58}
1: (805) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (807) 1004: elapsed time 3\n"},"seq":60}
1: (807) 1004: elapsed time 3
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (807) <-1005-gdb-set new-console on\n"},"seq":62}
1: (807) <-1005-gdb-set new-console on
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (808) ->1005^done\n"},"seq":64}
1: (808) ->1005^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (808) 1005: elapsed time 0\n"},"seq":66}
1: (808) 1005: elapsed time 0
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (808) ->(gdb)\n"},"seq":68}
1: (808) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (808) <-1006-file-exec-and-symbols /Users/sodey/CLionProjects/amazon-leet/AmazLeet.out\n"},"seq":70}
1: (808) <-1006-file-exec-and-symbols /Users/sodey/CLionProjects/amazon-leet/AmazLeet.out
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1245) ->1006^done\n"},"seq":72}
1: (1245) ->1006^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1246) 1006: elapsed time 437\n"},"seq":74}
1: (1246) 1006: elapsed time 437
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1246) ->(gdb)\n"},"seq":76}
1: (1246) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1246) <-1007-interpreter-exec console \"platform status\"\n"},"seq":78}
1: (1246) <-1007-interpreter-exec console "platform status"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1246) ->=library-loaded,id=\"/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out\",target-name=\"/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out\",host-name=\"/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out\",symbols-loaded=\"1\",symbols-path=\"/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out.dSYM/Contents/Resources/DWARF/AmazLeet.out\",loaded_addr=\"-\",size=\"409600\"\n"},"seq":80}
1: (1246) ->=library-loaded,id="/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out",target-name="/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out",host-name="/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out",symbols-loaded="1",symbols-path="/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out.dSYM/Contents/Resources/DWARF/AmazLeet.out",loaded_addr="-",size="409600"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1247) ->~\"  Platform: host\\n    Triple: x86_64h-apple-macosx\\nOS Version: 10.15.3 (19D76)\\n    Kernel: Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64\\n  Hostname: 127.0.0.1\\nWorkingDir: /Users/sodey/CLionProjects/amazon-leet\\n\"\n"},"seq":82}
1: (1247) ->~"  Platform: host\n    Triple: x86_64h-apple-macosx\nOS Version: 10.15.3 (19D76)\n    Kernel: Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64\n  Hostname: 127.0.0.1\nWorkingDir: /Users/sodey/CLionProjects/amazon-leet\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1248) ->1007^done\n"},"seq":84}
1: (1248) ->1007^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1248) ->(gdb)\n"},"seq":86}
1: (1248) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1249) 1007: elapsed time 3\n"},"seq":88}
1: (1249) 1007: elapsed time 3
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1250) <-1008-break-insert -f main\n"},"seq":90}
1: (1250) <-1008-break-insert -f main
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1301) ->1008^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000100012672\",func=\"main\",file=\"AmazLeet.cpp\",fullname=\"/Users/sodey/CLionProjects/amazon-leet/AmazLeet.cpp\",line=\"2700\",pending=[\"main\"],times=\"0\",original-location=\"main\"}\n"},"seq":92}
1: (1301) ->1008^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100012672",func="main",file="AmazLeet.cpp",fullname="/Users/sodey/CLionProjects/amazon-leet/AmazLeet.cpp",line="2700",pending=["main"],times="0",original-location="main"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1301) ->(gdb)\n"},"seq":94}
1: (1301) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1302) ->=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000100012672\",func=\"main\",file=\"AmazLeet.cpp\",fullname=\"/Users/sodey/CLionProjects/amazon-leet/AmazLeet.cpp\",line=\"2700\",pending=[\"main\"],times=\"0\",original-location=\"main\"}\n"},"seq":96}
1: (1302) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100012672",func="main",file="AmazLeet.cpp",fullname="/Users/sodey/CLionProjects/amazon-leet/AmazLeet.cpp",line="2700",pending=["main"],times="0",original-location="main"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1302) ->(gdb)\n"},"seq":98}
1: (1302) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1304) 1008: elapsed time 54\n"},"seq":100}
1: (1304) 1008: elapsed time 54
--> 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.10303.1","VS.Diagnostics.Debugger.HostVersion":"16.5.10303.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Launch.Duration":1215,"VS.Diagnostics.Debugger.Launch.IsCoreDump":false,"VS.Diagnostics.Debugger.VisualizerFileUsed":false,"VS.Diagnostics.Debugger.SourceFileMappings":0,"VS.Diagnostics.Debugger.MIMode":null}},"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 (setFunctionBreakpoints-3): {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":3}
--> R (setFunctionBreakpoints-3): {"type":"response","request_seq":3,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]},"seq":113}
<--   C (setExceptionBreakpoints-4): {"command":"setExceptionBreakpoints","arguments":{"filters":[]},"type":"request","seq":4}
--> R (setExceptionBreakpoints-4): {"type":"response","request_seq":4,"success":true,"command":"setExceptionBreakpoints","body":{},"seq":116}
<--   C (configurationDone-5): {"command":"configurationDone","type":"request","seq":5}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1504) Send Event AD7LoadCompleteEvent\n"},"seq":120}
1: (1504) Send Event AD7LoadCompleteEvent
--> R (configurationDone-5): {"type":"response","request_seq":5,"success":true,"command":"configurationDone","body":{},"seq":119}
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"Warning: Debuggee TargetArchitecture not detected, assuming x86_64.\n"},"seq":123}
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
<--   C (threads-6): {"command":"threads","type":"request","seq":6}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1508) <-1009-exec-run\n"},"seq":126}
1: (1508) <-1009-exec-run
--> R (threads-6): {"type":"response","request_seq":6,"success":true,"command":"threads","body":{"threads":[]},"seq":128}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6832) ->1009^error,msg=\"process exited with status -1 (Error 1)\"\n"},"seq":130}
1: (6832) ->1009^error,msg="process exited with status -1 (Error 1)"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6833) ->(gdb)\n"},"seq":132}
1: (6833) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6833) 1009: elapsed time 5324\n"},"seq":134}
1: (6833) 1009: elapsed time 5324
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6845) Send Event AD7MessageEvent\n"},"seq":136}
1: (6845) Send Event AD7MessageEvent
--> E (output): {"type":"event","event":"output","body":{"category":"stderr","output":"ERROR: Unable to start debugging. Unexpected LLDB output from command \"-exec-run\". process exited with status -1 (Error 1)\n"},"seq":138}
ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (Error 1)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6852) <--gdb-exit\n"},"seq":140}
1: (6852) <--gdb-exit
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6852) ->^exit\n"},"seq":142}
1: (6852) ->^exit
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6852) ->=thread-group-exited,id=\"i1\"\n"},"seq":144}
1: (6852) ->=thread-group-exited,id="i1"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6853) ->(gdb)\n"},"seq":146}
1: (6853) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6854) <-logout\n"},"seq":148}
1: (6854) <-logout
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6862) Send Event AD7ProgramDestroyEvent\n"},"seq":150}
1: (6862) Send Event AD7ProgramDestroyEvent
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"The program '/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out' has exited with code 42 (0x0000002a).\r\n\n"},"seq":152}
The program '/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out' has exited with code 42 (0x0000002a).

--> E (exited): {"type":"event","event":"exited","body":{"exitCode":42},"seq":154}
--> E (terminated): {"type":"event","event":"terminated","body":{},"seq":156}
--> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/DebugCompleted","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"16.5.10303.1","VS.Diagnostics.Debugger.HostVersion":"16.5.10303.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.DebugCompleted.BreakCounter":0}},"seq":158}
<--   C (disconnect-7): {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":7}
--> R (disconnect-7): {"type":"response","request_seq":7,"success":true,"command":"disconnect","body":{},"seq":161}

Opens up a external terminal window with log:

Launching: '/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out'
Working directory: '/Users/sodey/CLionProjects/amazon-leet'
1 arguments:
argv[0] = '/Users/sodey/CLionProjects/amazon-leet/AmazLeet.out'
/bin/bash: line 1: 41603 Trace/BPT trap: 5       arch -arch x86_64 /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/darwin-debug --unix-socket=/tmp/kkx3OS --arch=x86_64 --working-dir /Users/sodey/CLionProjects/amazon-leet --disable-aslr --env=OS_ACTIVITY_DT_MODE=enable -- /Users/sodey/CLionProjects/amazon-leet/AmazLeet.out
Process exited with status 133
So long and thanks for all the fish.
  -- Douglas Adams

[Process completed]

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.

WardenGnaw commented 4 years ago

Can you run DevToolsSecurity -status in your terminal, and what does it output?

sourav-dey commented 4 years ago
> DevToolsSecurity -status                                                                                                                                                                        
> Developer mode is currently disabled.
WardenGnaw commented 4 years ago

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?

sourav-dey commented 4 years ago
> 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.

WardenGnaw commented 4 years ago

@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?

sourav-dey commented 4 years ago

Cool, sure. I am using XCode Version 11.3.1 (11C504)

WardenGnaw commented 4 years ago

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 :/

WardenGnaw commented 4 years ago

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 .

WardenGnaw commented 4 years ago

@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
}
peza8 commented 4 years ago

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:

WardenGnaw commented 4 years ago

@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

peza8 commented 4 years ago

@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

WardenGnaw commented 4 years ago

@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?

peza8 commented 4 years ago

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.

WardenGnaw commented 4 years ago

Do you also have the update where your default shell is now zsh?

peza8 commented 4 years ago

The VScode update? or Catalina? Which default setting are you referring to? @WardenGnaw ?

Issue title change 👍 +1

WardenGnaw commented 4 years ago

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.

WardenGnaw commented 4 years ago

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.

Screen Shot 2020-05-08 at 7 17 25 PM

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.

omcnoe commented 4 years ago

@WardenGnaw There is a typo in your task, there is an extra a before \nendtask that breaks osascript. Workaround worked for me, thanks.

peza8 commented 4 years ago

Workaround works! Well done and thank you @WardenGnaw !

wenxuankou commented 4 years ago

so useful, thanks

cdwilson commented 4 years ago

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:

image

image

However, when I start the debugging session, I just get two empty terminal windows and the debugger doesn't stop at the breakpoint:

image

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}
KingOfDuck commented 4 years ago

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.

Screen Shot 2020-05-08 at 7 17 25 PM

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.

This one just solved my problem 😁

Will-huynh13 commented 4 years ago

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?

bravosierrasierra commented 4 years ago

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

kk-engineer commented 3 years ago

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.

Screen Shot 2020-05-08 at 7 17 25 PM

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.

This workaround doesn't work on macOS Big Sur , running on the new M1 arm chip.

BigSamu commented 3 years ago

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.

Screen Shot 2020-05-08 at 7 17 25 PM

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.

Not working the workaround for me. Any update with this issue?

silkthyme commented 3 years ago

thank you, this solved it for me!

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.

Screen Shot 2020-05-08 at 7 17 25 PM

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.

THANK YOU SO MUCH! This solved it for me

Beastandcool commented 3 years ago

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,

cmcta82 commented 3 years ago

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'

Vickko commented 3 years ago

The same issue on m1.

TommyPec commented 3 years ago

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.

ahmadrazakhawaja commented 3 years ago

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.

Screen Shot 2020-05-08 at 7 17 25 PM

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.

after doing this terminal window appears but it gets stuck and shows this:

Screenshot 2021-03-30 at 9 25 40 PM
TommyPec commented 3 years ago

@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 ?

ahmadrazakhawaja commented 3 years ago

@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.

Evilrabbit520 commented 3 years ago

与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.

ishantheperson commented 3 years ago

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

JacquelineCasey commented 3 years ago

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.

WardenGnaw commented 3 years ago

@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

JacquelineCasey commented 3 years ago

Thanks for the quick update. I can confirm that downgrading to the default build (instead of insiders) worked for me.

SkylerMime commented 3 years ago

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:

Screen Shot 2021-09-08 at 8 08 42 PM

And when I run the debugger (and step past the breakpoints), I get this result:

Screen Shot 2021-09-08 at 8 09 51 PM

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.

junekhan commented 3 years ago

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?

abhinavrathore019-gh commented 3 years ago

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:

Screen Shot 2021-09-08 at 8 08 42 PM

And when I run the debugger (and step past the breakpoints), I get this result:

Screen Shot 2021-09-08 at 8 09 51 PM

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"],
}
abhinavcreed13 commented 3 years ago

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:

Screen Shot 2021-09-08 at 8 08 42 PM

And when I run the debugger (and step past the breakpoints), I get this result:

Screen Shot 2021-09-08 at 8 09 51 PM

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 commented 3 years ago

@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'"

theBeginner86 commented 3 years ago

@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. 🙌😎

talentwill commented 2 years ago

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.

cdwilson commented 2 years ago

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.

Screen Shot 2020-05-08 at 7 17 25 PM

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.

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
kuznetsov-m commented 2 years ago

@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!