This article address: http://www.cnblogs.com/myresearch/p/ide-buildhotspot.html, reprint please indicate source address.
In the process of reading OPENJDK source code, often need to run, debugging programs to help understand. We can now compile a debug version of the Hotspot virtual machine, disable optimizations, and have symbolic information so that GDB can be used for debugging. Many developers who know more about virtual machines are really directly using the GDB and Vim editor to develop and modify the hotspot, but believe that most readers prefer to read and track the hotspot source code in an IDE environment rather than a plain text gdb. In the previous article has described how to compile OpenJDK7 source code on the CentOS6.5, and now continue to describe how to build the eclipse-based hotspot source debugging environment under Linux.
Software Environment
Download Eclipse, Address: http://www.eclipse.org/cdt/downloads.php, and note that Eclipse supports the C + + version.
I downloaded the eclipse-cpp-kepler-sr2-linux-gtk-x86_64.tar.gz.
Specific operation
Step 1: First unpack the JDK source package, start Eclipse, select File
> New
>Makefile Project with Existing Code
The following interface appears:
Step 2: Navigate to Project name 右键
> Properties
> C/C++ Build
need to modify two places:
Remove the checkmark from the builder's use default Build command, and fill in the parametersARCH_DATA_MODEL=64
The build directory of build location is appended with/make, and eventually ${workspace_loc:/hotspot}/make, to tell the make compiler to look for the compiled file makefile in that directory.
Step 3: Select Menu bar Project
> Build Project
, see already started build, lunch break (first build probably need 10-20m).
Section log information:
......
Info:enable_full_debug_symbols=1
INFO:/usr/bin/objcopy cmd found so would create. debuginfo files.
Info:strip_policy=min_strip
Info:zip_debuginfo_files=1
MAKE[1]: Entering directory '/home/jvm/opt/openjdk/hotspot/make '
Make[1]: Nothing to is done for ' generic_export '.
MAKE[1]: Leaving directory '/home/jvm/opt/openjdk/hotspot/make '
02:01:39 Build finished (took 23s.540ms)
Step 4: After the compilation is successful, you can test it, and you need to configure the following steps:
Click the menu bar, run > Debug configurations > New launch Configuration, and fill in the/home/jvm/opt/openjdk/hotspot/in A/C + + Application Build/linux/linux_amd64_compiler2/fastdebug/gamma
Project selects the current project.
In Argument tab, program arguments fill in-version
In Environment tab environment variables to set fill in Java_home | /application/java/jdk
Check Debug in Common tab
After the configuration is complete, click Debug to enter debug mode
Resources
"Deep Java Virtual machine"
Source debugging of hotspots in eclipse