Skip to content

Commit bfd6c46

Browse files
author
duke
committed
Backport 10258dc56eb7d5d99ca8ed2579e871de91c74769
1 parent 6a9bd77 commit bfd6c46

File tree

74 files changed

+522
-359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+522
-359
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007.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
@@ -158,7 +158,8 @@ private void execTest() {
158158

159159
thread = brkpEvent.thread();
160160

161-
suspendedThread = debugee.threadByName(invokemethod007a.testedThread);
161+
suspendedThread = debugee.threadByFieldNameOrThrow(testedClass, "thread",
162+
invokemethod007a.testedThread);
162163
switch (i) {
163164
case 0:
164165
suspendedThread.suspend();

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod007a.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2021, 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
@@ -40,21 +40,21 @@ public class invokemethod007a {
4040
public static Log log;
4141
public static long waitTime;
4242
private static IOPipe pipe;
43+
static Thread thread = null;
4344

4445
public static void main (String argv[]) {
4546
ArgumentHandler argHandler = new ArgumentHandler(argv);
4647
log = new Log(System.err, argHandler);
4748
waitTime = argHandler.getWaitTime() * 60000;
4849
pipe = argHandler.createDebugeeIOPipe(log);
49-
Thread thread = null;
5050
pipe.println(invokemethod007.SGNL_READY);
5151

5252
String instr = pipe.readln();
5353
while (!instr.equals(invokemethod007.SGNL_QUIT)) {
5454

5555
// create new thread and start it
5656
if (instr.equals(invokemethod007.SGNL_STRTHRD)) {
57-
thread = JDIThreadFactory.newThread(new im007aThread01("im007aThread01"));
57+
thread = JDIThreadFactory.newThread(new im007aThread01(testedThread));
5858
synchronized(im007aThread01.waitStarting) {
5959
thread.start();
6060
try {

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009.java

Lines changed: 8 additions & 7 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
@@ -55,7 +55,7 @@ public class invokemethod009 {
5555
static final String DEBUGGEE_THRNAME = "invokemethod009tThr";
5656

5757
// debuggee source line where it should be stopped
58-
static final int DEBUGGEE_STOPATLINE = 57;
58+
static final int DEBUGGEE_STOPATLINE = 60;
5959

6060
// tested debuggee methods, fields and reference types
6161
static final int METH_NUM = 2;
@@ -112,15 +112,16 @@ private int runIt(String args[], PrintStream out) {
112112
return quitDebuggee();
113113
}
114114

115-
if ((thrRef =
116-
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
117-
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
115+
// debuggee main class
116+
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
117+
118+
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
119+
if (thrRef == null) {
120+
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
118121
+ DEBUGGEE_THRNAME);
119122
tot_res = Consts.TEST_FAILED;
120123
return quitDebuggee();
121124
}
122-
// debuggee main class
123-
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
124125

125126
// Check the tested assersion
126127
try {

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009t.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2018, 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
@@ -33,6 +33,8 @@
3333
* This is a debuggee class.
3434
*/
3535
public class invokemethod009t {
36+
static Thread testThread = null;
37+
3638
public static void main(String args[]) {
3739
System.exit(run(args) + Consts.JCK_STATUS_BASE);
3840
}
@@ -44,7 +46,8 @@ public static int run(String args[]) {
4446
private int runIt(String args[]) {
4547
ArgumentHandler argHandler = new ArgumentHandler(args);
4648
IOPipe pipe = argHandler.createDebugeeIOPipe();
47-
Thread.currentThread().setName(invokemethod009.DEBUGGEE_THRNAME);
49+
testThread = Thread.currentThread();
50+
testThread.setName(invokemethod009.DEBUGGEE_THRNAME);
4851

4952
pipe.println(invokemethod009.COMMAND_READY);
5053
String cmd = pipe.readln();

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010.java

Lines changed: 7 additions & 5 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
@@ -111,9 +111,12 @@ private int runIt(String args[], PrintStream out) {
111111
return quitDebuggee();
112112
}
113113

114-
if ((thrRef =
115-
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
116-
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
114+
// debuggee main class
115+
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
116+
117+
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
118+
if (thrRef == null) {
119+
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
117120
+ DEBUGGEE_THRNAME);
118121
tot_res = Consts.TEST_FAILED;
119122
return quitDebuggee();
@@ -139,7 +142,6 @@ private int runIt(String args[], PrintStream out) {
139142

140143
try {
141144
// debuggee main class
142-
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
143145
ClassType clsType = (ClassType) rType;
144146

145147
for (int i=0; i<METH_NUM; i++) {

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010t.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2018, 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
@@ -31,6 +31,8 @@
3131
* This is debuggee class.
3232
*/
3333
public class invokemethod010t {
34+
static Thread testThread = null;
35+
3436
public static void main(String args[]) {
3537
System.exit(run(args) + Consts.JCK_STATUS_BASE);
3638
}
@@ -42,7 +44,8 @@ public static int run(String args[]) {
4244
private int runIt(String args[]) {
4345
ArgumentHandler argHandler = new ArgumentHandler(args);
4446
IOPipe pipe = argHandler.createDebugeeIOPipe();
45-
Thread.currentThread().setName(invokemethod010.DEBUGGEE_THRNAME);
47+
testThread = Thread.currentThread();
48+
testThread.setName(invokemethod010.DEBUGGEE_THRNAME);
4649

4750
pipe.println(invokemethod010.COMMAND_READY);
4851
String cmd = pipe.readln();

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014.java

Lines changed: 10 additions & 9 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
@@ -68,7 +68,7 @@ public class invokemethod014 {
6868
static final String DEBUGGEE_THRNAME = "invokemethod014tThr";
6969

7070
// debuggee source line where it should be stopped
71-
static final int DEBUGGEE_STOPATLINE = 61;
71+
static final int DEBUGGEE_STOPATLINE = 63;
7272

7373
static final int TIMEOUT_DELTA = 1000; // in milliseconds
7474

@@ -113,19 +113,20 @@ private int runIt(String args[], PrintStream out) {
113113
return quitDebuggee();
114114
}
115115

116-
ThreadReference thrRef = null;
117-
if ((thrRef =
118-
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
119-
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
116+
// debuggee main class
117+
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
118+
ClassType clsType = (ClassType) rType;
119+
120+
ThreadReference thrRef =
121+
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
122+
if (thrRef == null) {
123+
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
120124
+ DEBUGGEE_THRNAME);
121125
tot_res = Consts.TEST_FAILED;
122126
return quitDebuggee();
123127
}
124128

125129
try {
126-
// debuggee main class
127-
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
128-
ClassType clsType = (ClassType) rType;
129130
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
130131

131132
for (int i=0; i<METH_NUM; i++) {

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014t.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2018, 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
@@ -34,6 +34,7 @@
3434
*/
3535
public class invokemethod014t {
3636
static {} // force javac to produce <clinit> method
37+
static Thread testThread = null;
3738

3839
invokemethod014t() {} // force javac to produce <init> method
3940

@@ -48,7 +49,8 @@ public static int run(String args[]) {
4849
private int runIt(String args[]) {
4950
ArgumentHandler argHandler = new ArgumentHandler(args);
5051
IOPipe pipe = argHandler.createDebugeeIOPipe();
51-
Thread.currentThread().setName(invokemethod014.DEBUGGEE_THRNAME);
52+
testThread = Thread.currentThread();
53+
testThread.setName(invokemethod014.DEBUGGEE_THRNAME);
5254

5355
pipe.println(invokemethod014.COMMAND_READY);
5456
String cmd = pipe.readln();

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007.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
@@ -157,7 +157,8 @@ private void execTest() {
157157

158158
thread = brkpEvent.thread();
159159

160-
suspendedThread = debugee.threadByName(newinstance007a.testedThread);
160+
suspendedThread = debugee.threadByFieldNameOrThrow(testedClass, "thread",
161+
newinstance007a.testedThread);
161162
switch (i) {
162163
case 0:
163164
suspendedThread.suspend();

test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance007a.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2021, 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
@@ -34,27 +34,27 @@
3434
public class newinstance007a {
3535

3636
public final static String brkpMethodName = "main";
37-
public final static int brkpLineNumber = 70;
37+
public final static int brkpLineNumber = 71;
3838
public final static String testedThread = "im007aThread01";
3939

4040
public static Log log;
4141
public static long waitTime;
4242
private static IOPipe pipe;
43+
static Thread thread = null;
4344

4445
public static void main (String argv[]) {
4546
ArgumentHandler argHandler = new ArgumentHandler(argv);
4647
log = new Log(System.err, argHandler);
4748
waitTime = argHandler.getWaitTime() * 60000;
4849
pipe = argHandler.createDebugeeIOPipe(log);
49-
Thread thread = null;
5050
pipe.println(newinstance007.SGNL_READY);
5151

5252
String instr = pipe.readln();
5353
while (!instr.equals(newinstance007.SGNL_QUIT)) {
5454

5555
// create new thread and start it
5656
if (instr.equals(newinstance007.SGNL_STRTHRD)) {
57-
thread = JDIThreadFactory.newThread(new im007aThread01("im007aThread01"));
57+
thread = JDIThreadFactory.newThread(new im007aThread01(testedThread));
5858
synchronized(im007aThread01.waitStarting) {
5959
thread.start();
6060
try {

0 commit comments

Comments
 (0)