HP (Hewlett-Packard) 5992-1918 TV Antenna User Manual


 
/usr/bin/echo "Create header file"
javah -verbose -jni StackTrace
# compile jni code
/usr/bin/echo "Compile c code"
/usr/bin/cc +z -c -I $JAVA_HOME/include \
-I $JAVA_HOME/include/hp-ux stacktrace.c
# create shared library
/usr/bin/echo "Create shared library"
/usr/bin/ld -b -o libstacktrace.sl stacktrace.o
/usr/bin/echo "Run StackTrace program"
export SHLIB_PATH=.
export LD_LIBRARY_PATH=.
java StackTrace
NOTE: If this script is run on an Integrity system, change it from:
# create shared library
/usr/bin/echo "Create shared library"
/usr/bin/ld -b -o libstacktrace.sl stacktrace.o
to:
# create shared library
/usr/bin/echo "Create shared library"
/usr/bin/ld -b -o libstacktrace.so stacktrace.o
4.1.2 StackTrace.java
// File StackTrace.java
public class StackTrace {
native static String dumpCore(int i);
//**************************************************
public static void method1(int ci) {
System.out.println("Calling method2()");
StackTrace.method2(ci);
} // end method1
//**************************************************
public static void method2(int ci) {
System.out.println("Calling method3()");
StackTrace.method3(ci);
} // end method2
//**************************************************
public static void method3(int ci) {
System.out.println("Calling methodMakeCall()");
StackTrace.methodMakeCall(ci);
} // end method3
//**************************************************
public static void methodMakeCall(int ci) {
try {
System.loadLibrary("stacktrace");
}
catch (UnsatisfiedLinkError Err) {
System.out.println("error: " + Err);
System.exit(1);
}
62 Core File Analysis