HP (Hewlett-Packard) 5992-1918 ユーザーズマニュアル

ページ / 78
4 Core File Analysis
The previous chapter described how to collect necessary information before opening a call to
HP Support to get help troubleshooting Java applications. Sometimes it is possible to at least
attempt the core file analysis on your own. This chapter walks through an example core file
analysis step by step. By studying this example, you will learn some skills needed to analyze
your own core file.
HP-UX writes a file containing a core image of a process when certain signals are received. The
most common reasons a core file is generated are:
Memory violations
Illegal instructions
Floating-point exceptions
Bus errors
User-generated quit signals
User-requested core generation
Generally the core image file is called core and is written in the current working directory.
A core file is a dump of the process state at the time of the problem. The file contains sufficient
information to determine what the process was doing when it failed. This information includes:
Threads
Register values
Contents of attached data memory regions
Kernel version
Command name
4.1 Sample Java Application
The sample application contains native code (C) and Java code. This particular application aborts
in native code since this code contains a defect. The defect causes a runtime failure, which results
in a core dump.
The example consists of three files for an application calledStackTrace:
— the script to create the core file
— the Java source code
— the C source code
These three files should be placed in a directory called StackTrace.
The following subsections contain listings of each of these three files. This example is run on a
PA-RISC system. It can be tested on any PA or Integrity system though, as long as some changes
are made to the StackTraceJob script.
4.1.1 StackTraceJob
#!/bin/ksh
# set JAVA_HOME
export JAVA_HOME=/opt/java1.4
# set PATH
export PATH=$JAVA_HOME/bin:$PATH
# Compile java bytecode
/usr/bin/echo "Compile java code"
javac StackTrace.java
# create header file
4.1 Sample Java Application
61