Use CLion source debugging OpenJDK12

table of Contents

1, the debugging environment

2, installation CLion

3, source code debugging

reference


1, the debugging environment

2, installation CLion

After downloading the installation package CLion-2019.3.3.tar.gz, into / home directory, unzip "sudo tar -zxvf CLion-2019.3.3.tar.gz" to the directory "clion-2019.3.3 / bin"

Run "./clion.sh" installation interface

I finally chose 30-day trial, the installation is complete.

3, source code debugging

Clion After installation, a new item, select "New CMake Project from Sources", fill root OpenJDK source folder in the source, at this time, been automatically selected Clion need to import good source, as shown in FIG. Click the OK button will import the source file and automatically created CMakeLists.txt.

The automatically generated CMakeLists.txt can not be used directly, OpenJDK itself does not provide any support for IDE, but if only to be able to track CLion, read the source code, recompile without modifying words:

  • (1) a direct increase in CMake Application Run / DebugConfigurations in
  • (2) Then select Executable we have just compiled by the FastDebug or SlowDebug version of the java command
  • (3) operating parameters plus -version or a Class file path
  • (4) Before launch inside Build then removed, debugging can start running, as shown below.
  • 注:编译出来的java命令路径(/home/develop/jdk12/build/linux-x86_64-server-release/jdk/bin/java

打上断点,点击debug:

到目前为止,我们能够在CLion中跟踪、阅读源码,但不能修改重新编译。

不过如果需要在CLion中修改源码,并重新编译产生新的JDK,又或者不想阅读时看见一堆头文件缺失提示的话,那还是需要把CMakeLists.txt修好,关于CMakeLists.txt的具体内容,后续再补充。

参考

《深入理解Java虚拟机:JVM高级特性与最佳实践》(第3版)

发布了95 篇原创文章 · 获赞 16 · 访问量 5万+

Guess you like

Origin blog.csdn.net/tiankong_12345/article/details/104088500