microsoft / microsoft/vscode-java-debug

VSCode doesn't show JDK Java source files when debugging JDK itself

Đang mở
#1,285 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

ai-triaged question sourcemap
Ngôn ngữ chính
TypeScript
Star
591
Fork
429
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
19

Mô tả

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
  1. Clone openjdk repository (https://github.com/openjdk/jdk.git) and build it
  2. 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
  3. 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",
    ],
},

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với launch.json javaExec và classPaths cùng với thiết lập java.configuration.runtimes được hiển thị trong báo cáo, sau đó theo dõi cách trình gỡ lỗi Java chọn mã nguồn cho các lớp JDK. Tái hiện vấn đề với thay đổi OpenJDK Main.java được liệt kê và xác minh rằng việc gỡ lỗi hiển thị mã nguồn Java đã thay đổi thay vì chế độ xem lớp không tương thích.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, typescript, vscode
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.