Skip to content

Commit 18a731a

Browse files
author
Alex Menkov
committed
8269770: nsk tests should start IOPipe channel before launch debuggee - Debugee.prepareDebugee
Reviewed-by: sspitsyn, kevinw
1 parent 9c392d0 commit 18a731a

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001.java

+5-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -109,24 +109,8 @@ private int runThis (String argv[], PrintStream out) {
109109
logHandler = new Log(out, argsHandler);
110110
Binder binder = new Binder(argsHandler, logHandler);
111111

112-
113-
if (argsHandler.verbose()) {
114-
debugee = binder.bindToDebugee(debugeeName + " -vbs");
115-
} else {
116-
debugee = binder.bindToDebugee(debugeeName);
117-
}
118-
119-
IOPipe pipe = new IOPipe(debugee);
120-
121-
122-
debugee.redirectStderr(out);
123-
debugee.resume();
124-
125-
String line = pipe.readln();
126-
if (!line.equals("ready")) {
127-
logHandler.complain("# Cannot recognize debugee's signal: " + line);
128-
return 2;
129-
};
112+
debugee = Debugee.prepareDebugee(argsHandler, logHandler,
113+
debugeeName + (argsHandler.verbose() ? " -vbs" : ""));
130114

131115
// ReferenceType classes[] = debugee.classes();
132116
// for (int i=0; i<classes.length; i++) {
@@ -165,10 +149,8 @@ private int runThis (String argv[], PrintStream out) {
165149
return 2;
166150
};
167151

168-
pipe.println("quit");
169-
debugee.waitFor();
170-
171-
int status = debugee.getStatus();
152+
debugee.sendSignal("quit");
153+
int status = debugee.endDebugee();
172154
if (status != 95) {
173155
logHandler.complain("Debugee's exit status=" + status);
174156
return 2;

test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,16 @@ public Process getProcess() {
110110

111111
// --------------------------------------------------- //
112112

113-
/** Created and return new IOPipe channel to the debugee VM. */
113+
/** Create and return new IOPipe channel to the debuggee VM.
114+
* The channel should be created before debuggee starts execution,
115+
* i.e. the method assumes debuggee is started, but suspended before
116+
* its main class is loaded.
117+
*/
114118
public IOPipe createIOPipe() {
115119
if (pipe != null) {
116120
throw new TestBug("IOPipe channel is already created");
117121
}
118-
pipe = new IOPipe(this);
122+
pipe = IOPipe.startDebuggerPipe(binder);
119123
return pipe;
120124
}
121125

test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected IOPipe(Log log, String host, int port, long timeout, boolean listening
8484
/**
8585
* Creates and starts listening <code>IOPipe</code> at debugger side.
8686
*/
87-
public static IOPipe startDebuggerPipe(Binder binder) {
87+
public static IOPipe startDebuggerPipe(DebugeeBinder binder) {
8888
IOPipe ioPipe = new IOPipe(binder.getLog(),
8989
binder.getArgumentHandler().getDebugeeHost(),
9090
binder.getArgumentHandler().getPipePortNumber(),
@@ -95,7 +95,6 @@ public static IOPipe startDebuggerPipe(Binder binder) {
9595
return ioPipe;
9696
}
9797

98-
9998
protected void connect() {
10099
super.connect();
101100
}

0 commit comments

Comments
 (0)