Solve the problem that you cannot view the value of variables when debugging JDK source code
A few days ago, I wanted to look at the source code of JDK in debug mode. When I entered debugging mode, I found that I couldn't see the variable value in the method at all. Why? In the current version of JDK, the debugging information is removed after compilation. The solution is to compile those classes with debugging information and use the command: javac - G
After reviewing some relevant materials, we now put the solutions below
1. Create JDK7 in the root directory of D: \_ SRC and JDK_ Debug directory.
2. In JDK_ Find Src. In the home directory Zip file and unzip the files in it to JDK7_ SRC directory, and then delete directories other than Java, javax and org in the extracted directory.
3. Put JDK_ Put rt.jar under home \ JRE \ Lib in your working directory, that is, the root directory of D: \ (this is just so that you don't need to specify a large number of file names on the command line).
4. Execute the command dir / B / S / X JDK7_ src\*. java > filelist. Txt to create the list of java files to be compiled, the input source file for javac command compilation, and the description of relevant parameters of dir command, /B: Do not output additional file information (no title information or summary), / s: display the files in the specified directory and all subdirectories, / X: display the short name generated by non-8.3 file name. The format is / N, and the short name is inserted before the long name. If there is no short name, it will be blank in its position.
5. Execute javac - j-xms16m - j-xmx1024m - sourcepath D: \ JDK7_ src -cp d:\rt.jar -d d:\jdk_ debug -g @filelist. txt >> log. Txt 2 > & 1 the compiled file will be put into the JDK_ Debug folder, and the log generated by compilation will be saved to log Txt file. You will see a lot of warnings in the log file, but no error messages.
6. Enter JDK_ The debug directory executes the command jar cf0 RT_ debug. Jar *, package the compiled file into RT_ debug. Jar package.
7. Put the newly generated jar package into the JDK_ Home \ JRE \ lib \ endorsed (if there is no endorsed folder, create it manually).
Description: JDK_ Home indicates the installation path of JDK. All commands in this article are executed under D: \ and its subdirectories.
To simplify, you can also add the debugging version of JDK7 I provide below to RT_ debug. Jar in the endorsed folder.
The above article to solve the problem that you can't view the value of variables when debugging JDK source code is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.