Hacking Hotspot in Eclipse

I recently started working on Hotspot, with the goal of getting the Zero port up-to-date with respect to he recent developments in MLVM. In order to work most efficiently, I set up a work environment in Eclipse, and thought it’d be useful to share a little HOW-TO.

First of all, you need to install Eclipse/CDT if you haven’t already. This gives you a very powerful C/C++ development environment in Eclipse.

You can then open an OpenJDK source tree as C/C++ project by selecting: File -> New -> Other and then ‘C/C++’ -> ‘Makefile project with existing code’. Enter project name, e.g. OpenJDK8, and the path to the existing location. Select the appropriate ‘Toolchain for indexer Settings’ below. Click Finish.

Then open the project properties by right-clicking on the project, and selecting ‘Properties’. There we need to setup a couple of things.Under ‘C/C++ Build’ -> Environment, enter all environment variables that you would normally set on the command line for building OpenJDK. At the very least, you need ‘ALT_BOOTDIR’ and LANG=C. Under ‘C/C++ Build’, click the tab ‘Refresh Policy’ and remove the only path that is there (otherwise the whole workspace will be refreshed after a build, which takes looooong’). Optionally, add any paths under ‘build’ that you are interested in. Under ‘C/C++ General’ -> ‘Paths and Symbols’, select the tab ‘Source Location’ and remove the toplevel project path, and enter any source paths you are working with (e.g. hotspot/src). This limits what is visible to the indexer, etc. In order to take full advantage of Eclipse for debugging, I also changed ‘C/C++ Build’, ‘Behavior’ tab, replace ‘all’ with ‘debug_build’ This will normally do a debug build of OpenJDK, which means that you get all the symbols and no compiler optimizations in the binaries. In order to be able to load the symbols in gdb, add ‘ZIP_DEBUGINFO_FILES=0’ into the environment variables.Then click ‘Apply’ and ‘OK’ to close the settings dialog. Select ‘Project -> Build Project’ to launch the first build of OpenJDK in Eclipse.

Debugging with Eclipse is similarily straightforward, open Debug Configurations, add a new C/C++ application, set up its properties for the binary, arguments and environment variables (make sure you use a debug-build binary) and run the thing! Being able to fully debug in Eclipse, navigating stack, inspecting variables, setting breakpoints and stepping through the code is so much more useful than doing the same in plain GDB:

Debug Hotspot Zero with Eclipse



Please help get my son’s school class get a van

Today I have a somewhat unusual request to you: I need your vote to help get my son’s school class get a van. Let me explain. My son attends a local Montessori school in Ettenheim (Freiburg area in Germany). A local bank is doing a contest for all sorts of local associations to win a van (actually, 8 of them). All of the participating associations are asked to make a short video clip that shows why they need one. And since my son’s school class could really use such a van as sort of school bus or general purpose transportation tool, they made a short video clip. The video clip was made by the students themselves, and I think it turned out really great. The selection of the winners goes in 3 phases: there were 80 participating associations, in the first round 50 were selected by voting (we already passed that), in the next round the top 25 of those 50 are selected by voting again (that’s what I’m gonna ask you about) and finally, 8 of those 25 are selected by a jury. We need to get into that last round now. What can you do? Simply follow this link and click on the star. No registration required. You only need to fill in a captcha and copy+paste some crap in order to prove that you’re human. If you do this: THANK YOU! It’s a great help!

Update: If you already voted yesterday, you can vote again (everybody can vote once per day, up to July 8th)!