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 f4e41409cae..1ba99246f60 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/addCountFilter/addcountfilter001.java @@ -291,7 +291,7 @@ public class addcountfilter001 extends JDIBase { 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 75e9f40790c..0e784c89738 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable001.java @@ -289,7 +289,7 @@ public class disable001 extends JDIBase { 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 b46bf2ee1a2..0a698997d0e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/disable/disable002.java @@ -283,8 +283,7 @@ public class disable002 extends JDIBase { 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 615cf46c746..3a72bb8ff7c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable001.java @@ -283,7 +283,7 @@ public class enable001 extends JDIBase { 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 767f069438f..8cf7d15e780 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/enable/enable002.java @@ -285,7 +285,7 @@ public class enable002 extends JDIBase { 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 b4b9f0edcbc..070286903f4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/getProperty/getproperty001.java @@ -289,7 +289,7 @@ public class getproperty001 extends JDIBase { 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 d91db9a5a6a..ccc8f47299f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/isEnabled/isenabled001.java @@ -284,7 +284,7 @@ public class isenabled001 extends JDIBase { 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 479c40904e7..9e9112faf37 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/putProperty/putproperty001.java @@ -289,7 +289,7 @@ public class putproperty001 extends JDIBase { 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 57ed8454eda..6c175ec5ee3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled001.java @@ -282,7 +282,7 @@ public class setenabled001 extends JDIBase { 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 25b665dbed9..a36154cd580 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002.java @@ -286,7 +286,7 @@ public class setenabled002 extends JDIBase { 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 04995ea0b13..b35e6f39898 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setSuspendPolicy/setsuspendpolicy001.java @@ -291,7 +291,7 @@ public class setsuspendpolicy001 extends JDIBase { 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 b11a291b2f5..8372daab067 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/suspendPolicy/suspendpolicy001.java @@ -287,7 +287,7 @@ public class suspendpolicy001 extends JDIBase { 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 a5dd9023dfd..7eaa31598aa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq002.java @@ -275,7 +275,7 @@ public class crstepreq002 extends JDIBase { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 d712fb34c42..1de51ac8366 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq003.java @@ -77,8 +77,8 @@ public class crstepreq003 { //------------------------------------------------------ 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 @@ -247,7 +247,7 @@ public class crstepreq003 { 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 class crstepreq003a { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 1ab0ce68af8..16c6f79ffc3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/createStepRequest/crstepreq004.java @@ -77,9 +77,9 @@ public class crstepreq004 { //------------------------------------------------------ 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 @@ -248,7 +248,7 @@ public class crstepreq004 { 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 class crstepreq004a { 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 23be3eab4c9..363661d6847 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 @@ -290,7 +290,7 @@ public class filter_rt002 extends JDIBase { 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 d4ff86268da..9498fdb53e6 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 @@ -282,7 +282,7 @@ public class filter_s002 extends JDIBase { 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 de63a0af86b..d908cb4251f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth001.java @@ -281,7 +281,7 @@ public class depth001 extends JDIBase { 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 5cd109f6fa3..acb9792d884 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth002.java @@ -281,7 +281,7 @@ public class depth002 extends JDIBase { 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 03b8f415b56..8e828925f83 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/depth/depth003.java @@ -281,7 +281,7 @@ public class depth003 extends JDIBase { 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 db59bf6e498..3ae173708bf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size001.java @@ -281,7 +281,7 @@ public class size001 extends JDIBase { 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 09b0c53ea8c..836d8803c84 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/size/size002.java @@ -281,7 +281,7 @@ public class size002 extends JDIBase { 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 a8d3769c6c2..c00193a8958 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StepRequest/thread/thread001.java @@ -283,7 +283,7 @@ public class thread001 extends JDIBase { 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 3091f510977..198e20fc626 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001.java @@ -302,7 +302,7 @@ public class popframes001 extends JDIBase { } String thread2Name = "thread2"; - ThreadReference thread2Ref = debuggee.threadByNameOrThrow(thread2Name); + ThreadReference thread2Ref = debuggee.threadByFieldNameOrThrow(debuggeeClass, thread2Name); String poppedMethod = "poppedMethod"; @@ -311,7 +311,7 @@ public class popframes001 extends JDIBase { 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 c47358e96f8..05d8c1c39f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002.java @@ -270,10 +270,10 @@ public class popframes002 extends JDIBase { 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 84ee5996a77..117a626752c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java @@ -283,10 +283,10 @@ public class popframes003 extends JDIBase { 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 eb46fac37da..d4acdde1c9b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004.java @@ -270,7 +270,7 @@ public class popframes004 extends JDIBase { 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 ec499eba24d..170f2973a35 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005.java @@ -274,7 +274,7 @@ public class popframes005 extends JDIBase { 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 4ff6ab6f397..0f0b6fe9052 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 class Debugee extends DebugeeProcess { 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; + } + // --------------------------------------------------- // /**