Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8315486: vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java timed out #1364

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -139,13 +139,34 @@ private void sendCommand(long threadID, Value value, boolean expectError, int er
}
}

// get thread ID for "startNewThread" command
private long getNewThreadId() throws Exception {
final String debugeeClassSig = "L" + getDebugeeClassName().replace('.', '/') + ";";
log.display(" getting classID for " + debugeeClassSig);
long classID = debuggee.getReferenceTypeID(debugeeClassSig);
log.display(" got classID: " + classID);

log.display(" getting testNewThread field value");
JDWP.Value value = debuggee.getStaticFieldValue(classID, "testNewThread", JDWP.Tag.THREAD);

long threadID = ((Long)value.getValue()).longValue();
log.display(" got threadID: " + threadID);
return threadID;
}

private int createThreadStartEventRequest() {
try {
long newThreadId = getNewThreadId();
// create command packet and fill requred out data
CommandPacket command = new CommandPacket(JDWP.Command.EventRequest.Set);
command.addByte(JDWP.EventKind.THREAD_START);
command.addByte(JDWP.SuspendPolicy.ALL);
command.addInt(0);
// we want the THREAD_START event only for the test thread
// and not any others that might be started by debuggee VM,
// so add THREAD_ONLY modifier
command.addInt(1);
command.addByte(JDWP.EventModifierKind.THREAD_ONLY);
command.addObjectID(newThreadId);
command.setLength();

transport.write(command);
@@ -175,7 +196,7 @@ public void doTest() {
Value value;

value = new Value(JDWP.Tag.INT, 0);
// create command with invalid trheadID, expect INVALID_OBJECT error
// create command with invalid threadID, expect INVALID_OBJECT error
sendCommand(-1, value, true, JDWP.Error.INVALID_OBJECT);

// create StateTestThread
Original file line number Diff line number Diff line change
@@ -51,21 +51,29 @@ public boolean parseCommand(String command) {

return true;
} else if (command.equals(COMMAND_START_NEW_THREAD)) {
Thread thread = new Thread(new Runnable() {
public void run() {
log.display("Thread exit");
}
});

thread.setName("forceEarlyReturn002a_NewThread");
thread.start();
testNewThread.start();

return true;
}

return false;
}

@Override
protected void init(String args[]) {
super.init(args);

// create thread for "NewThread" command in advance
testNewThread = new Thread(new Runnable() {
public void run() {
log.display("Thread exit");
}
});
testNewThread.setName("forceEarlyReturn002a_NewThread");
}

private static Thread testNewThread;

private Thread testThreadInNative;

private void stopThreadInNative() {