Mercurial > hg > graal-compiler
annotate make/hotspot.script @ 14748:483d05bf77a7 graal-0.2
changelog: graal-0.2
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Tue, 25 Mar 2014 22:37:21 +0100 |
parents | b59507f713e0 |
children | 4ca6dc0799b6 |
rev | line source |
---|---|
3960 | 1 #!/bin/sh |
1985 | 2 |
14223
de6a9e811145
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
10277
diff
changeset
|
3 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
1985 | 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 # This script launches HotSpot. | |
26 # | |
27 # If the first parameter is either "-gdb" or "-gud", HotSpot will be | |
28 # launched inside gdb. "-gud" means "open an Emacs window and run gdb | |
29 # inside Emacs". | |
30 # | |
31 # If the first parameter is "-dbx", HotSpot will be launched inside dbx. | |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
32 # |
1985 | 33 # If the first parameter is "-valgrind", HotSpot will be launched |
34 # inside Valgrind (http://valgrind.kde.org) using the Memcheck skin, | |
35 # and with memory leak detection enabled. This currently (2005jan19) | |
36 # requires at least Valgrind 2.3.0. -Xmx16m will also be passed as | |
37 # the first parameter to HotSpot, since lowering HotSpot's memory | |
38 # consumption makes execution inside of Valgrind *a lot* faster. | |
39 # | |
40 | |
41 | |
42 # | |
43 # User changeable parameters ------------------------------------------------ | |
44 # | |
45 | |
46 # This is the name of the gdb binary to use | |
47 if [ ! "$GDB" ] | |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
48 then |
1985 | 49 GDB=gdb |
50 fi | |
51 | |
14317
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
52 # This is the name of the dbx binary to use |
1985 | 53 if [ ! "$DBX" ] |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
54 then |
1985 | 55 DBX=dbx |
56 fi | |
57 | |
58 # This is the name of the Valgrind binary to use | |
59 if [ ! "$VALGRIND" ] | |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
60 then |
1985 | 61 VALGRIND=valgrind |
62 fi | |
63 | |
64 # This is the name of Emacs for running GUD | |
65 EMACS=emacs | |
66 | |
67 # | |
68 # End of user changeable parameters ----------------------------------------- | |
69 # | |
70 | |
14317
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
71 OS=`uname -s` |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
72 |
1985 | 73 # Make sure the paths are fully specified, i.e. they must begin with /. |
3991
3f24f946bc2d
7099454: /bin/sh does not support syntax used in the src/os/posix/launcher/launcher.script shell script
brutisso
parents:
3960
diff
changeset
|
74 REL_MYDIR=`dirname $0` |
3f24f946bc2d
7099454: /bin/sh does not support syntax used in the src/os/posix/launcher/launcher.script shell script
brutisso
parents:
3960
diff
changeset
|
75 MYDIR=`cd $REL_MYDIR && pwd` |
14317
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
76 case "$OS" in |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
77 CYGWIN*) |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
78 MYDIR=`cygpath -m "$MYDIR"` |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
79 ;; |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
80 esac |
1985 | 81 |
10277 | 82 # |
1985 | 83 # Look whether the user wants to run inside gdb |
84 case "$1" in | |
85 -gdb) | |
86 MODE=gdb | |
87 shift | |
88 ;; | |
89 -gud) | |
90 MODE=gud | |
91 shift | |
92 ;; | |
93 -dbx) | |
94 MODE=dbx | |
95 shift | |
96 ;; | |
97 -valgrind) | |
98 MODE=valgrind | |
99 shift | |
100 ;; | |
101 *) | |
102 MODE=run | |
103 ;; | |
104 esac | |
105 | |
10277 | 106 if [ "${ALT_JAVA_HOME}" != "" ]; then |
107 JDK=${ALT_JAVA_HOME%%/jre} | |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
108 else |
10277 | 109 JDK=@@JDK_IMPORT_PATH@@ |
1985 | 110 fi |
111 | |
14317
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
112 if [ "${JDK}" != "" ]; then |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
113 case "$OS" in |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
114 CYGWIN*) |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
115 JDK=`cygpath -m "$JDK"` |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
116 ;; |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
117 esac |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
118 |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
119 else |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
120 echo "Failed to find JDK." \ |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
121 "Either ALT_JAVA_HOME is not set or JDK_IMPORT_PATH is empty." |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
122 exit 1 |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1985
diff
changeset
|
123 fi |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1985
diff
changeset
|
124 |
1985 | 125 # We will set the LD_LIBRARY_PATH as follows: |
126 # o $JVMPATH (directory portion only) | |
127 # o $JRE/lib/$ARCH | |
128 # followed by the user's previous effective LD_LIBRARY_PATH, if | |
129 # any. | |
130 JRE=$JDK/jre | |
131 JAVA_HOME=$JDK | |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
132 export JAVA_HOME |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
133 |
1985 | 134 ARCH=@@LIBARCH@@ |
135 SBP=${MYDIR}:${JRE}/lib/${ARCH} | |
136 | |
137 | |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
138 # Set up a suitable LD_LIBRARY_PATH or DYLD_LIBRARY_PATH |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
139 if [ "${OS}" = "Darwin" ] |
1985 | 140 then |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
141 if [ -z "$DYLD_LIBRARY_PATH" ] |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
142 then |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
143 DYLD_LIBRARY_PATH="$SBP" |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
144 else |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
145 DYLD_LIBRARY_PATH="$SBP:$DYLD_LIBRARY_PATH" |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
146 fi |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
147 export DYLD_LIBRARY_PATH |
1985 | 148 else |
6626
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
149 # not 'Darwin' |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
150 if [ -z "$LD_LIBRARY_PATH" ] |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
151 then |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
152 LD_LIBRARY_PATH="$SBP" |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
153 else |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
154 LD_LIBRARY_PATH="$SBP:$LD_LIBRARY_PATH" |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
155 fi |
be82ef218872
7192916: Hotspot development launcher should use DYLD_LIBRARY_PATH on OS X
sla
parents:
3991
diff
changeset
|
156 export LD_LIBRARY_PATH |
1985 | 157 fi |
158 | |
14317
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
159 JPARMS="-XXaltjvm=$MYDIR -Dsun.java.launcher.is_altjvm=true $@ $JAVA_ARGS"; |
1985 | 160 |
10277 | 161 # Locate the java launcher |
162 LAUNCHER=$JDK/bin/java | |
1985 | 163 if [ ! -x $LAUNCHER ] ; then |
10277 | 164 echo Error: Cannot find the java launcher \"$LAUNCHER\" |
1985 | 165 exit 1 |
166 fi | |
167 | |
168 GDBSRCDIR=$MYDIR | |
3991
3f24f946bc2d
7099454: /bin/sh does not support syntax used in the src/os/posix/launcher/launcher.script shell script
brutisso
parents:
3960
diff
changeset
|
169 BASEDIR=`cd $MYDIR/../../.. && pwd` |
14317
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
170 case "$OS" in |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
171 CYGWIN*) |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
172 BASEDIR=`cygpath -m "$BASEDIR"` |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
173 ;; |
b59507f713e0
8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
rdurbin
parents:
14223
diff
changeset
|
174 esac |
1985 | 175 |
176 init_gdb() { | |
177 # Create a gdb script in case we should run inside gdb | |
178 GDBSCR=/tmp/hsl.$$ | |
179 rm -f $GDBSCR | |
180 cat >>$GDBSCR <<EOF | |
181 cd `pwd` | |
182 handle SIGUSR1 nostop noprint | |
183 handle SIGUSR2 nostop noprint | |
184 set args $JPARMS | |
185 file $LAUNCHER | |
186 directory $GDBSRCDIR | |
187 # Get us to a point where we can set breakpoints in libjvm.so | |
10277 | 188 set breakpoint pending on |
189 break JNI_CreateJavaVM | |
1985 | 190 run |
10277 | 191 # Stop in JNI_CreateJavaVM |
1985 | 192 delete 1 |
193 # We can now set breakpoints wherever we like | |
194 EOF | |
195 } | |
196 | |
197 | |
198 case "$MODE" in | |
199 gdb) | |
200 init_gdb | |
201 $GDB -x $GDBSCR | |
202 rm -f $GDBSCR | |
203 ;; | |
204 gud) | |
205 init_gdb | |
206 # First find out what emacs version we're using, so that we can | |
207 # use the new pretty GDB mode if emacs -version >= 22.1 | |
3991
3f24f946bc2d
7099454: /bin/sh does not support syntax used in the src/os/posix/launcher/launcher.script shell script
brutisso
parents:
3960
diff
changeset
|
208 case `$EMACS -version 2> /dev/null` in |
1985 | 209 *GNU\ Emacs\ 2[23]*) |
210 emacs_gud_cmd="gdba" | |
211 emacs_gud_args="--annotate=3" | |
212 ;; | |
213 *) | |
214 emacs_gud_cmd="gdb" | |
215 emacs_gud_args= | |
216 ;; | |
217 esac | |
218 $EMACS --eval "($emacs_gud_cmd \"$GDB $emacs_gud_args -x $GDBSCR\")"; | |
219 rm -f $GDBSCR | |
220 ;; | |
221 dbx) | |
10277 | 222 $DBX -s $HOME/.dbxrc -c "loadobject -load libjvm.so; stop in JNI_CreateJavaVM; run $JPARMS; delete all" $LAUNCHER |
1985 | 223 ;; |
224 valgrind) | |
225 echo Warning: Defaulting to 16Mb heap to make Valgrind run faster, use -Xmx for larger heap | |
226 echo | |
227 $VALGRIND --tool=memcheck --leak-check=yes --num-callers=50 $LAUNCHER -Xmx16m $JPARMS | |
228 ;; | |
229 run) | |
230 LD_PRELOAD=$PRELOADING exec $LAUNCHER $JPARMS | |
231 ;; | |
232 *) | |
233 echo Error: Internal error, unknown launch mode \"$MODE\" | |
234 exit 1 | |
235 ;; | |
236 esac | |
237 RETVAL=$? | |
238 exit $RETVAL |