Skip to content

Commit

Permalink
Backport 18a731a3e4ec85f0f3e8d6ff619b539c0daaf320
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Sep 6, 2024
1 parent 58cbf5d commit b00bb3c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit b00bb3c

Please sign in to comment.