/*
* 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.
*/
/*
* Note 1: JITDebug.java is no longer a standalone regression test,
* due to chronic test failures on win32 platforms. When testing,
* use the wrapper script (JITDebug.sh) instead, which will in turn
* invoke this program.
*
* The problems are related to inconsistent use of "SystemRoot"
* versus "SYSTEMROOT" environment variables in different win32 O/S
* installations. Refer to the Comments and Evaluation on bugs
* 4522770 and 4461673 for more information.
*
* Undefined SystemRoot in a win32 environment causes the O/S socket()
* layer to fail with WSAEPROVIDERFAILEDINIT. The workaround used by
* JITDebug.sh and JITDebug.java is to select the dt_shmem transport
* on any win32 platform where SystemRoot is not found.
*
* Note 2: What seems to be an excessive use of System.xxx.flush();
* is actually necessary to combat lost output on win32 systems.
*
* @t e s t
* @bug 4291701 4376819 4422312 4522770
* @summary Test JIT debugging -
* assure that launching on uncaught exception works
*
* @author Robert Field
*/
/*
* This class implements three separate small programs, each
* of which (directly or indirectly) invokes the next. These
* programs are:
* test launcher -
* Runs the debug target. It exists to work around a
* bug in the test tools which do not allow quoted spaces
* in command lines. It launchs the debug target in
* such a way that when it encounters an uncaught exception
* it (in turn) will launch the trivial debugger.
* debug target -
* A one line program which throws an uncaught exception.
* trivial debugger -
* A debugger which attachs to the debug target and shuts
* it down with a zero exit code.
* These programs are differentiated by their command line arguments:
* test launcher - (no args)
* debug target - ("TARGET")
* trivial debugger - ("DEBUGGER", host and port)
*/
public class JITDebug {
throw new RuntimeException("Unexpected command line arguments: "
+ args);
}
}
case 0:
testLaunch();
return true;
case 1:
debugTarget();
return true;
} else {
return false;
}
case 3:
return true;
} else {
return false;
}
default:
return false;
}
}
void testLaunch() {
class DisplayOutput extends Thread {
}
public void run() {
try {
transfer();
} catch (IOException exc) {
}
}
void transfer() throws IOException {
int ch;
}
}
}
if (transportMethod == null) {
}
"launch=" +
try {
if (exitValue != 0) {
throw new RuntimeException("Failure exit status: " +
}
}
}
}
// Target VM code
void debugTarget() {
throw new RuntimeException("Start-up onuncaught handling");
}
connectorName = "com.sun.jdi.SharedMemoryAttach";
connectorName = "com.sun.jdi.SocketAttach";
} else {
hang();
}
return;
}
}
hang();
}
} else {
}
try {
hang();
}
}
/** Hang so that test fails */
void hang() {
try {
// ten minute nap
} catch (InterruptedException exc) {
// shouldn't happen
}
}
}