1#!/bin/sh
2
3#
4# Copyright (c) 2002, 2014, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# 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#  @key intermittent
31#  @run shell DeoptimizeWalk.sh
32
33#  This is another test of the same bug.  The bug occurs when trying
34#  to walk the stack of a deoptimized thread.  We can do this
35#  by running in -Xcomp mode and by doing a step which causes deopt,
36#  and then a 'where'.  This will cause not all the frames to be shown.
37
38compileOptions=-g
39
40echo "*********** This test only fails with -Xcomp ***************"
41createJavaFile()
42{
43    cat <<EOF > $1.java.1
44
45public class $1 {
46    static public void main(String[] args) {
47       $1 mine = new $1();
48       mine.a1(89);
49    }
50
51    public void a1(int p1) {
52      int v1 = 89;
53      System.out.println("a1" + v1);
54      a2(89);
55    }
56
57
58    public void a2(int pp) {
59      int v2 = 89;
60      System.out.println("a2" + v2);
61      a3(89);
62    }
63
64    public void a3(int pp) {
65      int v3 = 89;
66      System.out.println("a3");  //@ 1 breakpoint
67      a4(22);                  // it passes if this line is commented out
68      System.out.println("jj");
69    }
70
71    public void a4(int pp) {
72      int v4 = 90;
73      System.out.println("a4: @1 breakpoint here");
74    }
75}
76EOF
77}
78
79# This is called to feed cmds to jdb.
80dojdbCmds()
81{
82    setBkpts @1
83    runToBkpt @1
84    cmd where
85    #cmd next
86    cmd step
87    cmd where
88}
89
90
91mysetup()
92{
93    if [ -z "$TESTSRC" ] ; then
94        TESTSRC=.
95    fi
96
97    for ii in . $TESTSRC $TESTSRC/.. ; do
98        if [ -r "$ii/ShellScaffold.sh" ] ; then
99            . $ii/ShellScaffold.sh
100            break
101        fi
102    done
103}
104
105# You could replace this next line with the contents
106# of ShellScaffold.sh and this script will run just the same.
107mysetup
108
109runit
110jdbFailIfNotPresent "shtest\.main" 3
111debuggeeFailIfPresent "Internal exception:"
112pass
113