Ctrl+D (EOF) in debug mode VSCode - debugging

Version: 1.62.0
Commit: b3318bc0524af3d74034b8bb8a64df0ccf35549a
Date: 2021-11-04T20:38:29+02:00
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
ОС: Solus 4.3 Fortitude, Linux x64 5.14.16-204.current
There is a program written in D.
In the loop, a string is fed to the input, read and further execution of the algorithm takes place.
When running in normal mode, the program works without any problems.
When running in debug mode, I can't continue running the program because it hangs on the input process. I can't continue executing my code after pressing "Enter".
My launch.json:
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "launch",
"name": "Launch Program",
"target": "./lesson_2/bin/lesson_2",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText"
}
]
I tried to connect an external terminal, but it didn't work out.
Did so:
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "launch",
"name": "Launch Program",
"target": "./lesson_2/bin/lesson_2",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText",
"console": "externalTerminal",
"debugOptions": [
"RedirectOutput"
]
}
]
And that's it:
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "launch",
"name": "Launch Program",
"target": "./lesson_2/bin/lesson_2",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText",
"externalConsole": true
}
]
I also tried adding this option, but nothing has changed:
"console": "integratedTerminal"
I use Native debug.
In general, I don't know what to do. I ask for help.

Related

Unable to debug Golang on Vscode M1 Mac (arm64)

I have an M1 mac and cannot invoke functions via DLV in VSCode.
Unable to evaluate expression: backend does not support function calls
Delve Debugger
Version: 1.8.2
❯ go version ─╯
go version go1.18 darwin/arm64
What am I missing?
Launch.JSON file
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${file}",
"env": {
"PATH": "/usr/local/go/bin:${fileDirname}"
},
"args": []
}
]
}
From Delve (May 2022):
Support for calling functions on ARM64 has landed! https://github.com/go-delve/delve/pull/2996
Requires Go & Delve built from source with the latest changes.
Call functions from a debug session on ARM64 CPUs, including the Apple M1!
Note: Support function call injection on arm64 with Go 1.19 (CL 395754, as noted in issue 2277), so you will need to wait for Q4 2022.
The following json works for me-
{
"version": "0.2.0",
"configurations": [
{
"name": "DEV",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"env": {
"ENV_SERVERADDRESS": "0.0.0.0:7171",
}
}
]
}
On an M1:
{
// 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": "Debug normal",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"env": {},
"args": []
},
{
"name": "Debug arg=migrate",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"env": {},
"args": [
"migrate"
]
}
]
}
Which Go version?
Did you install delve with that version?

vscode: Unable to start debugging . The value of miDebuggerPath is invalid

I use the vscode to debug my code, my code can run but it can't start debugging.
my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${file}.exe",
"miDebuggerPath": "D:\\VisualStudioCode\\mingw\bin\\gdb.exe",
"args": [
"blackkitty",
"1221",
"# #"
],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": true,
"preLaunchTask": "g++"
}
]
}
Try deleting the .vscode file in your project directory, and then rerun it, with me it worked perfectly

Debugger executable '/usr/local/bin/gdb' is not signed. As a result, debugging may not work properly

Debugger executable /usr/local/bin/gdb is not signed. As a result, debugging may not work properly in vscode in macOS Catalina 10.15.6.
I am providing the launch.json file for reference.
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/ghermite.mod",
"miDebuggerPath": "/usr/local/bin/gdb",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": false,
"preLaunchTask": "build"
}
]
}
I had the same issue. I was able to get around it by installing the CodeLLDB extension.

How to target platforms with launch.json

The omnisharp ReadMe says this:
Operating System Specific Configurations
If there specific commands
that need to be changed per operating system, you can use the fields:
'windows', 'osx', or 'linux'. You can replace any of the fields
mentioned above for the specific operating system.
This is my launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/TestConsole/bin/Debug/netcoreapp2.1/TestConsole.dll",
"args": [
"c:\\git\\core\\XunitTestLib\\Steps\\",
// "~/../../XunitTestLib/Steps"
],
"cwd": "${workspaceFolder}/TestConsole",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}
When debugging I want to builds on Windows to start with the "args" entry which is uncommented, but on mac os I want it to start with the line which is commented out.
I am assuming that I would duplicate the configuration, once for Windows and mac, each, but this statement is confusing:
You can replace any of the fields mentioned above for the specific operating system.
It appears to be saying that I can replace "args" with "osx" but that obviously does not work.
How do I create a configuration for a target platform?
Turns out that targeting multiple platforms is a lot easier than I expected and is explained here with regards to the tasks.json file (but works just the same for launch.json).
My launch.json file adjusted for osx and windows would look like this:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/TestConsole/bin/Debug/netcoreapp2.1/TestConsole.dll",
"windows": {
"args": [
"c:\\git\\core\\XunitTestLib\\Steps\\"
]
},
"osx": {
"args": [
"~/../../XunitTestLib/Steps"
]
},
"cwd": "${workspaceFolder}/TestConsole",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}

Visual Studio Code Python Debugger Windows

I seem to be missing something simple, but I can't figure out why I am unable to debug python using Visual Studio Code on Windows. I've tried setting up the debugger as shown by Microsoft, and this youtube video. I've done a clean install of Visual Studio Code (including the python extension) and Python 3.6. I have no other python versions installed. I keep getting the following errors in the Python Debugger:
cd "c:\Users\xxx\Documents\Python Scripts" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "C:\Users\xxx\AppData\Local\Programs\Python\Python36-32\python.exe" "C:\Users\xxx\.vscode\extensions\ms-python.python-2018.3.1\pythonFiles\PythonTools\visualstudio_py_launcher.py" "c:\Users\xxx\Documents\Python Scripts" 53746 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput "c:\Users\xxx\Documents\Python Scripts\.vscode\launch.json"
-bash: cd: c:\Users\xxx\Documents\Python Scripts: No such file or directory
env: ‘C:\\Users\\xxx\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe’: No such file or directory
It's complaining that it can't find the python.exe file, but it clearly can since VS code indicates that it's attached:
My launch.json file is the default, and I've tried all the configurations:
// 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": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Terminal (external)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"debugOptions": [
"RedirectOutput",
"Django"
]
},
{
"name": "Python: Flask (0.11.x or later)",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "${workspaceFolder}/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
]
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "module.name"
},
{
"name": "Python: Pyramid",
"type": "python",
"request": "launch",
"args": [
"${workspaceFolder}/development.ini"
],
"debugOptions": [
"RedirectOutput",
"Pyramid"
]
},
{
"name": "Python: Watson",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/console.py",
"args": [
"dev",
"runserver",
"--noreload=True"
]
},
{
"name": "Python: All debug Options",
"type": "python",
"request": "launch",
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"module": "module.name",
"env": {
"VAR1": "1",
"VAR2": "2"
},
"envFile": "${workspaceFolder}/.env",
"args": [
"arg1",
"arg2"
],
"debugOptions": [
"RedirectOutput"
]
}
]
}
Pylinting works fine, and I have not custom user settings in Visual Studio Code that are related to python. I've tried setting the complete file path to python.exe in settings.json but it makes no difference.
Any help is greatly appreciated. Thanks in advance
I had the same problem but finally got out of it after several adjustment to my settings.
make sure all other settings are in place as you've mentioned especially pythonPath in settings.json and also get "python" installed from the "extension" toolbar in VS code.
Simply change your debug configuration from "Python: Scripts" (or any other configuration you've selected previously) to "Python: Terminal(external)" and you are good to go!
I know, is a pain and I'm experiencing the same.
Apparently python.exe is executing correctly. You will keep seeing that banner because "This is necessary to bootstrap the debugger."
At least this is what Microsoft says.

Resources