openjdk给出debug配置选项,common/autoconf/jdk-options.m4
AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
[
###############################################################################
#
# Set the debug level
# release: no debug information, all optimizations, no asserts.
# fastdebug: debug information (-g), all optimizations, all asserts
# slowdebug: debug information (-g), no optimizations, all asserts
#
DEBUG_LEVEL="release"
AC_MSG_CHECKING([which debug level to use])
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
[set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])],
[
ENABLE_DEBUG="${enableval}"
DEBUG_LEVEL="fastdebug"
], [ENABLE_DEBUG="no"])
AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
[set the debug level (release, fastdebug, slowdebug) @<:@release@:>@])],
[
DEBUG_LEVEL="${withval}"
if test "x$ENABLE_DEBUG" = xyes; then
AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
fi
])
AC_MSG_RESULT([$DEBUG_LEVEL])
if test "x$DEBUG_LEVEL" != xrelease && \
test "x$DEBUG_LEVEL" != xfastdebug && \
test "x$DEBUG_LEVEL" != xslowdebug; then
AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
fi
开启调试信息
./configure --with-target-bits=64 --with-debug-level=slowdebug --enable-debug-symbols ZIP_DEBUGINFO_FILES=0
--with-boot-jdk:指定引导JDK所在目录;
--with-target-bits:指定编译64位系统的JDK;
为可以进行源码调试,再指定下面三个参数:
--with-debug-level=slowdebug:指定可以生成最多的调试信息;
--enable-debug-symbols ZIP_DEBUGINFO_FILES=0:生成调试的符号信息,并且不压缩
执行编译命令
make all ZIP_DEBUGINFO_FILES=0
java调试用例源码
https://github.com/fenixsoft/jvm_book.git
执行java的C++代码
关键执行class字节码步骤
1、加载MainClass
2、获取appClass
3、获取MainID和入参
4、执行java的main函数
执行的所有线程栈
堆空间OOM
疑问
libjvm.so 明明有编译信息,却没有符号
而且也断点不到oom需要打印的函数,估计不是搜到的退出函数了。