RedefineStep.sh revision 0
340N/A#!/bin/sh
340N/A
340N/A#
340N/A# Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
340N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
340N/A#
340N/A# This code is free software; you can redistribute it and/or modify it
340N/A# under the terms of the GNU General Public License version 2 only, as
340N/A# published by the Free Software Foundation.
340N/A#
340N/A# This code is distributed in the hope that it will be useful, but WITHOUT
340N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
340N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
340N/A# version 2 for more details (a copy is included in the LICENSE file that
340N/A# accompanied this code).
340N/A#
340N/A# You should have received a copy of the GNU General Public License version
340N/A# 2 along with this work; if not, write to the Free Software Foundation,
340N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
340N/A#
1043N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
340N/A# CA 95054 USA or visit www.sun.com if you need additional information or
1043N/A# have any questions.
340N/A#
340N/A
682N/A# @test
340N/A# @bug 4689395
340N/A# @summary "step over" after a class is redefined acts like "step out"
340N/A# @author Jim Holmlund
420N/A# @run shell RedefineStep.sh
682N/A#
682N/A
1043N/A#pkg=untitled7
340N/Aclassname=gus1
340N/AcompileOptions=-g
394N/A#java=java_g
394N/A
394N/A# Uncomment this to see the JDI trace
394N/A#jdbOptions=-dbgtrace
459N/A
394N/AcreateJavaFile()
394N/A{
340N/A cat <<EOF > $1.java.1
394N/A
394N/Apublic class $1 {
1035N/A static int counter;
394N/A static public void main(String[] args) {
340N/A $1 mine = new $1();
340N/A mine.a1(10);
340N/A System.out.println("done"); // should not see this
340N/A }
1043N/A
1195N/A public void a1(int p1) {
1043N/A System.out.println("jj0"); // @1 breakpoint line 10
1043N/A a2();
340N/A System.out.println("jj3"); // @1 delete
340N/A }
340N/A public void a2() {
340N/A System.out.println("a2");
340N/A }
340N/A}
689N/AEOF
682N/A}
340N/A
340N/A# This is called to feed cmds to jdb.
340N/AdojdbCmds()
682N/A{
682N/A setBkpts @1
682N/A runToBkpt @1
682N/A redefineClass @1
682N/A
689N/A cmd next
682N/A cmd next
682N/A cmd next
689N/A cmd next
682N/A cmd next
689N/A}
682N/A
682N/A
682N/Amysetup()
707N/A{
682N/A if [ -z "$TESTSRC" ] ; then
682N/A TESTSRC=.
1195N/A fi
682N/A
682N/A for ii in . $TESTSRC $TESTSRC/.. ; do
682N/A if [ -r "$ii/ShellScaffold.sh" ] ; then
340N/A . $ii/ShellScaffold.sh
434N/A break
340N/A fi
340N/A done
682N/A}
682N/A
682N/A# You could replace this next line with the contents
682N/A# of ShellScaffold.sh and this script will run just the same.
682N/Amysetup
682N/A
682N/Arunit
682N/A
682N/AjdbFailIfPresent 'should not see this'
682N/Apass
682N/A