Skip to main content

VSCode Remote Debugging

Supported Languages#

LanguageRequired PluginDev Image Required
JavaDebugger for JavaN/A
GoGodlv
PythonPythondebugpy
PHPPHP Debugxdebug
Node.jsN/AN/A
RubyRubyruby-debug-ide

Plugin Configuration#

The path to the Java Development Kit can be specified by the java.home setting in VS Code settings (workspace/user settings). If not specified, it is searched in the following order until a JDK meets current minimum requirement,for extension jdk configuration, see Setting the JDK.

  • the JDK_HOME environment variable
  • the JAVA_HOME environment variable
  • on the current system path

Debugging Process#

  1. Select the workload that you want to debug
  2. Right-click the workload and select Dev Config, configure your debugging configuration
  3. Then right-click this workload again and select Remote Debug
  4. Nocalhost will automatically install the dependencies on the first debug
  5. Nocalhost will automatically enter the DevMode and start remote debugging

Configuration#

The development environment is different between developers. You should configure remote debug configurations according to the actual situation.

Sample Configuration#

Nocalhost Configs
name: java-remote-debugging
serviceType: deployment
containers:
- name: ""
dev:
...
command:
debug:
- ./debug.sh
debug:
remoteDebugPort: 5005
...

Maven Example#

The shell command for Maven example:

jdk >= 1.8 and springBoot >=2.2.1.RELEASE
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

For jdk <=1.7 you should replace -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

For lower version of the springBoot you should replace -Drun.jvmArguments with -Dspring-boot.run.jvmArguments

Gradle Example#

The startup command for Gradle example:

Gradle's debug.sh
./gradlew bootRun --debug-jvm --no-daemon

Debugging Configurations in IDE#

VSCode debug configuration#

nocalhost will automatically configure launch.json of vscode when debug is finished, next time you can launch debug directly with shortcut key F5

Debugging parameters#

debug supports custom parameters to start, you just need to add parameters under configurations in launch.json, and the plugin will pass the parameters to the debugger when debug is launched.

If you need to enable diagnostic output when debugging a Node.js application, you just need to change the following configuration.

launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "nocalhost",
"request": "attach",
"name": "Nocalhost Debug",
"trace": true
}
]
}

Supported debugging parameters#

FAQ#

The java debugger stops at return ma.invoke(obj, args);in the java.lang.reflect.Method.class file.#

Execute the Java: Clean the Java language server workspace command

Last updated on by Tank Xu