/*
* 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 6517249
* @ignore 6951287
* @summary JDWP: Cannot do an invokeMethod after a popFrames operation
*
* @author jjh
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g PopAndInvokeTest.java
* @run main PopAndInvokeTest
*/
class PopAndInvokeTarg {
static boolean waiting = false;
public static void A() {
}
public static void invokeee() {
}
public static void waiter() {
if (waiting) {
return;
}
waiting = true;
while (true) {
}
}
/*
* Debugger will bkpt in A, popFrames back to here
* and then do an invokeMethod on invokeee.
* This should work.
*/
A();
/*
* Debugger will resume and we will enter
* waiter(). Debugger will then do a suspend,
* a popFrames back to here, and an invoke
* which should fail.
*/
waiter();
}
}
/********** test program **********/
super(args);
}
}
return frame;
}
}
return null;
}
/********** test core **********/
/*
* Get to the top of main()
* to determine targetClass and mainThread
*/
runOnce();
}
/*
* Verify that an invokeMethod works ok after a popFrames
* in a thread suspended by an event.
*/
try {
new ArrayList(), 0);
}
/*
* Verify that an invokeMethod gets an IncompatibleThreadStateException
* after a popFrames in a thread that is _not_ suspended by an event.
*/
while (true) {
// Wait until debuggee enters the 'waiting' method.
try {
} catch (InterruptedException ee) {
}
continue;
}
// debuggee has entered the waiting method
try {
new ArrayList(), 0);
} catch (IncompatibleThreadStateException ee) {
break;
break;
}
failure("FAIL: Did not get IncompatibleThreadStateException " +
"when debuggee is not suspended by an event");
}
if (testFailed) {
throw new Exception("PopAndInvokeTest failed");
}
}
}