8357172: Extend try block in nsk/jdi tests to capture exceptions thrown by Debuggee.classByName()

Reviewed-by: lmesnik, sspitsyn
This commit is contained in:
Chris Plummer 2025-05-30 20:14:14 +00:00
parent c9d6e01233
commit 14e41ab055
22 changed files with 318 additions and 372 deletions

View File

@ -112,19 +112,19 @@ public class invokemethod009 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
ClassType clsType = (ClassType) rType;

View File

@ -111,36 +111,29 @@ public class invokemethod010 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: unable to suspend debuggee thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
try {
Thread.currentThread().sleep(TIMEOUT_DELTA);
} catch(InterruptedException ie) {
ie.printStackTrace();
log.complain("TEST FAILED: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: unable to suspend debuggee thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
Thread.currentThread().sleep(TIMEOUT_DELTA);
}
// debuggee main class
ClassType clsType = (ClassType) rType;

View File

@ -113,20 +113,20 @@ public class invokemethod014 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
for (int i=0; i<METH_NUM; i++) {

View File

@ -95,37 +95,30 @@ public class newinstance009 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
ThreadReference thrRef = debuggee.threadByFieldName(rType, "thread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: unable to suspend debuggee thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
try {
Thread.currentThread().sleep(DELAY);
} catch(InterruptedException ie) {
ie.printStackTrace();
log.complain("TEST FAILED: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
ThreadReference thrRef = debuggee.threadByFieldName(rType, "thread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: unable to suspend debuggee thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
Thread.currentThread().sleep(DELAY);
}
List methList = rType.methodsByName("<init>");
if (methList.isEmpty()) {
log.complain("TEST FAILURE: the expected constructor "

View File

@ -124,18 +124,18 @@ public class invokemethod002 {
return quitDebuggee();
}
rType[0] = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
try {
rType[0] = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
findObjRef(DEBUGGEE_LOCALVAR);
rType[1] = objRef[1].referenceType(); // debuggee dummy class

View File

@ -135,24 +135,24 @@ public class invokemethod003 {
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
// debuggee dummy interface
rType[1] = debuggee.classByName(DEBUGGEE_INTERFACE);
// debuggee dummy abstract class
rType[2] = debuggee.classByName(DEBUGGEE_ABSTRACTCLASS);
try {
ReferenceType[] rType = new ReferenceType[3];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
// debuggee dummy interface
rType[1] = debuggee.classByName(DEBUGGEE_INTERFACE);
// debuggee dummy abstract class
rType[2] = debuggee.classByName(DEBUGGEE_ABSTRACTCLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR);

View File

@ -111,36 +111,29 @@ public class invokemethod004 {
return quitDebuggee();
}
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
try {
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: unable to suspend debuggee thread");
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
try {
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: unable to suspend debuggee thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
Thread.currentThread().sleep(1000);
} catch(InterruptedException ie) {
ie.printStackTrace();
log.complain("TEST FAILED: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
// Check the tested assersion
try {
ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR);
ReferenceType rType = objRef.referenceType(); // debuggee dummy class

View File

@ -113,20 +113,20 @@ public class invokemethod005 {
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
try {
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR);
rType[1] = objRef.referenceType(); // debuggee dummy class

View File

@ -111,20 +111,20 @@ public class invokemethod006 {
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
try {
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR);
rType[1] = objRef.referenceType(); // debuggee dummy class

View File

@ -127,20 +127,20 @@ public class invokemethod007 {
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
try {
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR);
rType[1] = objRef.referenceType(); // debuggee dummy class

View File

@ -120,22 +120,22 @@ public class invokemethod008 {
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// reference types of debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
try {
ReferenceType[] rType = new ReferenceType[3];
// reference types of debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR);

View File

@ -120,22 +120,22 @@ public class invokemethod009 {
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// reference types of debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
try {
ReferenceType[] rType = new ReferenceType[3];
// reference types of debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(DEBUGGEE_LOCALVAR);
LinkedList<Value> argList = new LinkedList<Value>();

View File

@ -143,23 +143,23 @@ public class invokemethod014 {
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
try {
ReferenceType[] rType = new ReferenceType[3];
// debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
ThreadReference thrRef =
debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ThreadReference thrRef =
debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);
objRef = findObjRef(thrRef, DEBUGGEE_LOCALVAR);

View File

@ -109,35 +109,29 @@ public class setvalue002 {
return quitDebuggee();
}
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
try {
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee's thread");
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee's thread suspension ...");
try {
thrRef.suspend();
while (!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee's thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee's thread suspension ...");
Thread.currentThread().sleep(1000);
} catch(InterruptedException ie) {
log.complain("TEST FAILED: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
// Check the tested assersion
try {
findObjRefs(DEBUGGEE_LOCALVAR);
rType[0] = objRef[0].referenceType();
rType[1] = objRef[1].referenceType();

View File

@ -142,36 +142,29 @@ public class setvalue003 {
return quitDebuggee();
}
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
try {
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee's thread");
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee's thread suspension ...");
try {
thrRef.suspend();
while (!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee's thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee's thread suspension ...");
Thread.sleep(1000);
} catch(InterruptedException ie) {
ie.printStackTrace();
log.complain("TEST FAILED: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
// Check the tested assertion
try {
objRef = findObjRef(DEBUGGEE_LOCALVAR);
rType = objRef.referenceType();

View File

@ -122,36 +122,29 @@ public class setvalue004 {
return quitDebuggee();
}
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
try {
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee's thread");
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee's thread suspension ...");
try {
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee's thread");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee's thread suspension ...");
Thread.currentThread().sleep(1000);
} catch(InterruptedException ie) {
ie.printStackTrace();
log.complain("TEST FAILED: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
// Check the tested assersion
try {
objRef = findObjRef(DEBUGGEE_LOCALVAR);
rType = objRef.referenceType();

View File

@ -109,37 +109,30 @@ public class setvalue005 {
return quitDebuggee();
}
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
try {
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee thread after "
+ ATTEMPTS + " attempts");
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
try {
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILED: Unable to suspend debuggee thread after "
+ ATTEMPTS + " attempts");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
Thread.currentThread().sleep(1000);
} catch(InterruptedException ie) {
ie.printStackTrace();
log.complain("TEST FAILED: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
// Check the tested assersion
try {
objRef = findObjRef(DEBUGGEE_LOCALVAR);
rType = objRef.referenceType();

View File

@ -156,19 +156,19 @@ public class setvalue005 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "mainThread", DEBUGGEE_THRDNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRDNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "mainThread", DEBUGGEE_THRDNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRDNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// find a stack frame which belongs to the "setvalue005tMainThr" thread

View File

@ -91,41 +91,34 @@ public class ownedmonitors002 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
int num = 0;
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILURE: Unable to suspend debuggee thread after "
+ ATTEMPTS + " attempts");
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
try {
int num = 0;
thrRef.suspend();
while(!thrRef.isSuspended()) {
num++;
if (num > ATTEMPTS) {
log.complain("TEST FAILURE: Unable to suspend debuggee thread after "
+ ATTEMPTS + " attempts");
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
log.display("Waiting for debuggee thread suspension ...");
Thread.currentThread().sleep(DELAY);
} catch(InterruptedException ie) {
ie.printStackTrace();
log.complain("TEST FAILURE: caught: " + ie);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
}
// Check the tested assersion
try {
List mons = thrRef.ownedMonitors();
if (vm.canGetOwnedMonitorInfo()) {
log.display("CHECK PASSED: got a List of monitors owned by the thread,"

View File

@ -106,20 +106,20 @@ public class popframes006 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
Field doExit = null;
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// debuggee field used to indicate that popping has been done

View File

@ -106,29 +106,29 @@ public class popframes007 {
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference mainThread =
debuggee.threadByFieldName(rType, "mainThread", DEBUGGEE_MAIN_THREAD_NAME);
if (mainThread == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_MAIN_THREAD_NAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ThreadReference auxThread =
debuggee.threadByFieldName(rType, "auxThr", DEBUGGEE_AUX_THREAD_NAME);
if (auxThread == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_AUX_THREAD_NAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
Field doExit = null;
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference mainThread =
debuggee.threadByFieldName(rType, "mainThread", DEBUGGEE_MAIN_THREAD_NAME);
if (mainThread == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_MAIN_THREAD_NAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ThreadReference auxThread =
debuggee.threadByFieldName(rType, "auxThr", DEBUGGEE_AUX_THREAD_NAME);
if (auxThread == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_AUX_THREAD_NAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// debuggee field used to indicate that popping has been done

View File

@ -115,22 +115,23 @@ public class stop002 {
return quitDebuggee();
}
// debuggee main class
mainClass = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef = debuggee.threadByFieldName(mainClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
Field stopLoop1 = null;
Field stopLoop2 = null;
ObjectReference objRef = null;
ObjectReference throwableRef = null;
try {
// debuggee main class
mainClass = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef = debuggee.threadByFieldName(mainClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
suspendAtBP(mainClass, DEBUGGEE_STOPATLINE);
objRef = findObjRef(thrRef, DEBUGGEE_NON_THROWABLE_VAR);
throwableRef = findObjRef(thrRef, DEBUGGEE_THROWABLE_VAR);