Wed, 21 May 2014 10:56:41 -0700
Added tag jdk8u20-b15 for changeset 8c785f9bde6f
duke@435 | 1 | #!/bin/sh |
duke@435 | 2 | # |
trims@1907 | 3 | # Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 4 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 5 | # |
duke@435 | 6 | # This code is free software; you can redistribute it and/or modify it |
duke@435 | 7 | # under the terms of the GNU General Public License version 2 only, as |
duke@435 | 8 | # published by the Free Software Foundation. |
duke@435 | 9 | # |
duke@435 | 10 | # This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 13 | # version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 14 | # accompanied this code). |
duke@435 | 15 | # |
duke@435 | 16 | # You should have received a copy of the GNU General Public License version |
duke@435 | 17 | # 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 19 | # |
trims@1907 | 20 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 21 | # or visit www.oracle.com if you need additional information or have any |
trims@1907 | 22 | # questions. |
duke@435 | 23 | # |
duke@435 | 24 | # |
duke@435 | 25 | |
duke@435 | 26 | # jdb is a .c file that seems to discard the setting of CLASSPATH. |
duke@435 | 27 | # So, we have to run jdb by calling java directly :-( |
duke@435 | 28 | |
duke@435 | 29 | # License file for development version of dbx |
duke@435 | 30 | LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense |
duke@435 | 31 | export LM_LICENSE_FILE |
duke@435 | 32 | |
duke@435 | 33 | doUsage() |
duke@435 | 34 | { |
duke@435 | 35 | cat <<EOF |
duke@435 | 36 | Usage: runjdb.sh corefile -jdk jdk-pathname -sa sa-pathname |
duke@435 | 37 | sa-pathname is the path of a JDI-SA build dir. |
duke@435 | 38 | EOF |
duke@435 | 39 | } |
duke@435 | 40 | |
duke@435 | 41 | jdk= |
duke@435 | 42 | javaArgs= |
duke@435 | 43 | args= |
duke@435 | 44 | sa= |
duke@435 | 45 | while [ $# != 0 ] ; do |
duke@435 | 46 | case $1 in |
duke@435 | 47 | -vv) |
duke@435 | 48 | set -x |
duke@435 | 49 | ;; |
duke@435 | 50 | -jdk) |
duke@435 | 51 | jdk=$2 |
duke@435 | 52 | shift |
duke@435 | 53 | ;; |
duke@435 | 54 | -sa) |
duke@435 | 55 | sa=$2 |
duke@435 | 56 | shift |
duke@435 | 57 | ;; |
duke@435 | 58 | -help | help) |
duke@435 | 59 | doUsage |
duke@435 | 60 | exit |
duke@435 | 61 | ;; |
duke@435 | 62 | -*) |
duke@435 | 63 | javaArgs="$javaArgs $1" |
duke@435 | 64 | ;; |
duke@435 | 65 | *) |
duke@435 | 66 | if [ ! -z "$args" ] ; then |
duke@435 | 67 | echo "Error: Only one core file or pid can be specified" |
duke@435 | 68 | exit 1 |
duke@435 | 69 | fi |
duke@435 | 70 | echo "$1" | grep -s '^[0-9]*$' > /dev/null |
duke@435 | 71 | if [ $? = 0 ] ; then |
duke@435 | 72 | # it is a pid |
duke@435 | 73 | args="$args $1" |
duke@435 | 74 | echo "Error: A pid is not yet allowed" |
duke@435 | 75 | exit 1 |
duke@435 | 76 | else |
duke@435 | 77 | # It is a core. |
duke@435 | 78 | # We have to pass the name of the program that produced the |
duke@435 | 79 | # core, and the core file itself. |
duke@435 | 80 | args="$1" |
duke@435 | 81 | fi |
duke@435 | 82 | ;; |
duke@435 | 83 | esac |
duke@435 | 84 | shift |
duke@435 | 85 | done |
duke@435 | 86 | |
duke@435 | 87 | if [ -z "$jdk" ] ; then |
duke@435 | 88 | echo "Error: -jdk jdk-pathname is required" |
duke@435 | 89 | exit 1 |
duke@435 | 90 | fi |
duke@435 | 91 | if [ -z "$sa" ] ; then |
duke@435 | 92 | echo "Error: -sa sa-pathname is required" |
duke@435 | 93 | exit 1 |
duke@435 | 94 | fi |
duke@435 | 95 | |
duke@435 | 96 | if [ -z "$args" ] ; then |
duke@435 | 97 | echo "Error: a core file or pid must be specified" |
duke@435 | 98 | exit 1 |
duke@435 | 99 | fi |
duke@435 | 100 | |
duke@435 | 101 | set -x |
duke@435 | 102 | $jdk/bin/jdb -J-Xbootclasspath/a:$sa -connect \ |
duke@435 | 103 | sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=$args,javaExecutable=$jdk/bin/java |
duke@435 | 104 | |
duke@435 | 105 | |
duke@435 | 106 | #$jdk/bin/java -Xbootclasspath/a:$mmm/ws/merlin-sa/build/agent \ |
duke@435 | 107 | # com.sun.tools.example.debug.tty.TTY -connect \ |
duke@435 | 108 | # sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore,javaExecutable=$jdk/bin/java |