annotate agent/test/jdi/runjdb.sh @ 1552:c18cbe5936b8

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