Code Monkey home page Code Monkey logo

vscode-java-debug's Introduction

Debugger for Java

Gitter GitHub Actions

Overview

A lightweight Java Debugger based on Java Debug Server which extends the Language Support for Java by Red Hat. It allows users to debug Java code using Visual Studio Code (VS Code). Here's a list of features:

  • Launch/Attach
  • Breakpoints/Conditional Breakpoints/Logpoints
  • Exceptions
  • Pause & Continue
  • Step In/Out/Over
  • Variables
  • Callstacks
  • Threads
  • Debug console
  • Evaluation
  • Hot Code Replace

Requirements

Install

Open VS Code and press F1 or Ctrl + Shift + P to open command palette, select Install Extension and type vscode-java-debug.

Or launch VS Code Quick Open (Ctrl + P), paste the following command, and press enter.

ext install vscode-java-debug

Use

  • Launch VS Code
  • Open a Java project (Maven/Gradle/Eclipse/Single Java file)
  • Open a Java file to activate the extensions
  • Press F5

Please also check the documentation of Language Support for Java by Red Hat if you have trouble setting up your project.

Options

Launch

  • mainClass - The fully qualified name of the class containing the main method. If not specified, the debugger automatically resolves the possible main class from current project.
    • ${file} - Current Java file.
    • com.mypackage.Main - The fully qualified class name.
    • com.java9.mymodule/com.mypackage.Main - The fully qualified module name and class name.
    • /path/to/Main.java - The file path of the main class.
  • args - The command line arguments passed to the program.
    • "${command:SpecifyProgramArgs}" - Prompt user for program arguments.
    • A space-separated string or an array of string.
  • sourcePaths - The extra source directories of the program. The debugger looks for source code from project settings by default. This option allows the debugger to look for source code in extra directories.
  • modulePaths - The modulepaths for launching the JVM. If not specified, the debugger will automatically resolve from current project. If multiple values are specified, the debugger will merge them together.
    • $Auto - Automatically resolve the modulepaths of current project.
    • $Runtime - The modulepaths within 'runtime' scope of current project.
    • $Test - The modulepaths within 'test' scope of current project.
    • !/path/to/exclude - Exclude the specified path from modulepaths.
    • /path/to/append - Append the specified path to the modulepaths.
  • classPaths - The classpaths for launching the JVM. If not specified, the debugger will automatically resolve from current project. If multiple values are specified, the debugger will merge them together.
    • $Auto - Automatically resolve the classpaths of current project.
    • $Runtime - The classpaths within 'runtime' scope of current project.
    • $Test - The classpaths within 'test' scope of current project.
    • !/path/to/exclude - Exclude the specified path from classpaths.
    • /path/to/append - Append the specified path to the classpaths.
  • encoding - The file.encoding setting for the JVM. Possible values can be found in https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html.
  • vmArgs - The extra options and system properties for the JVM (e.g. -Xms<size> -Xmx<size> -D<name>=<value>), it accepts a string or an array of string.
  • projectName - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. This setting also works when the debugger looks for the specified main class when launching a program. It is required when the workspace has multiple java projects, otherwise the expression evaluation and conditional breakpoint may not work.
  • cwd - The working directory of the program. Defaults to ${workspaceFolder}.
  • env - The extra environment variables for the program.
  • envFile - Absolute path to a file containing environment variable definitions.
  • stopOnEntry - Automatically pause the program after launching.
  • console - The specified console to launch the program. If not specified, use the console specified by the java.debug.settings.console user setting.
    • internalConsole - VS Code debug console (input stream not supported).
    • integratedTerminal - VS Code integrated terminal.
    • externalTerminal - External terminal that can be configured in user settings.
  • shortenCommandLine - When the project has long classpath or big VM arguments, the command line to launch the program may exceed the maximum command line string limitation allowed by the OS. This configuration item provides multiple approaches to shorten the command line. Defaults to auto.
    • none - Launch the program with the standard command line 'java [options] classname [args]'.
    • jarmanifest - Generate the classpath parameters to a temporary classpath.jar file, and launch the program with the command line 'java -cp classpath.jar classname [args]'.
    • argfile - Generate the classpath parameters to a temporary argument file, and launch the program with the command line 'java @argfile [args]'. This value only applies to Java 9 and higher.
    • auto - Automatically detect the command line length and determine whether to shorten the command line via an appropriate approach.
  • stepFilters - Skip specified classes or methods when stepping.
    • classNameFilters - [Deprecated - replaced by skipClasses] Skip the specified classes when stepping. Class names should be fully qualified. Wildcard is supported.
    • skipClasses - Skip the specified classes when stepping.
      • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
      • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
      • java.* - Skip the specified classes. Wildcard is supported.
      • java.lang.ClassLoader - Skip the classloaders.
    • skipSynthetics - Skip synthetic methods when stepping.
    • skipStaticInitializers - Skip static initializer methods when stepping.
    • skipConstructors - Skip constructor methods when stepping.

Attach

  • hostName (required, unless using processId) - The host name or IP address of remote debuggee.
  • port (required, unless using processId) - The debug port of remote debuggee.
  • processId - Use process picker to select a process to attach, or Process ID as integer.
    • ${command:PickJavaProcess} - Use process picker to select a process to attach.
    • an integer pid - Attach to the specified local process.
  • timeout - Timeout value before reconnecting, in milliseconds (default to 30000ms).
  • sourcePaths - The extra source directories of the program. The debugger looks for source code from project settings by default. This option allows the debugger to look for source code in extra directories.
  • projectName - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. It is required when the workspace has multiple java projects, otherwise the expression evaluation and conditional breakpoint may not work.
  • stepFilters - Skip specified classes or methods when stepping.
    • classNameFilters - [Deprecated - replaced by skipClasses] Skip the specified classes when stepping. Class names should be fully qualified. Wildcard is supported.
    • skipClasses - Skip the specified classes when stepping.
      • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
      • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
      • java.* - Skip the specified classes. Wildcard is supported.
      • java.lang.ClassLoader - Skip the classloaders.
    • skipSynthetics - Skip synthetic methods when stepping.
    • skipStaticInitializers - Skip static initializer methods when stepping.
    • skipConstructors - Skip constructor methods when stepping.

User Settings

  • java.debug.logLevel: minimum level of debugger logs that are sent to VS Code, defaults to warn.
  • java.debug.settings.showHex: show numbers in hex format in "Variables" viewlet, defaults to false.
  • java.debug.settings.showStaticVariables: show static variables in "Variables" viewlet, defaults to false.
  • java.debug.settings.showQualifiedNames: show fully qualified class names in "Variables" viewlet, defaults to false.
  • java.debug.settings.showLogicalStructure: show the logical structure for the Collection and Map classes in "Variables" viewlet, defaults to true.
  • java.debug.settings.showToString: show 'toString()' value for all classes that override 'toString' method in "Variables" viewlet, defaults to true.
  • java.debug.settings.maxStringLength: the maximum length of string displayed in "Variables" or "Debug Console" viewlet, the string longer than this length will be trimmed, defaults to 0 which means no trim is performed.
  • java.debug.settings.numericPrecision: the precision when formatting doubles in "Variables" or "Debug Console" viewlet.
  • java.debug.settings.hotCodeReplace: Reload the changed Java classes during debugging, defaults to manual. See the wiki page for more information about usages and limitations.
    • manual - Click the toolbar to apply the changes.
    • auto - Automatically apply the changes after compilation. This only works when 'java.autobuild.enabled' is on.
    • never - Never apply the changes.
  • java.debug.settings.enableRunDebugCodeLens: enable the code lens provider for the run and debug buttons over main entry points, defaults to true.
  • java.debug.settings.forceBuildBeforeLaunch: force building the workspace before launching java program, defaults to true.
  • java.debug.settings.onBuildFailureProceed: Force to proceed when build fails, defaults to false.
  • java.debug.settings.console: The specified console to launch Java program, defaults to integratedTerminal. If you want to customize the console for a specific debug session, please modify the 'console' config in launch.json.
    • internalConsole - VS Code debug console (input stream not supported).
    • integratedTerminal - VS Code integrated terminal.
    • externalTerminal - External terminal that can be configured in user settings.
  • java.debug.settings.exceptionBreakpoint.exceptionTypes: Specifies a set of exception types you want to break on, e.g. java.lang.NullPointerException. A specific exception type and its subclasses can be selected for caught exceptions, uncaught exceptions, or both can be selected.
  • java.debug.settings.exceptionBreakpoint.allowClasses: Specifies the allowed locations where the exception breakpoint can break on. Wildcard is supported, e.g. java.*, *.Foo.
  • java.debug.settings.exceptionBreakpoint.skipClasses: Skip the specified classes when breaking on exception.
    • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
    • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
    • java.* - Skip the specified classes. Wildcard is supported.
    • java.lang.ClassLoader - Skip the classloaders.
  • java.debug.settings.stepping.skipClasses: Skip the specified classes when stepping.
    • $JDK - Skip the JDK classes from the default system bootstrap classpath, such as rt.jar, jrt-fs.jar.
    • $Libraries - Skip the classes from application libraries, such as Maven, Gradle dependencies.
    • java.* - Skip the specified classes. Wildcard is supported.
    • java.lang.ClassLoader - Skip the classloaders.
  • java.debug.settings.stepping.skipSynthetics: Skip synthetic methods when stepping.
  • java.debug.settings.stepping.skipStaticInitializers: Skip static initializer methods when stepping.
  • java.debug.settings.stepping.skipConstructors: Skip constructor methods when stepping.
  • java.debug.settings.jdwp.limitOfVariablesPerJdwpRequest: The maximum number of variables or fields that can be requested in one JDWP request. The higher the value, the less frequently debuggee will be requested when expanding the variable view. Also a large number can cause JDWP request timeout. Defaults to 100.
  • java.debug.settings.jdwp.requestTimeout: The timeout (ms) of JDWP request when the debugger communicates with the target JVM. Defaults to 3000.
  • java.debug.settings.jdwp.async: Experimental: Controls whether the debugger is allowed to send JDWP commands asynchronously. Async mode can improve remote debugging response speed on high-latency networks. Defaults to auto, and automatically switch to async mode when the latency of a single jdwp request exceeds 15ms during attach debugging.
    • auto (Default)
    • on
    • off
  • java.debug.settings.vmArgs: The default VM arguments to launch the Java program. Eg. Use '-Xmx1G -ea' to increase the heap size to 1GB and enable assertions. If you want to customize the VM arguments for a specific debug session, please modify the 'vmArgs' config in launch.json.
  • java.debug.settings.debugSupportOnDecompiledSource: [Experimental]: Enable debugging support on the decompiled source code. Be aware that this feature may affect the loading speed of Call Stack Viewlet. You also need Language Support for Java by Red Hat@1.20.0 or higher to use this feature.
  • java.silentNotification: Controls whether notifications can be used to report progress. If true, use status bar to report progress instead. Defaults to false.

Pro Tip: The documentation Configuration.md provides lots of samples to demonstrate how to use these debug configurations, recommend to take a look.

Troubleshooting

Reference the Troubleshooting Guide for common errors.
Reference the Troubleshooting Guide for Encoding Issues for encoding issues.

Contributing

If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute.

Feedback and Questions

You can find the full list of issues at Issue Tracker. You can submit a bug or feature suggestion, and participate community driven Gitter

License

This extension is licensed under MIT License.

Data/Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don't wish to send usage data to Microsoft, you can set the telemetry.telemetryLevel setting to "off". Learn more in our FAQ.

vscode-java-debug's People

Contributors

akaroml avatar andxu avatar ansyral avatar bhoppeadoy avatar bsaby avatar btoo avatar chase avatar cscherryy avatar cyrfer avatar dependabot[bot] avatar dotpys avatar dougmbarcellos avatar eskibear avatar gayanper avatar gluxon avatar jdneo avatar lunararcanus avatar maxandersen avatar microsoftopensource avatar msftgits avatar mutsuntsai avatar pablojimpas avatar sbj42 avatar srfrnk avatar testforstephen avatar thadhouse avatar xiaoyinl avatar xqzlgy2 avatar yaohaizh avatar zingblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-java-debug's Issues

Plugin uninstall error

OS: Windows 10
Build: https://vscjavaci.cloudapp.net/job/vscode-java-debug.vsix/16/Azure/
VSCode: 1.16.1 x86
JDK: 1.8.0.14 x64

Repro Steps:

  1. Click uninstall java Debug Extension for Visual Studio Code
  2. Choose All in following dialog

image

image

[Error - 10:23:54 PM] Sep 19, 2017 10:18:52 PM An internal error occurred during: "Periodic workspace save.".
org/eclipse/core/runtime/Plugin$2
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin$2
at org.eclipse.core.runtime.Plugin.savePluginPreferences(Plugin.java:385)
at org.eclipse.core.internal.resources.SaveManager.saveMetaInfo(SaveManager.java:1310)
at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1233)
at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1165)
at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:52)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin$2 cannot be found by org.eclipse.core.runtime_3.13.0.v20170207-1030
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more

Support hot class reloading

While debugging, making a non breaking change to a source file (i.e don't change method signature, add new method...) should make the debugger restart the current method call, without breaking the debugging session (same as in Eclipse).

Update jar version and load bundle throw exception

reproduce steps:

  1. Update the jar from 0.1.0-SNAPSHOT to 0.1.0, build new vsix
  2. Uninstall old vsix from vscode
  3. Install new vsix
  4. From the logs, it throws exception:
[Error - 7:16:53 PM] Sep 25, 2017 7:16:53 PM Failed to load extension bundles 
Load bundle list
org.eclipse.core.runtime.CoreException: Load bundle list
	at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:76)
	at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.initialize(InitHandler.java:90)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:51)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:105)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:210)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:146)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:84)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Contains: Install bundle failure C:\Users\jinbwan\.vscode-insiders\extensions\vscjava.vscode-java-debug-0.1.0\server\com.microsoft.java.debug.plugin-0.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Error reading bundle content.
	at org.eclipse.osgi.storage.Storage.install(Storage.java:501)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.installBundle(BundleContextImpl.java:146)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.installBundle(BundleContextImpl.java:139)
	at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:65)
	at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.initialize(InitHandler.java:90)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:51)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:105)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:210)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:146)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:84)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.FileNotFoundException: C:\Users\jinbwan\.vscode-insiders\extensions\vscjava.vscode-java-debug-0.1.0\server\com.microsoft.java.debug.plugin-0.1.0-SNAPSHOT.jar
	at org.eclipse.osgi.storage.url.reference.ReferenceURLConnection.checkRead(ReferenceURLConnection.java:59)
	at org.eclipse.osgi.storage.url.reference.ReferenceURLConnection.connect(ReferenceURLConnection.java:51)
	at org.eclipse.osgi.storage.url.reference.ReferenceURLConnection.getInputStream(ReferenceURLConnection.java:93)
	at org.eclipse.osgi.storage.Storage.install(Storage.java:499)
	... 21 more

Exception on threads request

[Error - 2:22:01 PM] Sep 26, 2017 2:12:02 PM DebugSession dispatch exception: com.sun.jdi.VMDisconnectedException: Got IOException from Virtual Machine
Got IOException from Virtual Machine
com.sun.jdi.VMDisconnectedException: Got IOException from Virtual Machine
at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:186)
at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:204)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:192)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:227)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:243)
at org.eclipse.jdi.internal.ThreadReferenceImpl.name(ThreadReferenceImpl.java:356)
at com.microsoft.java.debug.core.adapter.handler.ThreadsRequestHandler.threads(ThreadsRequestHandler.java:79)
at com.microsoft.java.debug.core.adapter.handler.ThreadsRequestHandler.handle(ThreadsRequestHandler.java:54)
at com.microsoft.java.debug.core.adapter.DebugAdapter.dispatchRequest(DebugAdapter.java:73)
at com.microsoft.java.debug.core.adapter.ProtocolServer.dispatchRequest(ProtocolServer.java:208)
at com.microsoft.java.debug.core.adapter.ProtocolServer.processData(ProtocolServer.java:177)
at com.microsoft.java.debug.core.adapter.ProtocolServer.start(ProtocolServer.java:99)
at com.microsoft.java.debug.plugin.internal.JavaDebugServer$2.run(JavaDebugServer.java:139)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

[Pause on exception] cannot open src file at pausing when it is too deep in the callstack

Steps:

  1. Open a complicated Java project, e.g. azure-tools-for-java

  2. Open the same project in Eclipse, add VM options
    -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=<PortNumber>
    and Run it in eclipse.

  3. Check Caught Exceptions, set corresponding port <PortNumber>, attach the debugger.

  4. The main threads pauses on exception, but no available src files in top callstacks. At my first sight I don't know where the exception occurred.
    image

  5. Click Load More Stack Frames, to show more frames:
    image

Should it find the first available src file in stack frames, and navigate to that file?

String variable cannot be copied because it's trimmed by debugger

image

For this case, i want to copy the string variable to a txt and compare it with another program result. But the debugger gives me a trimmed string instead of the complete string. And the user doesn't have any other way to get the full string.

We need figure out how to handle the long string variable more reasonably.

0.1.0 RC Bits Validation

Smoke Test

  1. Installation
  2. Add debug configuration
  3. Launch/Attach/Stop/Detach
  4. Set/Remove breakpoint
  5. Step In/Out/Over, Continue/Pause
  6. Variables/Watch/Call Stack/Threads

Validated the workflow using the following configurations:

Automation Test

BI Data

  • activateExtension Pass - @andxu

[Launch.json] Does not support "*" class match in args

Steps

  1. In launch.json add config: "args": "com.microsoft.azuretools.adauth.*",
  2. F5 to start debug
  3. Got error:
    initializationError(org.junit.runner.JUnitCommandLineParseResult)
    java.lang.IllegalArgumentException: Could not find class [com.microsoft.azuretools.adauth.*]
    at org.junit.runner.JUnitCommandLineParseResult.parseParameters(JUnitCommandLineParseResult.java:102)
    at org.junit.runner.JUnitCommandLineParseResult.parseArgs(JUnitCommandLineParseResult.java:50)

Improve debugger extension name

image

  • The extension name is very long. 'for Visual Studio Code' should be removed, it is true for all extensions in the Visual Studio Code marketplace
  • Also, searching for 'Java debugger' doesn't list it in the top entries

Some suggesions

  • Java Debugger
  • Debugger for Java
  • Language Support for Java Debugger

There's already the Java Debugger from Don Jayamanne, but I think people will see it is from Microsoft

The description could say: Debugger extension for the Java Language Support by Red Hat.

Line number is not corrected match for system classes on the Ubuntu

Project: https://github.com/fbricon/vscode-java-demo
System: Ubuntu

  1. Git clone the project
  2. Open with VSCode and wait for the project initialized with language server
  3. Config launch.json
  4. Start debugging

Issue: Debug into the system classes such as Arrays/AbstractCollection, it will stop at the last line

{
    // 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": [
        
        {
            "type": "java",
            "name": "Debug (Launch)",
            "request": "launch",
            "mainClass": "com.redhat.vscode.demo.DevoxxApplication",
            "args": "",
            "sourcePaths": [
                "${workspaceRoot}"
            ]
        },
        {
            "type": "java",
            "name": "Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 0,
            "timeout": 30000,
            "sourcePaths": [
                "${workspaceRoot}"
            ]
        }
    ]
}

error

The program output and debug output are mixed in the Debug Console

Project: https://github.com/fbricon/vscode-java-demo
System: Ubuntu

  1. Git clone the project
  2. Open with VSCode and wait for the project initialized with language server
  3. Config launch.json
  4. Start debugging

Expected: The program and debug information should be output to two separated console

Actually: All the information are directed to the debug console.

{
    // 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": [
        
        {
            "type": "java",
            "name": "Debug (Launch)",
            "request": "launch",
            "mainClass": "com.redhat.vscode.demo.DevoxxApplication",
            "args": "",
            "sourcePaths": [
                "${workspaceRoot}"
            ]
        },
        {
            "type": "java",
            "name": "Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 0,
            "timeout": 30000,
            "sourcePaths": [
                "${workspaceRoot}"
            ]
        }
    ]
}

Improve market place description

-> Better mention in the first sentence that this one extends the Java Language Support by Red Hat.

A lightweight Java Debugger that extends the Language Support for Java by Red Hat:
Here's a list of features:
...

HelloWorld hangs on running state.

Repro steps:

  1. open a simple HelloWorld program, without setting any breakpoints.
  2. press F5 for multiple times with a super fast speed.

Actual behavior:
states of all the threads are running now, and you cannot pause them.

image

Illegal argument

OS: Windows 10
Build: https://vscjavaci.cloudapp.net/job/vscode-java-debug.vsix/16/Azure/
VSCode: 1.16.1 x86
JDK: 1.8.0.14 x64

Repro steps:

  1. Open vocode and open folder the extracted folder 8.nosource from testcase.zip
  2. Open NoSourceTest.java, and set breakpoint on line 4: System.out.println(i+10);
  3. Start debug and wait for breakpoint hit
  4. Switch to the Foo.java -1 stack fame
  5. Press F5
  6. Click any code in the Foo.java window
    image

Debugger should allow user to specify launching cli command in launch.json

In order to debug spring mvc projects with vscode-java-debug, user need run mvnDebug tomcat7:run on cmd first, then configure attach options in launch.json.
Actually debugger can integrate the launch command in launch.json. And use launchInTerminal feature to execute the launching command in VSCode integrated terminal automatically. Then debugger attaches to the debug port to start debugging.

[Remote Debug]Step into doesn't act as expect

When the debugger hit the breakpoint as follows:
screen shot 2017-09-21 at 11 29 40 am

Then I click step into:
the debugger doesn't step into the method: initFormContents(), but goes into somewhere else:
screen shot 2017-09-21 at 11 33 00 am

edit:
I tried to use IntelliJ to debug and click step into, the debugger goes into:
screen shot 2017-09-21 at 11 50 55 am

0.1.0 endgame

Two stopped events for step and breakpoint.

when I steps into a line which contains an existing breakpoint, two stop events will be sent targeting at the same thread id which causes two stack frame requests with same thread id, which will cause vscode report duplicate stack id error:
image

Cannot remote debug

I'm trying to using remote debug mode to debug my project, but I cannot set the breakpoint and the language server seems not working.

My project structure looks like this:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.