Skip to content

Commit c8bcdf2

Browse files
committed
backport e2ae50d877b13b121912e2496af4b5209b315a05
1 parent eb8c75d commit c8bcdf2

39 files changed

+151
-91
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp001.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -108,8 +108,7 @@ private int runThis (String argv[], PrintStream out) {
108108
logHandler = new Log(out, argsHandler);
109109
Binder binder = new Binder(argsHandler, logHandler);
110110

111-
debugee = Debugee.prepareDebugee(argsHandler, logHandler,
112-
debugeeName + (argsHandler.verbose() ? " -vbs" : ""));
111+
debugee = Debugee.prepareDebugee(argsHandler, logHandler, debugeeName);
113112

114113
// ReferenceType classes[] = debugee.classes();
115114
// for (int i=0; i<classes.length; i++) {

test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@ private static void execTest() {
118118
switch (i) {
119119

120120
case 0:
121-
ThreadReference thread = debuggee.threadByNameOrThrow(methodName);
121+
ThreadReference thread = debuggee.mainThread();
122122

123123
display(".....setting up StepRequest");
124124
eventRequest = eventRequestManager.createStepRequest

test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/_bounds_/requests001.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@ private void execTest() {
9595

9696
EventRequest request;
9797
EventRequestManager evm = debugee.getEventRequestManager();
98-
ThreadReference thread = debugee.threadByName("main");
98+
ThreadReference thread = debugee.mainThread();
9999

100100
display("");
101101
display("...calling createStepRequest(null, StepRequest.STEP_LINE, "

test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,15 @@ private void testRun()
250250

251251
ClassPrepareEvent event = (ClassPrepareEvent) eventIterator.next();
252252
debuggeeClass = event.referenceType();
253+
debuggee.setMainThread(event.thread());
253254

254255
if (!debuggeeClass.name().equals(debuggeeName))
255256
throw new JDITestRuntimeException("** Unexpected ClassName for ClassPrepareEvent **");
256257
log2(" received: ClassPrepareEvent for debuggeeClass");
257258

258259
log2("......setting up ClassPrepareEvent for breakpointForCommunication");
259260

260-
ThreadReference mainThread = debuggee.threadByNameOrThrow("main");
261+
ThreadReference mainThread = debuggee.mainThread();
261262
setupBreakpointForCommunication(debuggeeClass);
262263

263264
//------------------------------------------------------ testing section

test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,7 @@ public static int run(String argv[], PrintStream out) {
139139

140140
private static void execTest() {
141141

142-
ThreadReference mainThread = debuggee.threadByName("main");
142+
ThreadReference mainThread = debuggee.mainThread();
143143

144144
// Set first breakpoint to have isobsolete003b class loaded.
145145
BreakpointRequest bpRequest = debuggee.makeBreakpoint(debuggeeClass, "main", brkpMainLineNumber);
@@ -456,6 +456,7 @@ private static void waitForDebuggeeClassPrepared () {
456456
ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest);
457457
cpRequest.disable();
458458

459+
debuggee.setMainThread(event.thread());
459460
debuggeeClass = event.referenceType();
460461
if (!debuggeeClass.name().equals(debuggeeName))
461462
throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name());

test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodEntryEvent/method/method002.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -113,6 +113,9 @@ public static int run(final String args[], final PrintStream out) {
113113

114114
pipe = debuggee.createIOPipe();
115115

116+
ClassPrepareEvent cpEvent = debuggee.waitForClassPrepare(DEBUGGEE_NAME);
117+
debuggee.setMainThread(cpEvent.thread());
118+
116119
// resume debuggee
117120
log.display("Resuming debuggee");
118121
debuggee.resume();
@@ -135,7 +138,7 @@ public static int run(final String args[], final PrintStream out) {
135138
checkedClass = debuggee.classByName(CHILD_NAME);
136139

137140
log.display("Getting <main> thread in debuggee");
138-
checkedThread = debuggee.threadByName("main");
141+
checkedThread = debuggee.mainThread();
139142
if (checkedThread == null) {
140143
throw new Failure("TEST BUG: unable to find reference to main thread");
141144
}

test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method001.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,9 @@ public static int run(final String args[], final PrintStream out) {
110110

111111
pipe = debuggee.createIOPipe();
112112

113+
ClassPrepareEvent cpEvent = debuggee.waitForClassPrepare(DEBUGGEE_NAME);
114+
debuggee.setMainThread(cpEvent.thread());
115+
113116
// resume debuggee
114117
log.display("Resuming debuggee");
115118
debuggee.resume();
@@ -131,7 +134,7 @@ public static int run(final String args[], final PrintStream out) {
131134
checkedClass = debuggee.classByName(DEBUGGEE_NAME);
132135

133136
log.display("Getting reference to thread <main>");
134-
checkedThread = debuggee.threadByName("main");
137+
checkedThread = debuggee.mainThread();
135138
if (checkedThread == null) {
136139
throw new Failure("TEST BUG: unable to find reference to main thread");
137140
}

test/hotspot/jtreg/vmTestbase/nsk/jdi/MethodExitEvent/method/method002.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -114,6 +114,9 @@ public static int run(final String args[], final PrintStream out) {
114114

115115
pipe = debuggee.createIOPipe();
116116

117+
ClassPrepareEvent cpEvent = debuggee.waitForClassPrepare(DEBUGGEE_NAME);
118+
debuggee.setMainThread(cpEvent.thread());
119+
117120
// resume debuggee
118121
log.display("Resuming debuggee");
119122
debuggee.resume();
@@ -136,7 +139,7 @@ public static int run(final String args[], final PrintStream out) {
136139
checkedClass = debuggee.classByName(CHILD_NAME);
137140

138141
log.display("Getting reference to thread <main>");
139-
checkedThread = debuggee.threadByName("main");
142+
checkedThread = debuggee.mainThread();
140143
if (checkedThread == null) {
141144
throw new Failure("TEST BUG: unable to find reference to main thread");
142145
}

test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -153,7 +153,7 @@ private int runThis(String argv[], PrintStream out) {
153153
//--------------------------------------------------------- mutable common methods
154154

155155
private void execTest() {
156-
ThreadReference mainThread = debuggee.threadByName("main");
156+
ThreadReference mainThread = debuggee.mainThread();
157157

158158
BreakpointRequest bpRequest = debuggee.makeBreakpoint(debuggeeClass,
159159
"methodForCommunication",
@@ -290,6 +290,8 @@ private ReferenceType waitForDebuggeeClassPrepared () {
290290
ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest);
291291
cpRequest.disable();
292292

293+
debuggee.setMainThread(event.thread()); // Needed so debuggee.mainThread() will work
294+
293295
if (!event.referenceType().name().equals(debuggeeName)) {
294296
throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name());
295297
}

test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -153,7 +153,7 @@ private int runThis(String argv[], PrintStream out) {
153153
//--------------------------------------------------------- mutable common methods
154154

155155
private void execTest() {
156-
ThreadReference mainThread = debuggee.threadByName("main");
156+
ThreadReference mainThread = debuggee.mainThread();
157157

158158
BreakpointRequest bpRequest = debuggee.makeBreakpoint(debuggeeClass,
159159
"methodForCommunication",
@@ -298,6 +298,8 @@ private ReferenceType waitForDebuggeeClassPrepared () {
298298
ClassPrepareEvent event = (ClassPrepareEvent) waitForEvent(cpRequest);
299299
cpRequest.disable();
300300

301+
debuggee.setMainThread(event.thread()); // Needed so debuggee.mainThread() will work
302+
301303
if (!event.referenceType().name().equals(debuggeeName)) {
302304
throw new Failure("Unexpected class name for ClassPrepareEvent : " + debuggeeClass.name());
303305
}

0 commit comments

Comments
 (0)