diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java index 404947071ce..4ff1efa3d9c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java @@ -297,7 +297,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java index d17d5aaba2e..a82ea5a1373 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java @@ -337,7 +337,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java index ac62694e13f..3ddf7bbc685 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java @@ -289,8 +289,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); - + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest (thread1, StepRequest.STEP_MIN, StepRequest.STEP_INTO); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java index 589e15cd305..6890eca8199 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java @@ -289,7 +289,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java index fbab0d27c62..f0513517679 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java @@ -291,7 +291,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java index 291b33fea10..57f38744a66 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java @@ -295,7 +295,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java index a634df78b3b..ab1e8c2b056 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java @@ -290,7 +290,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java index 93d4fdae605..4bed425b3c8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java @@ -295,7 +295,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java index 91002312cd8..cf7abdf919b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java @@ -288,7 +288,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java index 5c9ef8ac9b9..c58d1770e3c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java @@ -292,7 +292,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java index f58aced259b..91914d1e103 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java @@ -297,7 +297,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java index 88cb33232d2..8102bf6b0e2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java @@ -293,7 +293,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest"); eventRequest1 = eventRManager.createStepRequest diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java index 55a72a6951a..8e0a8b04966 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java @@ -281,7 +281,7 @@ private void testRun() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part - thread = debuggee.threadByNameOrThrow(threadName); + thread = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName); if (StepRequest.STEP_MIN > StepRequest.STEP_LINE) { maxSize = StepRequest.STEP_MIN; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java index 7ad725d5ab4..88a55273451 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java @@ -74,8 +74,8 @@ public static void main (String argv[]) { //------------------------------------------------------ test specific fields - static final int lineForBreakInThread = 137; - static final int[] checkedLines = { 138, 138, 178 }; + static final int lineForBreakInThread = 141; + static final int[] checkedLines = { 142, 142, 182 }; //------------------------------------------------------ mutable common methods @@ -252,7 +252,7 @@ private void setAndCheckStepEvent ( BreakpointRequest bpRequest, exitCode = FAILED; } - ThreadReference thread = debuggee.threadByNameOrThrow(threadName); + ThreadReference thread = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName); StepRequest stepRequest = setStepRequest( thread, StepRequest.STEP_LINE, stepDepth, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003a.java index 460dc8e92f1..d1a5362251c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -55,6 +55,10 @@ public class crstepreq003a { static Object waitnotifyObj = new Object(); + static Thread thread0; + static Thread thread1; + static Thread thread2; + //------------------------------------------------------ mutable common method public static void main (String argv[]) { @@ -72,21 +76,21 @@ public static void main (String argv[]) { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test case section case 0: - Thread thread0 = JDIThreadFactory.newThread(new Thread0crstepreq003a("thread0")); + thread0 = JDIThreadFactory.newThread(new Thread0crstepreq003a("thread0")); threadStart(thread0); threadJoin (thread0, "0"); break; case 1: - Thread thread1 = JDIThreadFactory.newThread(new Thread0crstepreq003a("thread1")); + thread1 = JDIThreadFactory.newThread(new Thread0crstepreq003a("thread1")); threadStart(thread1); threadJoin (thread1, "1"); break; case 2: - Thread thread2 = JDIThreadFactory.newThread(new Thread0crstepreq003a("thread2")); + thread2 = JDIThreadFactory.newThread(new Thread0crstepreq003a("thread2")); threadStart(thread2); threadJoin (thread2, "2"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java index d8e36c6e47d..7b05f4ddc78 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java @@ -74,9 +74,9 @@ public static void main (String argv[]) { //------------------------------------------------------ test specific fields - static final int lineForBreakInThread = 146; - static final int[] checkedLines = { 160, 160, 193 }; - static final int[] checkedLinesAlt = { 161, 161, 193 }; + static final int lineForBreakInThread = 149; + static final int[] checkedLines = { 163, 163, 196 }; + static final int[] checkedLinesAlt = { 164, 164, 196 }; //------------------------------------------------------ mutable common methods @@ -247,7 +247,7 @@ private void setAndCheckStepEvent ( BreakpointRequest bpRequest, exitCode = FAILED; } - ThreadReference thread = debuggee.threadByNameOrThrow(threadName); + ThreadReference thread = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName); StepRequest stepRequest = setStepRequest( thread, StepRequest.STEP_LINE, stepDepth, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004a.java index 881d211aa0e..d6e28602ed7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -58,6 +58,9 @@ public class crstepreq004a { private static volatile boolean isFirstThreadReady = false; private static volatile boolean isSecondThreadReady = false; + static Thread thread1; + static Thread thread2; + //------------------------------------------------------ mutable common method public static void main (String argv[]) { @@ -95,8 +98,8 @@ public static void main (String argv[]) { private static void runTestCase(int testCaseId) { isFirstThreadReady = false; isSecondThreadReady = false; - Thread thread1 = JDIThreadFactory.newThread(new Thread1crstepreq004a("thread1")); - Thread thread2 = JDIThreadFactory.newThread(new Thread2crstepreq004a("thread2")); + thread1 = JDIThreadFactory.newThread(new Thread1crstepreq004a("thread1")); + thread2 = JDIThreadFactory.newThread(new Thread2crstepreq004a("thread2")); synchronized (lockObj) { thread1.start(); while (!isFirstThreadReady) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002.java index 80af7131dd7..253754c6215 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002.java @@ -296,7 +296,7 @@ private void testRun() testClassReference = (ReferenceType) vm.classesByName(testedClassName).get(0); - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); eventRequest1 = setting21StepRequest(thread1, testClassReference, EventRequest.SUSPEND_NONE, property1); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002.java index 2d4c12c906a..8053b2bf283 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002.java @@ -288,7 +288,7 @@ private void testRun() switch (i) { case 0: - ThreadReference thread1 = debuggee.threadByNameOrThrow("thread1"); + ThreadReference thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "thread1"); eventRequest1 = setting23StepRequest(thread1, testedClassName1, EventRequest.SUSPEND_NONE, property1); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java index 249b6ee05fe..53f04181057 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java @@ -287,7 +287,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest with depth StepRequest.STEP_INTO"); eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java index a3de24fb3d7..47b8c223e82 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java @@ -287,7 +287,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest with depth StepRequest.STEP_OVER"); eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java index b7281d524fb..7b8c3d5e41c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java @@ -287,7 +287,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest with depth StepRequest.STEP_OUT"); eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java index 6959aa2fed4..d9a7962ca86 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java @@ -287,7 +287,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest with size StepRequest.STEP_MIN"); eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_MIN, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java index e25c3d9abd4..ae52a6019b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java @@ -287,7 +287,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest with size StepRequest.STEP_LINE"); eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_LINE, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java index d0207238eb8..ae07e163b45 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java @@ -289,7 +289,7 @@ private void testRun() switch (i) { case 0: - thread1 = debuggee.threadByNameOrThrow(threadName1); + thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1); log2("......setting up StepRequest with size StepRequest.STEP_MIN"); eventRequest1 = setting24StepRequest(thread1, StepRequest.STEP_MIN, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java index 51f51da29ef..be6b5898149 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java @@ -311,7 +311,7 @@ private void testRun() } String thread2Name = "thread2"; - ThreadReference thread2Ref = debuggee.threadByNameOrThrow(thread2Name); + ThreadReference thread2Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread2Name); String poppedMethod = "poppedMethod"; @@ -320,7 +320,7 @@ private void testRun() log2("......setting breakpoint in poppedMethod"); try { - breakpointRequest = settingBreakpoint(debuggee.threadByNameOrThrow(thread2Name), + breakpointRequest = settingBreakpoint(thread2Ref, debuggeeClass, poppedMethod, breakpointLine, "one"); } catch ( Exception e ) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java index 4f75c90b312..dea8f8d77c9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java @@ -278,10 +278,10 @@ private void testRun() breakpointForCommunication(); String thread2Name = "thread2"; - ThreadReference thread2Ref = debuggee.threadByNameOrThrow(thread2Name); + ThreadReference thread2Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread2Name); String thread3Name = "thread3"; - ThreadReference thread3Ref = debuggee.threadByNameOrThrow(thread3Name); + ThreadReference thread3Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread3Name); String poppedMethod = "poppedMethod"; String breakpointLine = "breakpointLine"; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java index f4a7fb4e380..32f2804e48e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java @@ -292,10 +292,10 @@ private void testRun() String thread2Name = "thread2"; - ThreadReference thread2Ref = debuggee.threadByNameOrThrow(thread2Name); + ThreadReference thread2Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread2Name); String thread3Name = "thread3"; - ThreadReference thread3Ref = debuggee.threadByNameOrThrow(thread3Name); + ThreadReference thread3Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread3Name); String poppedMethod = "poppedMethod"; String breakpointLine = "breakpointLine"; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java index 7ca95a46c65..bb0f17079ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java @@ -276,7 +276,7 @@ private void testRun() breakpointForCommunication(); String thread2Name = "thread2"; - ThreadReference thread2Ref = debuggee.threadByNameOrThrow(thread2Name); + ThreadReference thread2Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread2Name); StackFrame stackFrame = null; int var; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java index 7d221fb4db0..45e0fcc53a8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java @@ -280,7 +280,7 @@ private void testRun() breakpointForCommunication(); String thread2Name = "thread2"; - ThreadReference thread2Ref = debuggee.threadByNameOrThrow(thread2Name); + ThreadReference thread2Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread2Name); StackFrame stackFrame0 = null; StackFrame stackFrame1 = null; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java index 74541fb78e8..78d650d3399 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java @@ -264,6 +264,33 @@ public ThreadReference threadByNameOrThrow(String name) throws JDITestRuntimeExc throw new JDITestRuntimeException("** Thread IS NOT found ** : " + name); } + /** + * Return a debuggee thread by fetching it from a static field in the debuggee. + */ + public ThreadReference threadByFieldNameOrThrow(ReferenceType debuggeeClass, + String threadFieldName) + throws JDITestRuntimeException { + + Field field = debuggeeClass.fieldByName(threadFieldName); + if (field == null) { + throw new JDITestRuntimeException("** Thread field not found ** : " + + threadFieldName); + } + + ThreadReference thread = (ThreadReference)debuggeeClass.getValue(field); + if (thread == null) { + throw new JDITestRuntimeException("** Thread field is null ** : " + + threadFieldName); + } + + if (!thread.name().equals(threadFieldName)) { + throw new JDITestRuntimeException("** Thread names do not match ** : " + + threadFieldName + " vs. " + thread.name()); + } + + return thread; + } + // --------------------------------------------------- // /**