Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 3. Debug symbols for Red Hat build of OpenJDK 11
Debug symbols help in investigating a crash in Red Hat build of OpenJDK applications.
3.1. Installing the debug symbols Link kopierenLink in die Zwischenablage kopiert!
This procedure describes how to install the debug symbols for Red Hat build of OpenJDK.
Prerequisites
Installed the
gdbpackage on your local sytem.-
You can issue the
sudo yum install gdbcommand on your CLI to install this package on your local system.
-
You can issue the
Procedure
To install the debug symbols, enter the following command:
sudo debuginfo-install java-11-openjdk sudo debuginfo-install java-11-openjdk-headless
$ sudo debuginfo-install java-11-openjdk $ sudo debuginfo-install java-11-openjdk-headlessCopy to Clipboard Copied! Toggle word wrap Toggle overflow These commands install
java-11-openjdk-debuginfo,java-11-openjdk-headless-debuginfo, and additional packages that provide debug symbols for Red Hat build of OpenJDK 11 binaries. These packages are not self-sufficient and do not contain executable binaries.NoteThe
debuginfo-installis provided by theyum-utilspackage.To verify that the debug symbols are installed, enter the following command:
gdb which java
$ gdb which java Reading symbols from /usr/bin/java...Reading symbols from /usr/lib/debug/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5/bin/java-11-openjdk-11.0.14.0.9-2.el8_5.x86_64.debug...done. (gdb)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. Checking the installation location of debug symbols Link kopierenLink in die Zwischenablage kopiert!
This procedure explains how to find the location of debug symbols.
If the debuginfo package is installed, but you cannot get the installation location of the package, then check if the correct package and java versions are installed. After confirming the versions, check the location of debug symbols again.
Prerequisites
Installed the
gdbpackage on your local sytem.-
You can issue the
sudo yum install gdbcommand on your CLI to install this package on your local system. - Installed the debug symbols package. See Installing the debug symbols.
-
You can issue the
Procedure
To find the location of debug symbols, use
gdbwithwhich javacommands:gdb which java
$ gdb which java Reading symbols from /usr/bin/java...Reading symbols from /usr/lib/debug/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5/bin/java-11-openjdk-11.0.14.0.9-2.el8_5.x86_64.debug...done. (gdb)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the following commands to explore the
*-debugdirectory to see all the debug versions of the libraries, which includejava,javac, andjavah:cd /usr/lib/debug/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5
$ cd /usr/lib/debug/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The javac and javah tools are provided by the java-11-openjdk-devel package. You can install the package using the command: $ sudo debuginfo-install java-11-openjdk-devel.
3.3. Checking the configuration of debug symbols Link kopierenLink in die Zwischenablage kopiert!
You can check and set configurations for debug symbols.
Enter the following command to get a list of the installed packages:
sudo yum list installed | grep 'java-11-openjdk-debuginfo'
$ sudo yum list installed | grep 'java-11-openjdk-debuginfo'Copy to Clipboard Copied! Toggle word wrap Toggle overflow If some debug information packages have not been installed, enter the following command to install the missing packages:
sudo yum debuginfo-install glibc-2.28-151.el8.x86_64 libgcc-8.4.1-1.el8.x86_64 libstdc++-8.4.1-1.el8.x86_64 sssd-client-2.4.0-9.el8.x86_64 zlib-1.2.11-17.el8.x86_64
$ sudo yum debuginfo-install glibc-2.28-151.el8.x86_64 libgcc-8.4.1-1.el8.x86_64 libstdc++-8.4.1-1.el8.x86_64 sssd-client-2.4.0-9.el8.x86_64 zlib-1.2.11-17.el8.x86_64Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following command if you want to hit a specific breakpoint:
gdb -ex 'handle SIGSEGV noprint nostop pass' -ex 'set breakpoint pending on' -ex 'break JavaCalls::call' -ex 'run' --args java ./HelloWorld
$ gdb -ex 'handle SIGSEGV noprint nostop pass' -ex 'set breakpoint pending on' -ex 'break JavaCalls::call' -ex 'run' --args java ./HelloWorldCopy to Clipboard Copied! Toggle word wrap Toggle overflow The above command completes the following tasks:
- Handles the SIGSEGV error as the JVM uses SEGV for stack overflow check.
-
Sets pending breakpoints to
yes. -
Calls the break statement in
JavaCalls::callfunction. The function to starts the application in HotSpot (libjvm.so).
3.4. Configuring the debug symbols in a fatal error log file Link kopierenLink in die Zwischenablage kopiert!
When a Java application is down due to a JVM crash, a fatal error log file is generated, for example: hs_error, java_error. These error log files are generated in current working directory of the application. The crash file contains information from the stack.
Procedure
You can remove all the debug symbols by using the
strip -gcommand. The following code shows an example of non-strippedhs_errorfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following code shows an example of stripped
hs_errorfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to check that you have the same version of debug symbols and the fatal error log file:
java -version
$ java -versionCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can also use the
sudo update-alternatives --config 'java'to complete this check.Use the
nmcommand to ensure thatlibjvm.sohas ELF data and text symbols:/usr/lib/debug/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5/lib/server/libjvm.so-11.0.14.0.9-2.el8_5.x86_64.debug
/usr/lib/debug/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.el8_5/lib/server/libjvm.so-11.0.14.0.9-2.el8_5.x86_64.debugCopy to Clipboard Copied! Toggle word wrap Toggle overflow