Unable to start debugging. Failed to initialize debugger terminal.
I am trying to debug a simple "Hello world!" application with VSCode on a 64 bit Arch Linux machine. Compiling is done without a problem, but when I go to debug it, about 10 seconds pass and it spits out this error: Unable to start debugging. Failed to initialize debugger terminal. I am using the default GDB/LLDB environment for launch.json.
Things I've tried:
- Changing "externalConsole" to false.
- Changing "terminal.external.linuxExec" to a different shell.
- Changing "terminal.integrated.shell.linux" to a different shell.
@tomaszal Do you have xterm or gnometerminal installed? We currently only support those two options. There is a backlog item to add other options in the future.
@pieandcakes I do have xterm installed and I've just tested it with gnome-terminal. Neither of them work and both return the same error. What's stranger is that even when I set "externalConsole" to false, which in my understanding should use the internal shell with bash, it returns the same error.
@Tomaszal the terminal options is not part of our extension and it isn't an option that we support at this time. Can you post your launch.json?
@pieandcakes it's just the default generated one: http://pastebin.com/TkFWbupt
@Tomaszal Yea, that is strange. If you enable logging in the launch.json can you send me what it says? I think you're going to want to set trace and traceResponse to true.
@Tomaszal One of our tests machine is running Arch Linux x64 (4.6.4) with XTerm(325) and gnome-terminal 3.20.2 installed and it is running on there with gdb version 7.11.1.
Here's the log:
R: {"success":false,"message":"Unable to start debugging. Failed to initialize debugger terminal.","request_seq":2,"command":"launch","body":{"error":{"id":1104,"format":"Unable to start debugging. Failed to initialize debugger terminal.","variables":null}},"running":false,"refs":null,"seq":0,"type":"response"} C disconnect: {"restart":false} R: {"success":true,"message":null,"request_seq":3,"command":"disconnect","body":null,"running":false,"refs":null,"seq":0,"type":"response"}
I'm currently on Arch Linux version 4.8.11, Xterm 327, gnome-terminal 3.22.1 and GDB 7.12. What's more strange is that CodeBlocks and Atom work fine on this machine.
I've recently reinstalled Arch Linux and decided to try running this again and it is now working correctly.
Now that I look back on it though I think I know what the problem was. I had both KDE and GNOME installed so I could experiment with both of them (I'm a new Linux user). I only used GNOME a few times but gnome-terminal got installed with it. I think the issue was that the debugger gave priority to gnome-terminal which couldn't run properly under my KDE setup so it just failed. Currently I have just XTerm installed and it runs just fine.
On another note I think that adding support for integrated terminal would be a nice option.
@Tomaszal Thanks for the update. The integrated terminal is something that we have on our radar for a future release. We do prefer gnome-terminal and fall back to xterm when it doesn't exist.
I'm having the same problem and can't figure out how to make it work. I got xterm and gdb on my $PATH.
Same issue here.
@knedlsepp @brandon-kohn Do either of you have gnome-terminal also installed? We use gnome-terminal first and then fallback to XTerm. You can try and change "externalConsole": false in the launch.json and see if it works without the console.
I got a Xterm as well as gnome-terminal installed. Saddly it does not work, I receive all messages which OP mentioned.
EDIT: One of the possible solution to overcome that bug is to change gdb to lldb:
"linux": { "MIMode": "lldb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }
Using ArchLinux.
Hello, I'm having same issue right now of cannot initialize the debugger, and here is my launch.json { "version": "0.2.0", "configurations": [ { "name": "C++ Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceRoot}/a.out", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}/", "logging": { "trace": true, "traceResponse": true, "engineLogging": true }, "environment": [], "externalConsole": false, "linux": { "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }, "osx": { "MIMode": "lldb" }, "windows": { "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } }, { "name": "C++ Attach", "type": "cppdbg", "request": "attach", "program": "${workspaceRoot}/a.out", "processId": "${command:pickProcess}", "linux": { "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }, "osx": { "MIMode": "lldb" }, "windows": { "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } } ] }
the debug error log:
1: (287) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014' 1: (300) LaunchOptions ExePath='/home/shadowlegend/Desktop/Project/C++/Accelerated C++(14)/exerices/a.out' 1: (300) LaunchOptions WorkingDirectory='/home/shadowlegend/Desktop/Project/C++/Accelerated C++(14)/exerices/' 1: (300) LaunchOptions ExeArguments='' 1: (300) LaunchOptions MIMode='gdb' 1: (300) LaunchOptions MIDebuggerPath='' 1: (300) LaunchOptions WaitDynamicLibLoad='false' R: {"success":false,"message":"Unable to start debugging. Failed to initialize debugger terminal.","request_seq":2,"command":"launch","body":{"error":{"id":1104,"format":"Unable to start debugging. Failed to initialize debugger terminal.","variables":null}},"running":false,"refs":null,"seq":0,"type":"response"} C disconnect: {"restart":false} R: {"success":true,"message":null,"request_seq":3,"command":"disconnect","body":null,"running":false,"refs":null,"seq":0,"type":"response"}
my tasks.json
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", "command": "g++", "isShellCommand": true, "args": ["-g", "--pipe", "--std=c++14", "${file}", "-lm"], "showOutput": "always" }
I have both xTerms and gnome-terminal, and i also have fish shell, but i tried removing it and still had the same error, i try reading some issue but still could not find the solution, im using Arch Linux.
Try to change mimode to lldb as I wrote above
Ok, I will try it right away and let u know after
Hello, I've changed it to lldb, but i do not know if it works correct, when i run my program requiring to input my name, then it draw the frame around it ( exercise from Accelerated C++ book ), after i input my name, the debugger just hang and output the message:
"Unable to perform this action because the process is running".
When i close the debugger this message appear:
"Execute debugger commands using "-exec
I believed the program exited with code 0 mean no error ? but why it isnt running the rest of the code, which after i input my name, it should draw the frame around it. I only made changes to the MIMode from gdb to lldb, the tasks.json and settings.json did not made any new changes.
What happens when you run your program without the debugger attached? Did you set a breakpoint? What is the debugger action you are trying to do? Is the debugger running or pausing your main thread? Do you see anything in the call stack section?
Hello, I've tried to set the breakpoint but it is still the same, since it is the first time i use the visual studio code, i still have not got used to properly run the program without debugger, which i run the program myself from terminal. I'm trying to test the debugging to see if it works so that i could work on my coding, the debugger first running but then it just pausing a the the input part. Here is my code and the debugger console [https://postimg.org/image/8butsmfvh/]
i have the same problem as above. My system is ubuntu 16.04. When is use gdb, the error is: "Unable to start debugging. Failed to initialize debugger terminal". gdb works well from my terminal without vs code.
Enable logging in the launch.jason gives: "R: {"success":false,"message":"Unable to start debugging. Failed to initialize debugger terminal.","request_seq":2,"command":"launch", "body":{"error":{"id":1104,"format":"Unable to start debugging. Failed to initialize debugger terminal.","variables":null}}, "running":false,"refs":null,"seq":0,"type":"response"} C disconnect: {"restart":false} R: {"success":true,"message":null,"request_seq":3,"command":"disconnect","body":null,"running":false,"refs":null,"seq":0,"type":"response"} "
I can solve the issue by changing gdb to lldb. However, it would really like to use gdb. Anyone has any suggestion?