/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4270488 4787861
* @author Gordon Hirsch
*
* @run build TestScaffold VMConnection TargetAdapter TargetListener
* @run compile -g MethodCalls.java
* @run compile -g MethodCallsReflection.java
* @run compile -g ControlFlow.java
* @run build StepTest
*
* @summary StepTest starts at a method named "go()" in the debuggee and
* repetitively steps. It will do a step into until the maximum
* stack depth (specified on command line) is reached. At that point
* it begins to step over. Step granularity is determined from the
* command line. Stepping is repeated the until the end of go() is reached
* or until the requested number of steps (specified on command line)
* is performed. An exception is thrown if the requested number of
* steps does not result in the debuggee's location being at the end of
* go().
* This test is sensitive to the line number info generated by the compiler
* for the debuggee files- MethodCalls.java, ...
* See LineNumberInfo.java for more info.
*
* +--- maximum stack depth in debuggee
* | +--- step granularity: "line" or "min"
* | | +---Expected number of steps
* | | | +--- Debuggee command Line
* V V V V Workaround-----+
* V
* @run main StepTest 2 line 2 MethodCalls
* @run main StepTest 3 line 14 MethodCalls
*
* @run main StepTest 2 line 18 MethodCallsReflection 12
*
* @run main StepTest 2 min 4 MethodCalls
* @run main StepTest 3 min 43 MethodCalls
*
* @run main StepTest 2 line 65 ControlFlow 64
*/
/*
* The workaround column contains the expected number of steps
* on non IA64 VMs. These VMs get it wrong and should be
* fixed (4787861). When they are fixed, this test should be fixed
* to remove this workaround.
* The C interpreter in the IA64 VM handles catches differently
* than the asm interpreter. For the construct
* line statement
* -----------------
* 68 catch (Exception ee) {
* 69 System.out.println(...)
* javac outputs the store into ee as being on line 68 and the
* start of the println on line 69. The handler starts with the
* store into ee, ie, line 68. When a step is done under the
* associated try and an exception is encountered,
* the IA64 VM stops at line 68 while the other VM stops at
* line 69. It seems that the IA64 VM is correct.
* But, it is too late to fix the other VM for Mantis,
* so this test is being made so that it will pass both VMs.
* For each catch that occurs, an extra step is needed
* on the IA64 VM. This only occurs in MethodCallsReflection
* which contains 6 of these catches (so we have to do 6
* extra steps to make it pass) and in ControlFlow which
* does it once.
*
*/
int maxDepth;
int expectedCount;
boolean lastStepNeeded = true;
}
super(args);
}
}
// Skip test args
for (int i = 0; i < expectedCount; i++) {
} else {
}
} else {
} else {
}
}
thread.frameCount());
// We have stepped one step too far. If we did exactly
// the 'workaround' number of steps, then this is in all
// likelihood the non IA64 VM. So, stop.
if (i == workaroundCount) {
lastStepNeeded = false;
break;
}
// Gone too far, past return of go()
throw new Exception("Stepped too far");
}
}
// Not far enough
}
if (lastStepNeeded) {
// One last step takes us out of go()
}
// Gone too far
}
// Allow application to complete
if (!testFailed) {
println("StepTest: passed");
} else {
throw new Exception("StepTest: failed");
}
}
}