Currently, multiple environment variables need to be set to enable debugging in OpenJ9.
Reference: https://blog.openj9.org/2018/06/05/debugging-openj9-in-docker-with-gdb/
export UMA_DO_NOT_OPTIMIZE_CCODE="1"
export VMDEBUG="-g3 -fno-inline -O0"
export VMLINK="-g -O0"
export enable_debug=yes
export enable_optimized=no
export enable_optimize=no
export CXXFLAGS="-O0 -g3"
export CFLAGS="-O0 -g3"
export BUILD_CONFIG=debug
It's tedious to keep track of all the environment variables. So, a global environment variable or configure option can be added to set all the required environment variables ... to enable debugging for OpenJ9.
fyi - @DanHeidinga @mstoodle @pshipton @keithc-ca
@dnakamura do CMAKE changes have a single trigger point to enable debugging in OpenJ9?
OpenJ9 should hook into the OpenJDK configure options to control debugging.
OpenJ9 should hook into the OpenJDK configure options to control debugging.
Build instructions for OpenJDK: http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
OpenJDK build instructions already support high level configure options to enable debugging. Example: --enable-debug, --with-debug-level=level (level=release|fastdebug|slowdebug) etc. We must detect these options and then, appropriately set debugging environment variables for OpenJ9.
We should understand the _intent_ of those OpenJDK configure options to be sure we connect to the right one(s).
from the OpenJDK build documentation,
--enable-debug sets the debug level to fastdebug (this is a shorthand for聽--with-debug-level=fastdebug).
debug (non-optimized, -g plus assert logic); fastdebug (optimized, -g plus assert logic)
documentation didn't explicitly define slowdebug. i think debug == slowdebug.
from bash ./configure --with-freemarker-jar=/root/freemarker.jar --help, I found the following debug related options:
--enable-debug set the debug level to fastdebug (shorthand for
--with-debug-level=fastdebug) [disabled]
--disable-debug-symbols disable generation of debug symbols [enabled]
--disable-zip-debug-info
disable zipping of debug-info files [enabled]
--with-debug-level set the debug level (release, fastdebug, slowdebug)
[release]
--debug-configure Run the configure script with additional debug
logging enabled.
for any other information about the intent of OpenJDK configure options, we may have to dive into the code.
Please note that setting those variables per https://github.com/eclipse/openj9/issues/2078#issue-329567921 causes the build to break. See https://github.com/eclipse/openj9/issues/2088.
Most helpful comment
OpenJ9 should hook into the OpenJDK configure options to control debugging.