jdk/test/com/sun/jdi/RedefineException.sh
author ihse
Tue, 09 May 2017 12:57:30 +0200
changeset 45028 b0ea3c0bfb81
parent 32018 91c91b3d50a0
permissions -rw-r--r--
8179889: Fix typographic errors in copyright headers Reviewed-by: erikj, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
45028
b0ea3c0bfb81 8179889: Fix typographic errors in copyright headers
ihse
parents: 32018
diff changeset
     4
# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#  @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#  @bug 4559100
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#  @summary The VM crashes when a method in a redefined class throws an exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#  @author Jim Holmlund
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#
32018
91c91b3d50a0 8132094: Mark intermittently failuring core-svc tests
ykantser
parents: 31909
diff changeset
    31
#  @key intermittent
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#  @run shell RedefineException.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
# This is another symptomm of 4559100
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
# This causes a bus error on solsparc:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#  ---- called from signal handler with signal 10 (SIGBUS) ------
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#  [11] constantPoolOopDesc::klass_at_if_loaded(0xffbed4d8, 0x16, 0xffbed5cc, 0x0, 0x1, 0xfa40b330), at 0xfe11568c
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#  [12] methodOopDesc::fast_exception_handler_bci_for(0x6, 0x1, 0xfe400a0c, 0x0, 0x2d1f0, 0x0), at 0xfe12e620
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#  [13] jvmdi::post_exception_throw_event(0x2d1f0, 0xf61036f8, 0xf6103752, 0xf20414a8, 0x2e2928, 0xfe12e190), at 0xfe2a4fa4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
# These are variables that can be set to control execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
createJavaFile()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    cat <<EOF > $1.java.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
public class $1 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    String str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    int ii;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    static public void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
       System.out.println("In Main");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
       $1 mine = new $1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
       mine.a1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    public void a1() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
      int a1local = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
      String a1string = "a1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
      ii = 89;                                 // @1 delete this line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
      str = "foo";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
      System.out.println("a1: Calling the original a2/a3.  'The @@@ deleted lines should appear");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
      System.out.println("ii = " + ii);        // @1 delete this line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
      a2();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    public void a2() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
      int a2local = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
      String a2string = "a2";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
      //System.out.println("a2: @ @@delete this line");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
      try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        a3();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
      } catch (Exception ee) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        System.out.println("a2: Exception caught");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
      System.out.println("a2: done");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    }
45028
b0ea3c0bfb81 8179889: Fix typographic errors in copyright headers
ihse
parents: 32018
diff changeset
    78
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public void a3() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
      int a3local = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
      String a3string = "a3";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
      System.out.println("a3: @@ delete this line");   // If this line is deleted, the test passes!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
      System.out.println("a3: @1 breakpoint here a3");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
      throw new Exception("This is the exception");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
EOF
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
dojdbCmds()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    setBkpts @1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    runToBkpt
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    redefineClass @1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    cmd pop
23046
0b0407b1e2a5 6946101: ShellScaffold.sh based tests can issue "write error: Broken pipe" messages
iignatyev
parents: 5506
diff changeset
    96
    cmd allowExit cont
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
mysetup()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    if [ -z "$TESTSRC" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        TESTSRC=.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    for ii in . $TESTSRC $TESTSRC/.. ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        if [ -r "$ii/ShellScaffold.sh" ] ; then
45028
b0ea3c0bfb81 8179889: Fix typographic errors in copyright headers
ihse
parents: 32018
diff changeset
   108
            . $ii/ShellScaffold.sh
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            break
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
# You could replace this next line with the contents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
# of ShellScaffold.sh and this script will run just the same.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
mysetup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
runit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
pass