0N/A#!/bin/sh
0N/A
0N/A#
2362N/A# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
0N/A#
0N/A
0N/A# @test
0N/A# @bug 4559100
0N/A# @summary The VM crashes when a method in a redefined class throws an exception.
0N/A# @author Jim Holmlund
0N/A#
0N/A# @run shell RedefineException.sh
0N/A
0N/A# This is another symptomm of 4559100
0N/A# This causes a bus error on solsparc:
0N/A# ---- called from signal handler with signal 10 (SIGBUS) ------
0N/A# [11] constantPoolOopDesc::klass_at_if_loaded(0xffbed4d8, 0x16, 0xffbed5cc, 0x0, 0x1, 0xfa40b330), at 0xfe11568c
0N/A# [12] methodOopDesc::fast_exception_handler_bci_for(0x6, 0x1, 0xfe400a0c, 0x0, 0x2d1f0, 0x0), at 0xfe12e620
0N/A# [13] jvmdi::post_exception_throw_event(0x2d1f0, 0xf61036f8, 0xf6103752, 0xf20414a8, 0x2e2928, 0xfe12e190), at 0xfe2a4fa4
0N/A
0N/A# These are variables that can be set to control execution
0N/A
0N/AcreateJavaFile()
0N/A{
0N/A cat <<EOF > $1.java.1
0N/A
0N/Apublic class $1 {
0N/A String str;
0N/A int ii;
0N/A static public void main(String[] args) {
0N/A System.out.println("In Main");
0N/A $1 mine = new $1();
0N/A mine.a1();
0N/A }
0N/A
0N/A public void a1() {
0N/A int a1local = 1;
0N/A String a1string = "a1";
0N/A
0N/A ii = 89; // @1 delete this line
0N/A str = "foo";
0N/A System.out.println("a1: Calling the original a2/a3. 'The @@@ deleted lines should appear");
0N/A System.out.println("ii = " + ii); // @1 delete this line
0N/A a2();
0N/A }
0N/A
0N/A public void a2() {
0N/A int a2local = 2;
0N/A String a2string = "a2";
0N/A //System.out.println("a2: @ @@delete this line");
0N/A try {
0N/A a3();
0N/A } catch (Exception ee) {
0N/A System.out.println("a2: Exception caught");
0N/A }
0N/A System.out.println("a2: done");
0N/A }
0N/A
0N/A public void a3() throws Exception {
0N/A int a3local = 3;
0N/A String a3string = "a3";
0N/A System.out.println("a3: @@ delete this line"); // If this line is deleted, the test passes!
0N/A System.out.println("a3: @1 breakpoint here a3");
0N/A throw new Exception("This is the exception");
0N/A }
0N/A}
0N/AEOF
0N/A}
0N/A
0N/AdojdbCmds()
0N/A{
0N/A setBkpts @1
0N/A runToBkpt
0N/A redefineClass @1
0N/A cmd pop
0N/A cmd cont
0N/A cmd quit
0N/A}
0N/A
0N/A
0N/Amysetup()
0N/A{
0N/A if [ -z "$TESTSRC" ] ; then
0N/A TESTSRC=.
0N/A fi
0N/A
0N/A for ii in . $TESTSRC $TESTSRC/.. ; do
0N/A if [ -r "$ii/ShellScaffold.sh" ] ; then
0N/A . $ii/ShellScaffold.sh
0N/A break
0N/A fi
0N/A done
0N/A}
0N/A
0N/A# You could replace this next line with the contents
0N/A# of ShellScaffold.sh and this script will run just the same.
0N/Amysetup
0N/A
0N/Arunit
0N/Apass