/*
* 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.
*/
/**
* Manages a VM conection for the JDI test framework.
*/
class VMConnection {
private final int traceFlags;
/**
* Return a String containing VM Options to pass to the debugee
* or an empty string if there are none.
* These are read from the first non-comment line
* in file @debuggeeVMOptions in the test.classes dir
*/
// When we run under jtreg, test.classes contains the pathname of
// the dir in which the .class files will be placed.
if (testClasses == null) {
return retVal;
}
// Not there - look in parent (in case we are in a subdir)
return retVal;
}
}
}
try {
} catch (FileNotFoundException ee) {
return retVal;
}
while (true) {
try {
} catch (IOException ee) {
break;
}
break;
}
break;
}
// Else, read he next line.
}
try {
} catch (IOException ee) {
}
return retVal;
}
return cmdLine;
}
// Insert the options at position 1. Blanks in args are not allowed!
return retVal;
}
return connector;
}
}
return null;
}
while (tokenizer.hasMoreTokens()) {
if (index == -1) {
throw new IllegalArgumentException("Illegal connector argument: " +
token);
}
"is not defined for connector: " +
}
}
return arguments;
}
if (index == -1) {
argString = "";
} else {
}
throw new IllegalArgumentException("No connector named: " +
}
this.traceFlags = traceFlags;
}
if (connector instanceof LaunchingConnector) {
vm = launchTarget();
} else if (connector instanceof AttachingConnector) {
vm = attachTarget();
} else if (connector instanceof ListeningConnector) {
vm = listenTarget();
} else {
throw new InternalError("Invalid connect type");
}
return vm;
}
/*
* Too late if the connection already made
*/
return false;
}
return false;
}
return true;
}
return "";
}
}
throw new InternalError("VM not connected");
} else {
return vm;
}
}
boolean isOpen() {
}
boolean isLaunch() {
return (connector instanceof LaunchingConnector);
}
return connector;
}
boolean isListen() {
return (connector instanceof ListeningConnector);
}
boolean isAttach() {
return (connector instanceof AttachingConnector);
}
private synchronized void notifyOutputComplete() {
notifyAll();
}
private synchronized void waitOutputComplete() {
// Wait for stderr and stdout
while (outputCompleteCount < 2) {
try {wait();} catch (InterruptedException e) {}
}
}
}
public void disposeVM() {
try {
}
} finally {
}
}
}
while(true){
try{
break;
}
}
catch(IOException ieo){
/**
* IOException with "Bad file number..." can happen
* when the debuggee process is destroyed. Ignore such exception.
*
*/
if( s.startsWith("Bad file number") ){
break;
}
throw ieo;
}
catch(NullPointerException npe){
throw new IOException("Bug 4728096 in Java io may cause in.readLine() to throw a NULL pointer exception");
}
}
}
/**
* Create a Thread that will retrieve and display any output.
* Needs to be high priority, else debugger may exit before
* it can be displayed.
*/
public void run() {
try {
} catch (IOException ex) {
+ ex.getMessage());
} finally {
}
}
};
}
try {
} catch (IOException e) {
e.getMessage());
}
}
/* launch child target vm */
try {
return vm;
} catch (IOException ioe) {
} catch (IllegalConnectorArgumentsException icae) {
} catch (VMStartException vmse) {
}
return null; // Shuts up the compiler
}
/* attach to running target vm */
try {
} catch (IOException ioe) {
} catch (IllegalConnectorArgumentsException icae) {
}
return null; // Shuts up the compiler
}
/* listen for connection from target vm */
try {
return vm;
} catch (IOException ioe) {
} catch (IllegalConnectorArgumentsException icae) {
}
return null; // Shuts up the compiler
}
}