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