From a6edd0f534b3a6db437744032b66013e1a7c04ef Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Thu, 11 Jun 2026 09:59:23 -0700 Subject: [PATCH] support WhiteBoxAPI for debuggee --- test/jdk/com/sun/jdi/TestScaffold.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/jdk/com/sun/jdi/TestScaffold.java b/test/jdk/com/sun/jdi/TestScaffold.java index 92779738998..846ad066c2a 100644 --- a/test/jdk/com/sun/jdi/TestScaffold.java +++ b/test/jdk/com/sun/jdi/TestScaffold.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, 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 @@ -44,6 +44,8 @@ abstract public class TestScaffold extends TargetAdapter { // Set true by tests that need the debug agent to be run with includevirtualthreads=y. private boolean includeVThreads = false; + // Set true by tests that need the debuggee to be run with WhiteBoxAPI enabled. + private boolean enableWhiteBoxAPI = false; ThreadReference mainThread; /** @@ -91,6 +93,10 @@ abstract public class TestScaffold extends TargetAdapter { includeVThreads = true; } + void enableWhiteBoxAPI() { + enableWhiteBoxAPI = true; + } + boolean getExceptionCaught() { return exceptionCaught; } @@ -564,6 +570,10 @@ abstract public class TestScaffold extends TargetAdapter { // the test specified @enablePreview. argInfo.targetVMArgs += "--enable-preview "; } + if (enableWhiteBoxAPI) { + argInfo.targetVMArgs += "-XX:+UnlockDiagnosticVMOptions -Xbootclasspath/a:. -XX:+WhiteBoxAPI "; + } + return argInfo; } @@ -594,6 +604,7 @@ abstract public class TestScaffold extends TargetAdapter { ArgInfo argInfo = parseArgs(args); argInfo.targetVMArgs = VMConnection.getDebuggeeVMOptions() + " " + argInfo.targetVMArgs; + System.out.println("targetVMArgs: " + argInfo.targetVMArgs); connection = new VMConnection(argInfo.connectorSpec, argInfo.traceFlags, includeVThreads);