Debuggin Hotspot in Linux Ubuntu 14 using Netbeans

Marcelino Rodriguez cancio marcelino.rodriguez-cancio at irisa.fr
Wed Feb 17 14:21:52 UTC 2016


Hello all, 

I'm trying to debug the with OpenJDK9 Hotspot in Linux Ubuntu 14 using Netbeans. 

I want to observe the behavior of the C++ code for some loop optimizations to learn how they work so then I can go ahead and implement some experimental ideas we have in the team. I'm not debugging generated bytecode. 

My problem is that the gdb debugger, which I launch from the IDE, don't stop in certain breakpoints, specifically in : 
/9dev/hotspot/src/share/vm/opto/loopPredicate.cpp/loopPredicate.cpp:909 

I'm able to launch the compiler and stop in: /9dev/jdk/src/java.base/share/native/libjli/java.cjava.c:1138, for example. 
I believe this happens because gdb does not attach to the VM thread, which seems to me is a child thread, only the parent launched from the Java executable (images/jdk/java). 
I'm total newby to gdb and debugging multiththread C++ applications, so I would like to debug from the IDE if possible. Any hints (books, articles, talks, etc), leads or advice on this? 

My SETUP is as Follows: 

I can see that the code containing the breakpoint is executed looking at the trace of the Hotspot (I'm using -XX:+TraceLoopPredicate ): 
rc_predicate init <u range 
lower bound check if: 475 
rc_predicate (limit - stride) <u range 
upper bound check if: 475 
Loop Predication Performed: Loop: N467/N273 limit_check predicated counted [int,int),+1 (-1 iters) has_sfpt rce 
rc_predicate init <u range 
lower bound check if: 200 
rc_predicate (limit - stride) <u range 
upper bound check if: 200 
Loop Predication Performed: Loop: N198/N184 limit_check predicated counted [int,int),+1 (-1 iters) has_sfpt rce 
no main manifest attribute, in /home/elmarce/PROJECTS/PHD/predicateloop/target/predicateloop-1.0-SNAPSHOT.jar 

I have described the way I compiled OpenJDK in here: 
http://marcelinorc.com/2016/02/11/compiling-openjdk-9/ 

And the way I created the Netbeans project in here: 
http://marcelinorc.com/2016/02/17/using-netbeans-to-hack-openjdk9-in-ubuntu/ 

I have configurated the compilation with the flags: 
--with-debug-level=slowdebug --with-target-bits=64 --disable-zip-debug-info 
I'm using as build result: build/linux-x86_64-normal-server-slowdebug/jdk/bin/java 
And as Run Command: "${OUTPUT_PATH}" -XX:+TraceLoopPredicate -jar /path/to/file/predicateloop-1.0-SNAPSHOT.jar 
I have read the post by Simonis: 
https://community.oracle.com/blogs/simonis/2008/01/24/hotspot-development-linux-netbeans-part-2#NB_Debug 
And then Watched the video: 
https://www.youtube.com/watch?v=k7IX_diKCEo 
Thanks 
Marcelino Rodriguez-Cancio (marcelinorc.com) 
INRIA BRETAGNE, DIVERSE Team ( http://diverse.irisa.fr/ ) 


More information about the hotspot-dev mailing list