Skip to content
Permalink
Browse files
trackvthreads is set in jdb only and not for all command line jdi lau…
…nchers
  • Loading branch information
lmesnik committed Mar 16, 2021
1 parent 265e1aa commit f916f5e18b832489afcb182deb8c1b97ade4f256
@@ -1109,6 +1109,10 @@ public static void main(String argv[]) throws MissingResourceException {
}
}

if (connectSpec.startsWith("com.sun.jdi.CommandLineLaunch:")) {
connectSpec += "trackvthreads=all,";
}

try {
Env.init(connectSpec, launchImmediately, traceFlags, javaArgs);
new TTY();
@@ -46,6 +46,7 @@
static private final String ARG_INIT_SUSPEND = "suspend";
static private final String ARG_QUOTE = "quote";
static private final String ARG_VM_EXEC = "vmexec";
static private final String ARG_VM_TRACK_VTHREADS = "trackvthreads";

TransportService transportService;
Transport transport;
@@ -130,6 +131,12 @@ public String name() {
getString("sun.vm_exec"),
"java",
true);
addStringArgument(
ARG_VM_TRACK_VTHREADS,
getString("sun.vm_track_vthreads.label"),
getString("sun.vm_track_vthreads"),
"some",
false);
}

static boolean hasWhitespace(String string) {
@@ -156,6 +163,7 @@ static boolean hasWhitespace(String string) {
arguments)).booleanValue();
String quote = argument(ARG_QUOTE, arguments).value();
String exe = argument(ARG_VM_EXEC, arguments).value();
String trackVThreads = argument(ARG_VM_TRACK_VTHREADS, arguments).value();
String exePath = null;

if (quote.length() > 1) {
@@ -213,9 +221,7 @@ static boolean hasWhitespace(String string) {

String xrun = "transport=" + transport().name() +
",address=" + address +
",suspend=" + (wait? 'y' : 'n') +
",enumeratevthreads=y" +
",trackvthreads=all";
",trackvthreads=" + trackVThreads;
// Quote only if necessary in case the quote arg value is bogus
if (hasWhitespace(xrun)) {
xrun = quote + xrun + quote;
@@ -45,6 +45,8 @@ sun.quote = Character used to combine space-delimited text into a single command
sun.quote.label = Quote
sun.vm_exec = Name of the Java VM launcher
sun.vm_exec.label = Launcher
sun.vm_track_vthreads = Track some or all virtual threads
sun.vm_track_vthreads.label = Track Virtual Treads
sun.description = Launches target using Sun Java VM command line and attaches to it
generic_attaching.address = Address to which to attach for VM connections
generic_attaching.address.label = Address

0 comments on commit f916f5e

Please sign in to comment.