为方便调试,加-g选项Build整个openjdk6
1.openjdk源码下载
http://download.java.net/openjdk/jdk6/
2.将打包文件解压,在解压目录内运行下面shell命令,添加-g选项for file in `grep "\-O3" * -r | awk -F: '{print $1}' `; do sed -i 's/\-O3/\-g/g' $file; done
准备工作做好后,开始build,我所运行的系统环境Ubuntu 11.04
sudo apt-get build-dep? openjdk-6
sudo apt-get install libmotif-dev
export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk
#Pass "ALLOW_DOWNLOADS=true" to gmake
make all ALLOW_DOWNLOADS=true
HelloWorld例子,HelloWorld.java
?(gdb) list191 char * classname;192 InvocationFunctions ifn;193};194195/*196 * Entry point.197 */198int199main(int argc, char ** argv)200{(gdb)
至此,可以随心所欲地对openjdk进行调试了。
?