Visual Studio Code Debugger not launching - visual-studio-code

OS and Version: Windows 10 Build 19042.985
VS Code Version: 1.56.2
C/C++ Extension Version: v1.4.0-insiders
other extensions: remote-ssh
I've been working with remote-ssh on a raspberry and c/c++ extension without any issue, all of a sudden I cannot start the debugger. Nothing changed, configuration files are the same as before but now when I start the debugger, I see for a couple of seconds the top debugging bar and then it disappears. No message on the console, nothing.
For this purpose, I created a simple project from scratch, and even there, the same issue appears.
To Reproduce
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"logging": { "engineLogging": true },
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
}
]
}
main.c
#include <stdio.h>
int main(){
printf("ciao\n");
return 1;
}
Compile with gcc -g main.c
As I stated before, this workflow worked for me, from one second to another it stopped working as intended and I have no idea why and how to fix it, any help is appreciated.
What I tried
reinstall vscode
reinstall the c/c++ extension and delete by hand the extension folder
numerous reboots
Updates
I have tried with the wsl-remote extension and it is working as expected.ù
Tried to uninstall gdb from host and launch the debug session, the message "gdb" not found does not even appear as it should

I was in similar situation and couldn't find relevant resolutions:
Quick Answer:
After upgrade to VS Code 1.56.2, make sure to remove old breakpoints and create new breakpoint and at-least have 1 breakpoint and launch.json available.
Lengthy details:
I have similar issue for python scripts when I start the "debugger bar" I see it for a couple of seconds the top debugging bar and then it disappears. Bu then no message on the console, nothing. I tried reinstalling VS Code, enabling/disabling extension, various restart.
OS and Version: Mac OSX Version 11.4 (20F71)
VS Code Version: 1.56.2
Extension: Python v2021.5.842923320 by Microsoft
RootCause:
What I did know for sure that I updated my VS Code, and after that this mysterious issue start happening, so when to release log of VS Code 1.56.2. I found below release log
Debug view displayed on break#
The default value of the debug.openDebug setting is now
openOnDebugBreak so that on every breakpoint hit, VS Code will open
the Debug view. The Debug view is also displayed on first session
start.
So VS code Version 1.56 release, debugger will only show when at-least 1 breakpoint is found. However, looks like there is issue with their internal code checking for historical breakpoint data after VS Code upgrade..
https://code.visualstudio.com/updates/v1_56#_debug-view-displayed-on-break

I had this same issue in python. The fix for python was changing to a valid interpreter due to a python library not being installed. Make sure that the interpreter is correct and then try again.

This may be caused by a faulty installation of the VS Code C/C++ extension. When launching VS Code, if the message "Unable to start the C/C++ language server. IntelliSense features will be disabled" appears, this is probably the cause. Was able to fix the installation in this case by installing a previous version of the C/C++ extension as per this answer.

I had the same problem (though the debug bar would show up for a second and then disappear). I was using a conda env with python 3.6. I updated to 3.8, with the same dependencies, and it started working.

Related

Visual code debugger adapter immediately dies when trying to connect to vscode-hack debugger in local launch mode

I am using the vscode-hack extension on visual code studio on macOS Big Sur. My settings.json includes following launch configuration:
"configurations": [
{
"name": "HHVM: Run Script",
"type": "hhvm",
"request": "launch",
"script": "${file}",
"hhvmPath": "/usr/local/bin/hhvm",
"hhvmArgs": ["--mode", "vsdebug", "--vsDebugPort", 8999],
"cwd":"${workspaceFolder}"
}
]
When I try to debug a Hack script in Visual code debugger, Visual code debugger adapter launches and immediately dies. I have verified launching hhvm with the same args from command line, and it works fine. I am following the instructions here https://github.com/slackhq/vscode-hack/blob/master/docs/debugging.md
Does anybody have any suggestions?

VSCode only targets old verson of Illustrator (CS6)

I recently moved to a new workstation and cannot target an Adobe Application using VSCode and Extendscript Debugger. The workstaton previously had CS 6 installed on it, but now we use CC. I'm using Ilustrator 2019.
I can target Illustrator:
Target Menu Works
Illustrator 2019 shows up in the bar along the bottom:
AI 2019 looks like it is the target
But, then when I run the DeBugger it says CS 6 isn't running and I can't run CC2019?
Asked to target CS6?
Using MacOS 10.12.6
VSCode 1.50.1
ExtendscriptDebugger 1.1.2
I think you need to check the launch.json file to set the targetSpecifier version number.
For example, for After Effects 2020, I use this configuration to debug. This object is found in the configruations array in the launch.json file:
{
"type": "extendscript-debug",
"request": "launch",
"name": "My app debug",
"program": "${workspaceFolder}/Scripts/source.jsx",
"trace" : true,
"targetSpecifier": "aftereffects-17.0",
"engineName": "main",
"preLaunchTask": "debug-my-app",
"dontBreakOnErrors" : true
}
So, likely you need to find out the value for the targetSpecifier for the version of Illustrator you want the debugger to target.

Unable to debug flutter dart code in VS Code, Unverified Breakpoint error

When the code is not running, I can add breakpoint (round red circle), but as soon as it goes into debug mode, it turns into unverified breakpoint (grey hollow circle) and doesn't work at all. However, the same project works well on other systems.
I've no idea what the problem is or what the solution would be.
I've tried reinstalling flutter SDK numerous times, and have gone through a lot of links on SOF and GitHub regarding this, but none has been helpful enough.
Environment - VS Code,
Flutter version: 1.17.2
Flutter doctor -
[✓] Flutter (Channel stable, v1.17.2, on Mac OS X 10.15.3 19D76, locale en-GB)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[!] Android Studio (not installed)
[✓] VS Code (version 1.45.1)
[✓] Connected device (1 available)
! Doctor found issues in 2 categories.
My launch.json File -
{
// 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": "Flutter: Run all Tests",
"type": "dart",
"request": "launch",
"program": "./test/"
},
{
"name": "Dart: Run all Tests",
"type": "dart",
"request": "launch",
"program": "./test/"
},
{
"name": "Dart",
"type": "dart",
"request": "launch",
"program": "bin/main.dart"
},
{
"name": "Dart: Attach to Process",
"type": "dart",
"request": "attach"
},
{
"name": "Flutter",
"request": "launch",
"type": "dart"
}
]
}
Also, If you know any good alternatives to VSCode and Android Studio for Flutter, please share.
i came from mac and always use fn + f5, on windows that means start withouth debugggin, that was my mistake.
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"request": "launch",
"type": "dart",
"flutterMode": "debug"
}
]
}
This is my launch.json file ... changing "flutterMode" from profile to debug solved the issue ... if you dont have this line adding it could help.
For anybody running into this problem while trying to debug external libraries or sdk code: Make sure you checked "Dart: Debug External Libraries" and "Dart: Debug Sdk Libraries" under Settings > Extensions > Dart & Flutter as described here.
You can also add the following to your settings.json
"dart.debugExternalLibraries": true,
"dart.debugSdkLibraries": true,
Clicking Run on the top menu in VS code and selecting 'Enable all breakpoints' worked for me. Though you have to place your breakpoint first.
You can also try placing your breakpoint and save your code, then leave the emulator running and close and restart your vs code IDE and run the app with debugging.
For flutter-web I had to change back to <base href="/"> within the web/index.html. A custom href lead to a none-debuggable project.
Navigate to the Run Tab and select Dart & Flutter from the drop down menu, finally hit the play button.
Your main.dart file's path is not specified right.
so in this block
"name": "Dart",
"type": "dart",
"request": "launch",
"program": "bin/main.dart"
please use
"program": "lib/main.dart"
I was also facing the same issue, I am looking for the exact reason but removing the launch.json file worked for me.
Have faced the same issue, resolved by stopping the current active session and click on RUN and select START DEBUGGING. This worked for me.
I faced the same problem with debug in certain dart files, but the other files I could.
Then I realized that it happened when I call another file and this trick would help:
Instead of typing:
import '../form/productdetail.dart';
I replaced with:
import 'package:myapp/form/productdetail.dart';
and it helped.
I had a similar problem. I solved by completely uninstalling and reinstalling Vscode + remove the data. See here
In my case, the parents folder contains special character (#):
.../#Projects/my_project/
Remove the # and the debug goes well:
.../Projects/my_project/
I had a similar problem. My platform is Ubuntu 20.04. I was setting the breakpoint in vscode expecting the vscode debugger to work immediately, but no. After an hour of googling, I hit the Flutter docs on the DevTools page.
To resolve :
Open your flutter project in vscode.
Follow the 'Install from VS Code' section of the docs to install DevTools.
Start your emulator, wait for it to completely load up.
Select Run => Start Debugging.
Check that app is running as expected in the emulator.
Select commandPalette => Dart:Open DevTools => 'Open DevTools in web browser'. The DevTools dashboard opens in a new browser tab.
Select the Debugger tab.
Open the relevent code file and add your breakpoint by clicking the leftmost breakpoint column at the required line.
Progress your app by clicking the emulator UI. Vscode debugger should stop at your breakpoint.
Use the vscode debugging controls thereafter.
Try to rebuild your launch.json file.
Remove the old file from the .vscode directory in vscode, then goto Run and Debug window and create a new launch file.

Visual Studio Code Fails to find WSL

I'm trying to compile some C code in visual studio with gcc using WSL.
I've got a super simple configuration that executes on an F5 Press
"version": "0.2.0",
"configurations": [
{
"name": "Build And Run",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/.vscode/BuildAndRun.bat",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": true,
"environment": [],
},]
Which then should execute the batch file that contains a simple call to wsl and gcc
#echo off
wsl gcc main.c
pause
When I run this bat file by clicking on it, it works and everything compiles. however when I press F5 I get an error that 'wsl' is not recognized as an internal or external command.
I've tried adding it to Path and that didnt help.
I should also add that when I run the command inside the vs terminal it works, which just confuses me even more.
https://code.visualstudio.com/docs/cpp/launch-json-reference
program (required)
Specifies the full path to the executable the debugger will launch or attach to.
The debugger requires this location in order to load debug symbols
program is the executable for debugger to attach, not compile your code. Compile your C program via preLaunchTask in launch.json and config that command in tasks.json. See https://code.visualstudio.com/docs/cpp/config-mingw for reference.
Also, you may need WSL-Remote plugin and work directly in WSL, See also https://code.visualstudio.com/docs/cpp/config-wsl

Visual Studio Code errors when debugging Rust with "Missing auto-load debug_gdb_scripts"

I installed flatpak Visual Studio Code on Linux Mint. I'm trying to debug the "Hello world app" from the Rust book in VS Code.
src/main.rs:
fn main() {
println!("Hello, world!");
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug program",
"type": "gdb",
"request": "launch",
"target": "../target/debug/hello",
"cwd": "${workspaceRoot}"
}
]
}
When I cargo build the program and try to debug it, I get this error in Debug console:
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /home/gorn/nextcloud/viptrader/rust/target/debug/hello.
Use `info auto-load python-scripts [REGEXP]' to list them.
Running executable
warning: Error disabling address space randomization: Operation not permitted
I have installed these extensions:
rust-lang.rust
webfreak.debug
The real problem is the Error disabling address space randomization: Operation not permitted. The Missing auto-load script warning you can usually ignore.
The problem is likely caused by virtualization.
Try adding set disable-randomization off into the .gdbinit.
You might also follow this flatpak issue 1301.