jdk/test/com/sun/jdi/DeoptimizeWalk.sh
changeset 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 #!/bin/sh
       
     2 
       
     3 #
       
     4 # Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
       
     5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     6 #
       
     7 # This code is free software; you can redistribute it and/or modify it
       
     8 # under the terms of the GNU General Public License version 2 only, as
       
     9 # published by the Free Software Foundation.
       
    10 #
       
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14 # version 2 for more details (a copy is included in the LICENSE file that
       
    15 # accompanied this code).
       
    16 #
       
    17 # You should have received a copy of the GNU General Public License version
       
    18 # 2 along with this work; if not, write to the Free Software Foundation,
       
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20 #
       
    21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22 # CA 95054 USA or visit www.sun.com if you need additional information or
       
    23 # have any questions.
       
    24 #
       
    25 
       
    26 #  @test
       
    27 #  @bug 4525714
       
    28 #  @summary jtreg test PopAsynchronousTest fails in build 85 with -Xcomp
       
    29 #  @author Jim Holmlund/Swamy Venkataramanappa
       
    30 #  @run shell DeoptimizeWalk.sh
       
    31 
       
    32 #  This is another test of the same bug.  The bug occurs when trying
       
    33 #  to walk the stack of a deoptimized thread.  We can do this
       
    34 #  by running in -Xcomp mode and by doing a step which causes deopt,
       
    35 #  and then a 'where'.  This will cause not all the frames to be shown.
       
    36 
       
    37 compileOptions=-g
       
    38 
       
    39 echo "*********** This test only fails with -Xcomp ***************"
       
    40 createJavaFile()
       
    41 {
       
    42     cat <<EOF > $1.java.1
       
    43 
       
    44 public class $1 {
       
    45     static public void main(String[] args) {
       
    46        $1 mine = new $1();
       
    47        mine.a1(89);
       
    48     }
       
    49 
       
    50     public void a1(int p1) {
       
    51       int v1 = 89;
       
    52       System.out.println("a1" + v1);
       
    53       a2(89);
       
    54     }
       
    55 
       
    56 
       
    57     public void a2(int pp) {
       
    58       int v2 = 89;
       
    59       System.out.println("a2" + v2);
       
    60       a3(89);
       
    61     }
       
    62 
       
    63     public void a3(int pp) {
       
    64       int v3 = 89;
       
    65       System.out.println("a3");  //@ 1 breakpoint
       
    66       a4(22);                  // it passes if this line is commented out
       
    67       System.out.println("jj");
       
    68     }
       
    69     
       
    70     public void a4(int pp) {
       
    71       int v4 = 90;
       
    72       System.out.println("a4: @1 breakpoint here");
       
    73     }
       
    74 }
       
    75 EOF
       
    76 }
       
    77 
       
    78 # This is called to feed cmds to jdb.
       
    79 dojdbCmds()
       
    80 {
       
    81     setBkpts @1
       
    82     runToBkpt @1
       
    83     cmd where
       
    84     #cmd next
       
    85     cmd step
       
    86     cmd where
       
    87     cmd quit
       
    88     jdbFailIfNotPresent "shtest\.main" 3
       
    89 }
       
    90 
       
    91 
       
    92 mysetup()
       
    93 {
       
    94     if [ -z "$TESTSRC" ] ; then
       
    95         TESTSRC=.
       
    96     fi
       
    97 
       
    98     for ii in . $TESTSRC $TESTSRC/.. ; do
       
    99         if [ -r "$ii/ShellScaffold.sh" ] ; then
       
   100             . $ii/ShellScaffold.sh 
       
   101             break
       
   102         fi
       
   103     done
       
   104 }
       
   105 
       
   106 # You could replace this next line with the contents
       
   107 # of ShellScaffold.sh and this script will run just the same.
       
   108 mysetup
       
   109 
       
   110 runit
       
   111 debuggeeFailIfPresent "Internal exception:"
       
   112 pass