agent/test/jdi/runjdb.sh

changeset 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/agent/test/jdi/runjdb.sh	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,108 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
     1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 +#
     1.9 +# This code is free software; you can redistribute it and/or modify it
    1.10 +# under the terms of the GNU General Public License version 2 only, as
    1.11 +# published by the Free Software Foundation.
    1.12 +#
    1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 +# version 2 for more details (a copy is included in the LICENSE file that
    1.17 +# accompanied this code).
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License version
    1.20 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +#
    1.23 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.24 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.25 +# have any questions.
    1.26 +#  
    1.27 +#
    1.28 +
    1.29 +#  jdb is a .c file that seems to discard the setting of CLASSPATH.
    1.30 +# So, we have to run jdb by calling java directly :-(
    1.31 +
    1.32 +# License file for development version of dbx
    1.33 +LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense
    1.34 +export LM_LICENSE_FILE
    1.35 +
    1.36 +doUsage()
    1.37 +{
    1.38 +   cat <<EOF
    1.39 +Usage:  runjdb.sh corefile -jdk jdk-pathname -sa sa-pathname
    1.40 +    sa-pathname is the path of a JDI-SA build dir.
    1.41 +EOF
    1.42 +}
    1.43 +
    1.44 +jdk=
    1.45 +javaArgs=
    1.46 +args=
    1.47 +sa=
    1.48 +while [ $# != 0 ] ; do
    1.49 +    case $1 in
    1.50 +      -vv)
    1.51 +        set -x
    1.52 +        ;;
    1.53 +     -jdk)
    1.54 +        jdk=$2
    1.55 +        shift
    1.56 +        ;;
    1.57 +     -sa)
    1.58 +        sa=$2
    1.59 +        shift
    1.60 +        ;;
    1.61 +     -help | help)
    1.62 +        doUsage
    1.63 +        exit
    1.64 +        ;;
    1.65 +     -*)
    1.66 +        javaArgs="$javaArgs $1"
    1.67 +        ;;
    1.68 +     *)
    1.69 +        if [ ! -z "$args" ] ; then
    1.70 +            echo "Error: Only one core file or pid can be specified"
    1.71 +            exit 1
    1.72 +        fi
    1.73 +        echo "$1" | grep -s '^[0-9]*$' > /dev/null
    1.74 +        if [ $? = 0 ] ; then
    1.75 +            # it is a pid
    1.76 +            args="$args $1"
    1.77 +            echo "Error: A pid is not yet allowed"
    1.78 +            exit 1
    1.79 +        else
    1.80 +            # It is a core.        
    1.81 +            # We have to pass the name of the program that produced the
    1.82 +            # core, and the core file itself.
    1.83 +            args="$1"
    1.84 +        fi
    1.85 +        ;;
    1.86 +   esac
    1.87 +   shift
    1.88 +done
    1.89 +
    1.90 +if [ -z "$jdk" ] ; then
    1.91 +    echo "Error:  -jdk jdk-pathname is required"
    1.92 +    exit 1
    1.93 +fi
    1.94 +if [ -z "$sa" ] ; then
    1.95 +    echo "Error:  -sa sa-pathname is required"
    1.96 +    exit 1
    1.97 +fi
    1.98 +
    1.99 +if [ -z "$args" ] ; then
   1.100 +    echo "Error:  a core file or pid must be specified"
   1.101 +    exit 1
   1.102 +fi
   1.103 +
   1.104 +set -x
   1.105 +$jdk/bin/jdb -J-Xbootclasspath/a:$sa  -connect \
   1.106 +  sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=$args,javaExecutable=$jdk/bin/java
   1.107 +
   1.108 +
   1.109 +#$jdk/bin/java -Xbootclasspath/a:$mmm/ws/merlin-sa/build/agent \
   1.110 +#  com.sun.tools.example.debug.tty.TTY -connect \
   1.111 +#  sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore,javaExecutable=$jdk/bin/java

mercurial