# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
# This script launches HotSpot.
#
# If the first parameter is either "-gdb" or "-gud", HotSpot will be
# launched inside gdb. "-gud" means "open an Emacs window and run gdb
# inside Emacs".
#
# If the first parameter is "-dbx", HotSpot will be launched inside dbx.
#
# If the first parameter is "-valgrind", HotSpot will be launched
# inside Valgrind (http://valgrind.kde.org) using the Memcheck skin,
# and with memory leak detection enabled. This currently (2005jan19)
# requires at least Valgrind 2.3.0. -Xmx16m will also be passed as
# the first parameter to HotSpot, since lowering HotSpot's memory
# consumption makes execution inside of Valgrind *a lot* faster.
#
#
# User changeable parameters ------------------------------------------------
#
# This is the name of the gdb binary to use
if [ ! "$GDB" ]
then
fi
# This is the name of the gdb binary to use
if [ ! "$DBX" ]
then
fi
# This is the name of the Valgrind binary to use
if [ ! "$VALGRIND" ]
then
fi
# This is the name of Emacs for running GUD
#
# End of user changeable parameters -----------------------------------------
#
# Make sure the paths are fully specified, i.e. they must begin with /.
MYDIR=`cd $REL_MYDIR && pwd`
# Look whether the user wants to run inside gdb
case "$1" in
-gdb)
shift
;;
-gud)
shift
;;
-dbx)
shift
;;
-valgrind)
shift
;;
*)
;;
esac
JDK=
if [ "${ALT_JAVA_HOME}" = "" ]; then
. ${MYDIR}/jdkpath.sh
else
fi
if [ "${JDK}" = "" ]; then
exit 1
fi
# We will set the LD_LIBRARY_PATH as follows:
# o $JVMPATH (directory portion only)
# followed by the user's previous effective LD_LIBRARY_PATH, if
# any.
export JAVA_HOME
# Set up a suitable LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
if [ "${OS}" = "Darwin" ]
then
if [ -z "$DYLD_LIBRARY_PATH" ]
then
else
fi
export DYLD_LIBRARY_PATH
else
# not 'Darwin'
if [ -z "$LD_LIBRARY_PATH" ]
then
else
fi
export LD_LIBRARY_PATH
fi
JPARMS="$@ $JAVA_ARGS";
# Locate the gamma development launcher
if [ ! -x $LAUNCHER ] ; then
exit 1
fi
# Create a gdb script in case we should run inside gdb
cd `pwd`
handle SIGUSR1 nostop noprint
handle SIGUSR2 nostop noprint
set args $JPARMS
file $LAUNCHER
directory $GDBSRCDIR
# Get us to a point where we can set breakpoints in libjvm.so
break InitializeJVM
run
# Stop in InitializeJVM
delete 1
# We can now set breakpoints wherever we like
EOF
}
gdb)
;;
gud)
# First find out what emacs version we're using, so that we can
# use the new pretty GDB mode if emacs -version >= 22.1
emacs_gud_cmd="gdba"
emacs_gud_args="--annotate=3"
;;
*)
emacs_gud_cmd="gdb"
;;
esac
$EMACS --eval "($emacs_gud_cmd \"$GDB $emacs_gud_args -x $GDBSCR\")";
;;
dbx)
;;
echo
;;
run)
;;
*)
exit 1
;;
esac
RETVAL=$?
exit $RETVAL