Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sourav-dey opened this issue Mar 7, 2020 · 49 comments
Open

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

sourav-dey opened this issue Mar 7, 2020 · 49 comments
Assignees

Comments

@sourav-dey
Copy link

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
Copy link
Member

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

@sourav-dey
Copy link
Author

> DevToolsSecurity -status                                                                                                                                                                        
> Developer mode is currently disabled.

@WardenGnaw
Copy link
Member

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
Copy link
Author

> 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 WardenGnaw added debugger investigate This issue needs to be investigated/confirmed labels Mar 10, 2020
@WardenGnaw WardenGnaw self-assigned this Mar 10, 2020
@WardenGnaw
Copy link
Member

@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
Copy link
Author

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

@WardenGnaw WardenGnaw changed the title [macOS] ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (Error 1) [macOS Catalina] ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (Error 1) May 6, 2020
@WardenGnaw WardenGnaw added bug and removed investigate This issue needs to be investigated/confirmed labels May 6, 2020
@WardenGnaw
Copy link
Member

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
Copy link
Member

WardenGnaw commented May 6, 2020

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
Copy link
Member

@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
Copy link

peza8 commented May 6, 2020

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:

  • I build my project with CMake
  • Debugging without external terminal works perfectly
  • Debugging with lldb directly (using the lldb command in a terminal also works perfectly.
  • Your suggestion of CodeLLDB does work for me - super happy about that. Thanks.

@WardenGnaw
Copy link
Member

@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
Copy link

peza8 commented May 7, 2020

@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
Copy link
Member

@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
Copy link

peza8 commented May 7, 2020

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 WardenGnaw changed the title [macOS Catalina] ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (Error 1) [macOS Catalina] Unable to debug with 'externalConsole': true May 7, 2020
@WardenGnaw

This comment has been minimized.

@peza8

This comment has been minimized.

@WardenGnaw

This comment has been minimized.

@WardenGnaw
Copy link
Member

WardenGnaw commented May 9, 2020

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
Copy link

omcnoe commented May 10, 2020

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

@peza8
Copy link

peza8 commented May 11, 2020

Workaround works! Well done and thank you @WardenGnaw !

@BigSamu
Copy link

BigSamu commented Jan 8, 2021

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
Copy link

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
Copy link

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
Copy link

cmcta82 commented Feb 22, 2021

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
Copy link

Vickko commented Mar 3, 2021

The same issue on m1.

@TommyPec
Copy link

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
Copy link

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
Copy link

@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
Copy link

@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
Copy link

Evilrabbit520 commented May 17, 2021

与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
Copy link

ishantheperson commented May 28, 2021

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
Copy link

JacquelineCasey commented Aug 21, 2021

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
Copy link
Member

@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 #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: #8008 (comment)

@JacquelineCasey
Copy link

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

@SkylerMime
Copy link

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
Copy link

junekhan commented Sep 9, 2021

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
Copy link

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
Copy link

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
Copy link

@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
Copy link

@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
Copy link

talentwill commented Dec 11, 2021

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests