microsoft / microsoft/vscode-java-debug
VSCode doesn't show JDK Java source files when debugging JDK itself
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 591
- Forks
- 429
- Merge medio
- 1 d 9 h
- PR fusionados (30 d)
- 19
Descripción
I'm building and debugging the latest version of OpenJDK on Windows 11. I'd like to debug it with VSCode, however I met the following problem:
I made changes in JDK Java sources (say added System.out.println("Hello") in src\jdk.javadoc\share\classes\jdk\javadoc\internal\tool\Main.java) and built JDK using JDK19 as boot JDK. I run my Java test using my freshly built JDK. It successfully starts and prints "Hello". Then I set a breakpoint at the line after my change in VSCode, and run the test under VSCode debugger. It starts, prints "Hello", and stops on my breakpoint, and shows source code, but I can't see my changes, because VSCode loaded jdk.javadoc\jdk.javadoc.internal.tool\Main.class instead of the changed Main.java.
I suppose, the class file was taken from java.configuration.runtimes, but I have no idea how can I force VSCode to load changed sources while debugging. Although VSCode is still able to show and debug my own Java-files, and, moreover, modified native JDK code (C/C++ sources), not Java.
BTW I've got the following pop-up message when debugger starts: "The compiled classes are not compatible with the runtime JDK."
Environment
- Operating System: Windows 11
- JDK version: 19
- Visual Studio Code version: 1.74.3
- Extension pack for Java: 0.25.7
- Java Debugger extension version: 0.47.0
Steps To Reproduce
- Clone openjdk repository (https://github.com/openjdk/jdk.git) and build it
- Make a little change in JDK's Java source file, e.g. add System.out.println("Hello") in src\jdk.javadoc\share\classes\jdk\javadoc\internal\tool\Main.java
- Set a breakpoint at the changed line and try to debug it with VSCode
Current Result
VSCode stops at the breakpoint, loads *.class file, which doesn't contain my changes.
Expected Result
VSCode stops at the breakpoint, loads changed *.java files and shows them in debugger.
Additional Informations
My setting.json:
"java.configuration.runtimes": [
{
"default": true,
"name": "JavaSE-19",
"path": "c:\\work\\jdk19",
}
],
My launch.json:
{
"type": "java",
"name": "(java) Debug",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "jdk.javadoc.internal.tool.Main",
"javaExec": "${workspaceFolder}\\build\\windows-x86_64-server-fastdebug\\jdk\\bin\\java.exe",
"classPaths": [
"${workspaceFolder}/build/windows-x86_64-server-fastdebug/images/jdk/lib/jrt-fs.jar",
],
},
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con launch.json javaExec y classPaths, así como con la configuración java.configuration.runtimes mostrada en el informe, y luego sigue cómo el depurador de Java selecciona el código fuente para las clases de JDK. Reproduce el problema con el cambio indicado de OpenJDK Main.java y verifica que la depuración muestre el código fuente Java modificado en lugar de la vista de clase incompatible.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java, typescript, vscode
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100