Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8269770: nsk tests should start IOPipe channel before launch debuggee…
… - Debugee.prepareDebugee

Reviewed-by: sspitsyn, kevinw
  • Loading branch information
Alex Menkov committed Aug 31, 2021
1 parent 9c392d0 commit 18a731a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -109,24 +109,8 @@ private int runThis (String argv[], PrintStream out) {
logHandler = new Log(out, argsHandler);
Binder binder = new Binder(argsHandler, logHandler);


if (argsHandler.verbose()) {
debugee = binder.bindToDebugee(debugeeName + " -vbs");
} else {
debugee = binder.bindToDebugee(debugeeName);
}

IOPipe pipe = new IOPipe(debugee);


debugee.redirectStderr(out);
debugee.resume();

String line = pipe.readln();
if (!line.equals("ready")) {
logHandler.complain("# Cannot recognize debugee's signal: " + line);
return 2;
};
debugee = Debugee.prepareDebugee(argsHandler, logHandler,
debugeeName + (argsHandler.verbose() ? " -vbs" : ""));

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

pipe.println("quit");
debugee.waitFor();

int status = debugee.getStatus();
debugee.sendSignal("quit");
int status = debugee.endDebugee();
if (status != 95) {
logHandler.complain("Debugee's exit status=" + status);
return 2;
Expand Down
Expand Up @@ -110,12 +110,16 @@ public Process getProcess() {

// --------------------------------------------------- //

/** Created and return new IOPipe channel to the debugee VM. */
/** Create and return new IOPipe channel to the debuggee VM.
* The channel should be created before debuggee starts execution,
* i.e. the method assumes debuggee is started, but suspended before
* its main class is loaded.
*/
public IOPipe createIOPipe() {
if (pipe != null) {
throw new TestBug("IOPipe channel is already created");
}
pipe = new IOPipe(this);
pipe = IOPipe.startDebuggerPipe(binder);
return pipe;
}

Expand Down
3 changes: 1 addition & 2 deletions test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java
Expand Up @@ -84,7 +84,7 @@ protected IOPipe(Log log, String host, int port, long timeout, boolean listening
/**
* Creates and starts listening <code>IOPipe</code> at debugger side.
*/
public static IOPipe startDebuggerPipe(Binder binder) {
public static IOPipe startDebuggerPipe(DebugeeBinder binder) {
IOPipe ioPipe = new IOPipe(binder.getLog(),
binder.getArgumentHandler().getDebugeeHost(),
binder.getArgumentHandler().getPipePortNumber(),
Expand All @@ -95,7 +95,6 @@ public static IOPipe startDebuggerPipe(Binder binder) {
return ioPipe;
}


protected void connect() {
super.connect();
}
Expand Down

1 comment on commit 18a731a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.