RedefineTTYLineNumber.sh revision 0
1178N/A#!/bin/sh
0N/A
0N/A#
0N/A# Copyright 2002-2003 Sun Microsystems, Inc. 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#
1178N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1178N/A# CA 95054 USA or visit www.sun.com if you need additional information or
1178N/A# have any questions.
0N/A#
0N/A
1178N/A# @test
1178N/A# @bug 4660756
0N/A# @summary TTY: Need to clear source cache after doing a redefine class
1178N/A# @author Jim Holmlund
0N/A# @run shell/timeout=240 RedefineTTYLineNumber.sh
0N/A
0N/A#set -x
1178N/A# These are variables that can be set to control execution
0N/A
1178N/A#pkg=untitled7
1178N/A#classname=Untitled3
0N/AcompileOptions=-g
0N/A#java=java_g
0N/A
0N/AcreateJavaFile()
0N/A{
0N/A cat <<EOF > $1.java.1
1178N/A
0N/Apublic class $1 {
0N/A
0N/A public void B() {
0N/A System.out.println("in B");
1178N/A System.out.println("in B: @1 delete");
1178N/A }
1178N/A
0N/A // line number sensitive!!! Next line must be line 10.
1178N/A public void A() {
0N/A System.out.println("in A, about to call B"); // 11 before, 10 afterward
0N/A System.out.println("out from B");
1178N/A }
0N/A
1178N/A public static void main(String[] args) {
0N/A $1 untitled41 = new $1();
0N/A untitled41.A();
0N/A System.out.println("done");
1178N/A }
0N/A}
0N/AEOF
1178N/A}
0N/A
0N/A# This is called to feed cmds to jdb.
1178N/AdojdbCmds()
0N/A{
0N/A cmd stop in shtest.A
1178N/A runToBkpt
1178N/A #jdbFailIfNotPresent "System\.out\.println" 3
1178N/A redefineClass @1
0N/A cmd pop
0N/A cmd stop in shtest.A
0N/A contToBkpt
0N/A #jdbFailIfNotPresent "System\.out\.println" 3
0N/A cmd quit
0N/A
0N/A}
mysetup()
{
if [ -z "$TESTSRC" ] ; then
TESTSRC=.
fi
if [ -r $TESTSRC/ShellScaffold.sh ] ; then
. $TESTSRC/ShellScaffold.sh
elif [ -r $TESTSRC/../ShellScaffold.sh ] ; then
. $TESTSRC/../ShellScaffold.sh
fi
}
# You could replace this next line with the contents
# of ShellScaffold.sh and this script will run just the same.
mysetup
runit
debuggeeFailIfPresent "Internal exception:"
pass