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 4622663 28 # @key intermittent 29 # @summary redefine and pop top frame from jdb gets assertion failure. 30 # The failure occurs with debug java when the pop deletes the 31 # line that called the method which is being popped. 32 # @author Jim Holmlund/Swamy Venkataramanappa 33 # 34 # @run shell RedefinePop.sh 35 36 37 # assert(index<len, "should have found method") 38 # [8] report_assertion_failure(0xfe2a54d9, 0xfe2a54e3, 0x2cc, 0xfe2a5527, 0xfffffff8, 0x3f2b8), at 0xfda1e5e8 39 # [9] methodOopDesc::jni_id(0xf590a2f0, 0x3e868, 0x8, 0xffbed760, 0xf590a3ac, 0xffbed664), at 0xfdcd7a2c 40 # [10] JvmdiThreadState::compare_and_set_current_location(0x3f450, 0xf590a2f0, 0xf590a33f, 0x1, 0x1, 0x3e868), at 0xfdc0f670 41 # [11] jvmdi::at_single_stepping_point(0x3e868, 0xf590a2f0, 0xf590a33f, 0x5, 0x0, 0x0), at 0xfdc29184 42 # [12] InterpreterRuntime::at_safepoint(0x3e868, 0xb6, 0x2, 0xf9c28744, 0xf590a038, 0xffbed880), at 0xfdb0d590 43 44 # These are variables that can be set to control execution 45 46 compileOptions=-g 47 48 createJavaFile() 49 { 50 cat <<EOF > $1.java.1 51 52 public class $1 { 53 static public void main(String[] args) { 54 $1 mine = new $1(); 55 mine.a1(44); // @1 delete the call that we are in when the pop occurs 56 mine.a4(); 57 } 58 59 public void a1(int p1) { 60 System.out.println("a1: @1 breakpoint here"); 61 } 62 63 public void a4() { 64 System.out.println("a4: The next line should not say Ni!"); 65 System.out.println("a4: Ni!"); // @1 delete 66 } 67 } 68 EOF 69 } 70 71 # This is called to feed cmds to jdb. 72 dojdbCmds() 73 { 74 setBkpts @1 75 runToBkpt @1 76 redefineClass @1 77 cmd pop 78 cmd allowExit cont 79 } 80 81 82 mysetup() 83 { 84 if [ -z "$TESTSRC" ] ; then 85 TESTSRC=. 86 fi 87 88 for ii in . $TESTSRC $TESTSRC/.. ; do 89 if [ -r "$ii/ShellScaffold.sh" ] ; then 90 . $ii/ShellScaffold.sh 91 break 92 fi 93 done 94 } 95 96 # You could replace this next line with the contents 97 # of ShellScaffold.sh and this script will run just the same. 98 mysetup 99 100 runit 101 debuggeeFailIfPresent "Internal exception:" 102 pass