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 4546478
28#  @summary Enabling a watchpoint can kill following NotifyFramePops
29#  @author Jim Holmlund
30#
31#  @run shell WatchFramePop.sh
32
33# These are variables that can be set to control execution
34
35#pkg=untitled7
36#classname=Untitled3
37#compileOptions=-g
38#java="java_g"
39
40createJavaFile()
41{
42    cat <<EOF > $1.java.1
43
44public class $1 {
45    int watchMe;
46    static public void main(String[] args) {
47       System.out.println("In Main");
48       $1 mine = new $1();
49       mine.a1();
50       System.out.println("Test completed");
51    }
52
53    public void a1() {
54      a2();                            // @1 breakpoint. We'll do a watch of watchMe here
55    }
56
57    public void a2() {
58      System.out.println("in a2");
59      a3();
60    }                                  // line 18
61
62    public void a3() {
63      System.out.println("in a3");     // After the watch, we'll run to here, line 21
64      a4();                            // We'll do a 'next' to here.  The failure is that this
65    }                                  // runs to completion, or asserts with java_g
66                                       
67
68    public void a4() {
69      System.out.println("in a4");
70    }
71
72}
73EOF
74}
75
76# drive jdb by sending cmds to it and examining its output
77dojdbCmds()
78{
79    setBkpts @1
80    runToBkpt @1
81    cmd watch  shtest.watchMe
82    cmd stop in shtest.a3   # bkpt at line 17
83    contToBkpt              # stops at the bkpt at 
84    cmd next                # The bug is that this next runs to completion
85                            # In which case, so does jdb
86                            # so we never get here.
87}
88
89
90mysetup()
91{
92    if [ -z "$TESTSRC" ] ; then
93        TESTSRC=.
94    fi
95
96    for ii in . $TESTSRC $TESTSRC/.. ; do
97        if [ -r "$ii/ShellScaffold.sh" ] ; then
98            . $ii/ShellScaffold.sh 
99            break
100        fi
101    done
102}
103
104# You could replace this next line with the contents
105# of ShellScaffold.sh and this script will run just the same.
106mysetup
107
108runit
109jdbFailIfPresent 'The application exited'
110pass
111