8356811: Some nsk/jdi tests can fetch ThreadReference from static field in the debuggee: part 4

Reviewed-by: sspitsyn, amenkov
This commit is contained in:
Chris Plummer 2025-05-16 20:45:21 +00:00
parent 3dd3451700
commit 10258dc56e
74 changed files with 525 additions and 362 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -158,7 +158,8 @@ public class invokemethod007 {
thread = brkpEvent.thread();
suspendedThread = debugee.threadByName(invokemethod007a.testedThread);
suspendedThread = debugee.threadByFieldNameOrThrow(testedClass, "thread",
invokemethod007a.testedThread);
switch (i) {
case 0:
suspendedThread.suspend();

View File

@ -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
@ -40,13 +40,13 @@ public class invokemethod007a {
public static Log log;
public static long waitTime;
private static IOPipe pipe;
static Thread thread = null;
public static void main (String argv[]) {
ArgumentHandler argHandler = new ArgumentHandler(argv);
log = new Log(System.err, argHandler);
waitTime = argHandler.getWaitTime() * 60000;
pipe = argHandler.createDebugeeIOPipe(log);
Thread thread = null;
pipe.println(invokemethod007.SGNL_READY);
String instr = pipe.readln();
@ -54,7 +54,7 @@ public class invokemethod007a {
// create new thread and start it
if (instr.equals(invokemethod007.SGNL_STRTHRD)) {
thread = JDIThreadFactory.newThread(new im007aThread01("im007aThread01"));
thread = JDIThreadFactory.newThread(new im007aThread01(testedThread));
synchronized(im007aThread01.waitStarting) {
thread.start();
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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,7 +55,7 @@ public class invokemethod009 {
static final String DEBUGGEE_THRNAME = "invokemethod009tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 57;
static final int DEBUGGEE_STOPATLINE = 60;
// tested debuggee methods, fields and reference types
static final int METH_NUM = 2;
@ -112,15 +112,16 @@ public class invokemethod009 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
// Check the tested assersion
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class invokemethod009t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -44,7 +46,8 @@ public class invokemethod009t {
private int runIt(String args[]) {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(invokemethod009.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod009.DEBUGGEE_THRNAME);
pipe.println(invokemethod009.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -111,9 +111,12 @@ public class invokemethod010 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
@ -139,7 +142,6 @@ public class invokemethod010 {
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
for (int i=0; i<METH_NUM; i++) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -31,6 +31,8 @@ import nsk.share.jdi.*;
* This is debuggee class.
*/
public class invokemethod010t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -42,7 +44,8 @@ public class invokemethod010t {
private int runIt(String args[]) {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(invokemethod010.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod010.DEBUGGEE_THRNAME);
pipe.println(invokemethod010.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -68,7 +68,7 @@ public class invokemethod014 {
static final String DEBUGGEE_THRNAME = "invokemethod014tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 61;
static final int DEBUGGEE_STOPATLINE = 63;
static final int TIMEOUT_DELTA = 1000; // in milliseconds
@ -113,19 +113,20 @@ public class invokemethod014 {
return quitDebuggee();
}
ThreadReference thrRef = null;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
for (int i=0; i<METH_NUM; i++) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -34,6 +34,7 @@ import nsk.share.jdi.*;
*/
public class invokemethod014t {
static {} // force javac to produce <clinit> method
static Thread testThread = null;
invokemethod014t() {} // force javac to produce <init> method
@ -48,7 +49,8 @@ public class invokemethod014t {
private int runIt(String args[]) {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(invokemethod014.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod014.DEBUGGEE_THRNAME);
pipe.println(invokemethod014.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -157,7 +157,8 @@ public class newinstance007 {
thread = brkpEvent.thread();
suspendedThread = debugee.threadByName(newinstance007a.testedThread);
suspendedThread = debugee.threadByFieldNameOrThrow(testedClass, "thread",
newinstance007a.testedThread);
switch (i) {
case 0:
suspendedThread.suspend();

View File

@ -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
@ -34,19 +34,19 @@ import nsk.share.jdi.*;
public class newinstance007a {
public final static String brkpMethodName = "main";
public final static int brkpLineNumber = 70;
public final static int brkpLineNumber = 71;
public final static String testedThread = "im007aThread01";
public static Log log;
public static long waitTime;
private static IOPipe pipe;
static Thread thread = null;
public static void main (String argv[]) {
ArgumentHandler argHandler = new ArgumentHandler(argv);
log = new Log(System.err, argHandler);
waitTime = argHandler.getWaitTime() * 60000;
pipe = argHandler.createDebugeeIOPipe(log);
Thread thread = null;
pipe.println(newinstance007.SGNL_READY);
String instr = pipe.readln();
@ -54,7 +54,7 @@ public class newinstance007a {
// create new thread and start it
if (instr.equals(newinstance007.SGNL_STRTHRD)) {
thread = JDIThreadFactory.newThread(new im007aThread01("im007aThread01"));
thread = JDIThreadFactory.newThread(new im007aThread01(testedThread));
synchronized(im007aThread01.waitStarting) {
thread.start();
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -95,10 +95,13 @@ public class newinstance009 {
return quitDebuggee();
}
ThreadReference thrRef = null;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
ThreadReference thrRef = debuggee.threadByFieldName(rType, "thread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
@ -123,10 +126,6 @@ public class newinstance009 {
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ClassType clsType = (ClassType) rType;
List methList = rType.methodsByName("<init>");
if (methList.isEmpty()) {
log.complain("TEST FAILURE: the expected constructor "

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -31,6 +31,8 @@ import nsk.share.jdi.*;
* This is debuggee class.
*/
public class newinstance009t {
static Thread thread = null;
// constructor used only to check IncompatibleThreadStateException throwing
// in the debugger
newinstance009t() {
@ -48,7 +50,8 @@ public class newinstance009t {
private int runIt(String args[]) {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(newinstance009.DEBUGGEE_THRNAME);
thread = Thread.currentThread();
thread.setName(newinstance009.DEBUGGEE_THRNAME);
pipe.println(newinstance009.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -126,7 +126,8 @@ public class equals001 {
switch (i) {
case 0:
ThreadReference thread = debuggee.threadByName(threadName);
ThreadReference thread =
debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName);
display("setting up StepRequest");
eventRequest = eventRequestManager.createStepRequest

View File

@ -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
@ -64,6 +64,7 @@ public class equals001a {
static Object lock = new Object();
static Object wait = new Object();
static Thread thread1 = null;
//------------------------------------------------------ mutable common method
@ -73,7 +74,7 @@ public class equals001a {
log = new Log(System.err, argHandler);
pipe = argHandler.createDebugeeIOPipe(log);
try {
Thread thread1 = JDIThreadFactory.newThread(new equals001aThread("thread1"));
thread1 = JDIThreadFactory.newThread(new equals001aThread("thread1"));
synchronized (lock) {
synchronized(wait) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -64,7 +64,7 @@ public class hashcode001 {
private final static String threadName = "thread1";
private final static String methodName = "foo";
private final static String fieldName = "name";
private final static int brkpLineNumber = 145;
private final static int brkpLineNumber = 146;
//------------------------------------------------------- immutable common methods
@ -126,7 +126,8 @@ public class hashcode001 {
switch (i) {
case 0:
ThreadReference thread = debuggee.threadByName(threadName);
ThreadReference thread =
debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName);
display(".....setting up StepRequest");
eventRequest = eventRequestManager.createStepRequest

View File

@ -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
@ -64,6 +64,7 @@ public class hashcode001a {
static Object lock = new Object();
static Object wait = new Object();
static Thread thread1 = null;
//------------------------------------------------------ mutable common method
@ -73,7 +74,7 @@ public class hashcode001a {
log = new Log(System.err, argHandler);
pipe = argHandler.createDebugeeIOPipe(log);
try {
Thread thread1 = JDIThreadFactory.newThread(new hashcode001aThread("thread1"));
thread1 = JDIThreadFactory.newThread(new hashcode001aThread("thread1"));
synchronized (lock) {
synchronized(wait) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -71,7 +71,7 @@ public class invokemethod002 {
static final String DEBUGGEE_THRNAME = "invokemethod002tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 62;
static final int DEBUGGEE_STOPATLINE = 64;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR = "invokemethod002tdummyCls";
@ -124,14 +124,15 @@ public class invokemethod002 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
rType[0] = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
rType[0] = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
// Check the tested assersion
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,7 @@ import nsk.share.jdi.*;
*/
public class invokemethod002t {
static {} // force javac to produce <clinit> method
static Thread testThread = null;
invokemethod002t() {} // force javac to produce <init> method
@ -49,7 +50,8 @@ public class invokemethod002t {
IOPipe pipe = argHandler.createDebugeeIOPipe();
invokemethod002tDummyClass invokemethod002tdummyCls = new invokemethod002tDummyClass();
Thread.currentThread().setName(invokemethod002.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod002.DEBUGGEE_THRNAME);
pipe.println(invokemethod002.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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,7 +58,7 @@ public class invokemethod003 {
static final String DEBUGGEE_THRNAME = "invokemethod003tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 59;
static final int DEBUGGEE_STOPATLINE = 62;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR =
@ -135,13 +135,6 @@ public class invokemethod003 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
@ -150,6 +143,14 @@ public class invokemethod003 {
// debuggee dummy abstract class
rType[2] = debuggee.classByName(DEBUGGEE_ABSTRACTCLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class invokemethod003t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -46,7 +48,8 @@ public class invokemethod003t {
IOPipe pipe = argHandler.createDebugeeIOPipe();
invokemethod003tDummyClass invokemethod003tdummyCls = new invokemethod003tDummyClass();
Thread.currentThread().setName(invokemethod003.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod003.DEBUGGEE_THRNAME);
pipe.println(invokemethod003.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -111,9 +111,11 @@ public class invokemethod004 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -31,6 +31,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class invokemethod004t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -43,7 +45,8 @@ public class invokemethod004t {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
invokemethod004tDummyClass invokemethod004tdummyCls = new invokemethod004tDummyClass();
Thread.currentThread().setName(invokemethod004.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod004.DEBUGGEE_THRNAME);
pipe.println(invokemethod004.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -51,7 +51,7 @@ public class invokemethod005 {
static final String DEBUGGEE_THRNAME = "invokemethod005tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 58;
static final int DEBUGGEE_STOPATLINE = 61;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR =
@ -113,16 +113,17 @@ public class invokemethod005 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
// Check the tested assersion
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class invokemethod005t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -45,7 +47,8 @@ public class invokemethod005t {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
invokemethod005tDummyClass invokemethod005tdummyCls = new invokemethod005tDummyClass();
Thread.currentThread().setName(invokemethod005.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod005.DEBUGGEE_THRNAME);
pipe.println(invokemethod005.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -50,7 +50,7 @@ public class invokemethod006 {
static final String DEBUGGEE_THRNAME = "invokemethod006tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 58;
static final int DEBUGGEE_STOPATLINE = 61;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR =
@ -111,16 +111,17 @@ public class invokemethod006 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
// Check the tested assersion
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class invokemethod006t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -45,7 +47,8 @@ public class invokemethod006t {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
invokemethod006tDummyClass invokemethod006tdummyCls = new invokemethod006tDummyClass();
Thread.currentThread().setName(invokemethod006.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod006.DEBUGGEE_THRNAME);
pipe.println(invokemethod006.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -51,7 +51,7 @@ public class invokemethod007 {
static final String DEBUGGEE_THRNAME = "invokemethod007tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 58;
static final int DEBUGGEE_STOPATLINE = 61;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR =
@ -127,16 +127,17 @@ public class invokemethod007 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[2];
// debuggee main class
rType[0] = debuggee.classByName(DEBUGGEE_CLASS);
// Check the tested assersion
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class invokemethod007t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -45,7 +47,8 @@ public class invokemethod007t {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
invokemethod007tDummyClass invokemethod007tdummyCls = new invokemethod007tDummyClass();
Thread.currentThread().setName(invokemethod007.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod007.DEBUGGEE_THRNAME);
pipe.println(invokemethod007.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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,7 +58,7 @@ public class invokemethod008 {
static final String DEBUGGEE_THRNAME = "invokemethod008tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 69;
static final int DEBUGGEE_STOPATLINE = 71;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR =
@ -120,19 +120,20 @@ public class invokemethod008 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// reference types of debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -34,6 +34,7 @@ import nsk.share.jdi.*;
*/
public class invokemethod008t {
static Log log;
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
@ -56,7 +57,8 @@ public class invokemethod008t {
invokemethod008tDummySuperSuperClass invokemethod008tdummySSCls =
new invokemethod008tDummySuperSuperClass();
Thread.currentThread().setName(invokemethod008.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod008.DEBUGGEE_THRNAME);
pipe.println(invokemethod008.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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,7 +58,7 @@ public class invokemethod009 {
static final String DEBUGGEE_THRNAME = "invokemethod009tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 69;
static final int DEBUGGEE_STOPATLINE = 71;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR =
@ -120,19 +120,20 @@ public class invokemethod009 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// reference types of debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
thrRef = debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -34,6 +34,7 @@ import nsk.share.jdi.*;
*/
public class invokemethod009t {
static Log log;
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
@ -56,7 +57,8 @@ public class invokemethod009t {
invokemethod009tDummySuperSuperClass invokemethod009tdummySSCls =
new invokemethod009tDummySuperSuperClass();
Thread.currentThread().setName(invokemethod009.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod009.DEBUGGEE_THRNAME);
pipe.println(invokemethod009.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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,7 +55,7 @@ public class invokemethod014 {
static final String DEBUGGEE_THRNAME = "invokemethod014tThr";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 72;
static final int DEBUGGEE_STOPATLINE = 74;
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR =
@ -143,20 +143,21 @@ public class invokemethod014 {
return quitDebuggee();
}
ThreadReference thrRef;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ReferenceType[] rType = new ReferenceType[3];
// debuggee main & dummy classes
rType[0] = debuggee.classByName(DEBUGGEE_CLASSES[0]);
rType[1] = debuggee.classByName(DEBUGGEE_CLASSES[1]);
rType[2] = debuggee.classByName(DEBUGGEE_CLASSES[2]);
ThreadReference thrRef =
debuggee.threadByFieldName(rType[0], "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// Check the tested assersion
try {
suspendAtBP(rType[0], DEBUGGEE_STOPATLINE);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -34,6 +34,7 @@ import nsk.share.jdi.*;
*/
public class invokemethod014t {
public static Log log;
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
@ -58,7 +59,8 @@ public class invokemethod014t {
log = argHandler.createDebugeeLog();
Thread.currentThread().setName(invokemethod014.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(invokemethod014.DEBUGGEE_THRNAME);
// Now the debuggee is ready for testing
pipe.println(invokemethod014.COMMAND_READY);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -109,9 +109,11 @@ public class setvalue002 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee's thread "
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
@ -208,6 +210,10 @@ public class setvalue002 {
Iterator iter = fields.iterator();
while (iter.hasNext()) {
Field fld = (Field) iter.next();
if (fld.name().equals("testThread")) {
// skip the static testThread field
continue;
}
try {
log.display("\nTrying to set value for the field \""
+ fld.name() + "\"\n\tfrom the debuggee's object reference \""
@ -229,7 +235,7 @@ public class setvalue002 {
log.complain("TEST FAILED: ObjectReference.setValue(): caught unexpected "
+ e + "\n\tinstead of expected IllegalArgumentException"
+ "\n\twhen attempted to set value for the field \""
+ fld.name() + "\"\n\tfrom the debuggee's object reference \""
+ fld.name() + "\"\n\tfrom the de19buggee's object reference \""
+ objRef
+ "\n\tusing not valid Field's value from the other object reference \""
+ fldObjRef + "\"");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -31,6 +31,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class setvalue002t {
static Thread testThread = null;
// tested static fields
static byte sByteFld = 127;
static short sShortFld = -32768;
@ -53,7 +55,6 @@ public class setvalue002t {
boolean booleanFld = false;
String strFld = "instance field";
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -67,7 +68,8 @@ public class setvalue002t {
IOPipe pipe = argHandler.createDebugeeIOPipe();
setvalue002tDummyClass dummyCls = new setvalue002tDummyClass();
Thread.currentThread().setName(setvalue002.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(setvalue002.DEBUGGEE_THRNAME);
pipe.println(setvalue002.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -142,9 +142,11 @@ public class setvalue003 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee's thread "
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -31,6 +31,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class setvalue003t {
static Thread testThread = null;
// tested static fields
static byte sByteFld = Byte.MAX_VALUE;
static short sShortFld = Short.MAX_VALUE;
@ -53,7 +55,6 @@ public class setvalue003t {
boolean booleanFld = false;
String strFld = "instance field";
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -66,7 +67,8 @@ public class setvalue003t {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe setvalue003tPipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(setvalue003.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(setvalue003.DEBUGGEE_THRNAME);
setvalue003tPipe.println(setvalue003.COMMAND_READY);
String cmd = setvalue003tPipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -122,9 +122,11 @@ public class setvalue004 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee's thread "
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee's thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2022, 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
@ -31,6 +31,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class setvalue004t {
static Thread testThread = null;
// tested static final fields
static final byte sByteFld = 127;
static final short sShortFld = -32768;
@ -65,7 +67,8 @@ public class setvalue004t {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe setvalue004tPipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(setvalue004.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(setvalue004.DEBUGGEE_THRNAME);
setvalue004tPipe.println(setvalue004.COMMAND_READY);
String cmd = setvalue004tPipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -109,9 +109,11 @@ public class setvalue005 {
return quitDebuggee();
}
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: Method Debugee.threadByName() returned null for debuggee thread "
ReferenceType debuggeeClass = debuggee.classByName(DEBUGGEE_CLASS); // debuggee main class
thrRef = debuggee.threadByFieldName(debuggeeClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: Method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -31,6 +31,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class setvalue005t {
static Thread testThread = null;
// dummy instance uninitialized fields of reference types
setvalue005tDummyType dummyType;
setvalue005tAbsDummyType absDummyType;
@ -48,7 +50,8 @@ public class setvalue005t {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe setvalue005tPipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(setvalue005.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(setvalue005.DEBUGGEE_THRNAME);
setvalue005tPipe.println(setvalue005.COMMAND_READY);
String cmd = setvalue005tPipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -71,7 +71,9 @@ package nsk.jdi.ReferenceType.defaultStratum.defaultStratum003;
import java.io.*;
import java.util.*;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.StepRequest;
import com.sun.jdi.ThreadReference;
import nsk.share.Consts;
import nsk.share.TestBug;
import nsk.share.jdi.EventHandler;
@ -166,8 +168,12 @@ public class defaultStratum003 extends SDEDebugger {
StepEventListener stepEventListener = new StepEventListener();
eventHandler.addListener(stepEventListener);
ReferenceType debuggeeClass = debuggee.classByName(SDEDebuggee.class.getName());
ThreadReference mainThread =
debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread",
SDEDebuggee.mainThreadName);
StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest(
debuggee.threadByName(SDEDebuggee.mainThreadName),
mainThread,
StepRequest.STEP_LINE,
StepRequest.STEP_INTO);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -61,7 +61,9 @@ package nsk.jdi.ReferenceType.defaultStratum.defaultStratum004;
import java.io.*;
import java.util.*;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.StepRequest;
import com.sun.jdi.ThreadReference;
import nsk.share.Consts;
import nsk.share.TestBug;
import nsk.share.jdi.EventHandler;
@ -165,11 +167,16 @@ public class defaultStratum004 extends SDEDebugger {
StepEventListener stepEventListener = new StepEventListener();
eventHandler.addListener(stepEventListener);
ReferenceType debuggeeClass = debuggee.classByName(SDEDebuggee.class.getName());
ThreadReference mainThread =
debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread",
SDEDebuggee.mainThreadName);
// perform step events generation 3 times
for (int i = 0; i < 3; i++) {
for (String testedClassName : classLocations.keySet()) {
StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest(
debuggee.threadByName(SDEDebuggee.mainThreadName),
mainThread,
StepRequest.STEP_LINE,
StepRequest.STEP_INTO);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -60,7 +60,7 @@ public class sourcename004 {
static final String DEBUGGEE_METHOD = "sourcename004trunIt";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 57;
static final int DEBUGGEE_STOPATLINE = 60;
static final int FLD_NUM = 24;
// tested fields used to provoke the exception
@ -135,15 +135,18 @@ public class sourcename004 {
}
try {
// debuggee main thread
ThreadReference thrRef = null;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null)
throw new Failure("method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
// debuggee main thread
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
throw new Failure("method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
}
// debuggee main class
Method meth = debuggee.methodByName(rType, DEBUGGEE_METHOD);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(thrRef, meth);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is debuggee class.
*/
public class sourcename004t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -44,7 +46,8 @@ public class sourcename004t {
private int sourcename004trunIt(String args[]) {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(sourcename004.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(sourcename004.DEBUGGEE_THRNAME);
pipe.println(sourcename004.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -60,7 +60,7 @@ public class sourcenames002 {
static final String DEBUGGEE_METHOD = "sourcenames002trunIt";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 57;
static final int DEBUGGEE_STOPATLINE = 60;
static final int FLD_NUM = 24;
// tested fields used to provoke the exception
@ -135,15 +135,17 @@ public class sourcenames002 {
}
try {
// debuggee main thread
ThreadReference thrRef = null;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null)
throw new Failure("method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
// debuggee main thread
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
throw new Failure("method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
}
Method meth = debuggee.methodByName(rType, DEBUGGEE_METHOD);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
ObjectReference objRef = findObjRef(thrRef, meth);

View File

@ -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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is debuggee class.
*/
public class sourcenames002t {
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -44,7 +46,8 @@ public class sourcenames002t {
private int sourcenames002trunIt(String args[]) {
ArgumentHandler argHandler = new ArgumentHandler(args);
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(sourcenames002.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(sourcenames002.DEBUGGEE_THRNAME);
pipe.println(sourcenames002.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -51,15 +51,14 @@ public class getvalue003 {
"nsk.jdi.StackFrame.getValue.getvalue003t";
// names of debuggee threads
static final String DEBUGGEE_THRDNAMES[] = {
"getvalue003tMainThr", "getvalue003tAuxThr"
};
static final String DEBUGGEE_MAIN_THREAD_NAME = "getvalue003tMainThr";
static final String DEBUGGEE_AUX_THREAD_NAME = "getvalue003tAuxThr";
// debuggee local var used in testing
static final String DEBUGGEE_LOCALVAR = "getvalue003tFindMe";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 69;
static final int DEBUGGEE_STOPATLINE = 72;
static final int DELAY = 500; // in milliseconds
@ -105,33 +104,30 @@ public class getvalue003 {
return quitDebuggee();
}
ThreadReference thrRef[] = new ThreadReference[2];
for (int i=0; i<2; i++)
if ((thrRef[i] =
debuggee.threadByName(DEBUGGEE_THRDNAMES[i])) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRDNAMES[i]);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference mainThread =
debuggee.threadByFieldNameOrThrow(rType, "mainThread",
DEBUGGEE_MAIN_THREAD_NAME);
ThreadReference auxThread =
debuggee.threadByFieldNameOrThrow(rType, "auxThr",
DEBUGGEE_AUX_THREAD_NAME);
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// get a stack frame which belongs to the "getvalue003tMainThr" thread
StackFrame stFrame = findFrame(thrRef[0], DEBUGGEE_LOCALVAR, false);
StackFrame stFrame = findFrame(mainThread, DEBUGGEE_LOCALVAR, false);
// store a LocalVariable which belongs to the "getvalue003tAuxThr" thread
findFrame(thrRef[1], DEBUGGEE_LOCALVAR, true);
findFrame(auxThread, DEBUGGEE_LOCALVAR, true);
log.display("\nTrying to get value of local variable \""
+ wrongLocVar
+ "\"\n\tgotten from thread \"" + thrRef[1]
+ "\"\n\tgotten from thread \"" + auxThread
+ "\"\n\tusing stack frame \"" + stFrame
+ "\"\n\tbelongs to thread \"" + thrRef[0]
+ "\"\n\tbelongs to thread \"" + mainThread
+ "\" ...");
// Check the tested assersion
@ -140,9 +136,9 @@ public class getvalue003 {
log.complain("TEST FAILED: expected IllegalArgumentException was not thrown"
+ "\n\twhen attempted to get value of local variable \""
+ wrongLocVar
+ "\"\n\tgotten from thread \"" + thrRef[1]
+ "\"\n\tgotten from thread \"" + auxThread
+ "\"\n\tusing stack frame \"" + stFrame
+ "\"\n\tbelongs to thread \"" + thrRef[0] + "\"");
+ "\"\n\tbelongs to thread \"" + mainThread + "\"");
tot_res = Consts.TEST_FAILED;
} catch(IllegalArgumentException ee) {
log.display("CHECK PASSED: caught expected " + ee);
@ -152,9 +148,9 @@ public class getvalue003 {
+ ue + "\n\tinstead of IllegalArgumentException"
+ "\n\twhen attempted to get value of local variable \""
+ wrongLocVar
+ "\"\n\tgotten from thread \"" + thrRef[1]
+ "\"\n\tgotten from thread \"" + auxThread
+ "\"\n\tusing stack frame \"" + stFrame
+ "\"\n\tbelongs to thread \"" + thrRef[0] + "\"");
+ "\"\n\tbelongs to thread \"" + mainThread + "\"");
tot_res = Consts.TEST_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -34,7 +34,9 @@ import nsk.share.jdi.*;
public class getvalue003t {
private Log log;
private IOPipe pipe;
private OtherThr auxThr;
static Thread mainThread = null;
static OtherThr auxThr = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
@ -50,7 +52,8 @@ public class getvalue003t {
log = argHandler.createDebugeeLog();
pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(getvalue003.DEBUGGEE_THRDNAMES[0]);
mainThread = Thread.currentThread();
mainThread.setName(getvalue003.DEBUGGEE_MAIN_THREAD_NAME);
startThread();
// local var used by debugger to find appropriate stack frame
@ -81,8 +84,7 @@ public class getvalue003t {
private void startThread() {
Object readyObj = new Object();
auxThr = new OtherThr(readyObj,
getvalue003.DEBUGGEE_THRDNAMES[1]);
auxThr = new OtherThr(readyObj, getvalue003.DEBUGGEE_AUX_THREAD_NAME);
auxThr.setDaemon(true);
log.display("Debuggee: starting thread \""

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -52,9 +52,8 @@ public class getvalues003 {
"nsk.jdi.StackFrame.getValues.getvalues003t";
// names of debuggee threads
static final String DEBUGGEE_THRDNAMES[] = {
"getvalues003tMainThr", "getvalues003tAuxThr"
};
static final String DEBUGGEE_MAIN_THREAD_NAME = "getvalues003tMainThr";
static final String DEBUGGEE_AUX_THREAD_NAME = "getvalues003tAuxThr";
// tested debuggee local vars
static final int VAR_NUM = 9;
@ -65,7 +64,7 @@ public class getvalues003 {
};
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 78;
static final int DEBUGGEE_STOPATLINE = 81;
static final int DELAY = 500; // in milliseconds
@ -111,27 +110,24 @@ public class getvalues003 {
return quitDebuggee();
}
ThreadReference thrRef[] = new ThreadReference[2];
for (int i=0; i<2; i++)
if ((thrRef[i] =
debuggee.threadByName(DEBUGGEE_THRDNAMES[i])) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRDNAMES[i]);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference mainThread =
debuggee.threadByFieldNameOrThrow(rType, "mainThread",
DEBUGGEE_MAIN_THREAD_NAME);
ThreadReference auxThread =
debuggee.threadByFieldNameOrThrow(rType, "auxThr",
DEBUGGEE_AUX_THREAD_NAME);
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// get a stack frame which belongs to the "getvalue003tMainThr" thread
StackFrame stFrame = findFrame(thrRef[0], DEBUGGEE_VARS[0], true);
StackFrame stFrame = findFrame(mainThread, DEBUGGEE_VARS[0], true);
// store a LocalVariable which belongs to the "getvalue003tAuxThr" thread
StackFrame wrongStFrame = findFrame(thrRef[1], DEBUGGEE_VARS[0], false);
StackFrame wrongStFrame = findFrame(auxThread, DEBUGGEE_VARS[0], false);
StringBuffer varNames = new StringBuffer();
Iterator varIter = locVars.iterator();
@ -153,13 +149,13 @@ public class getvalues003 {
log.display("\n" + (i+1)
+ ") Trying to get values of local variables:"
+ varNames
+ "\n\tgotten from thread \"" + thrRef[0]
+ "\n\tgotten from thread \"" + mainThread
+ "\"\n\tand wrongly, of local variable\n\t\t"
+ wrongLocVar.typeName() + " " + wrongLocVar.name()
+ " " + wrongLocVar.signature()
+ "\n\tgotten from thread \"" + thrRef[1]
+ "\n\tgotten from thread \"" + auxThread
+ "\"\n\tusing stack frame \"" + stFrame
+ "\"\n\tin the thread \"" + thrRef[0]
+ "\"\n\tin the thread \"" + mainThread
+ "\" ...");
// Check the tested assersion
@ -168,13 +164,13 @@ public class getvalues003 {
log.complain("TEST FAILED: expected IllegalArgumentException was not thrown"
+ "\n\twhen attempted to get values of local variables:"
+ varNames
+ "\"\n\tgotten from thread \"" + thrRef[0]
+ "\"\n\tgotten from thread \"" + mainThread
+ "\"\n\tand wrongly, of local variable\n\t\t"
+ wrongLocVar.typeName() + " " + wrongLocVar.name()
+ " " + wrongLocVar.signature()
+ "\n\tgotten from thread \"" + thrRef[1]
+ "\n\tgotten from thread \"" + auxThread
+ "\"\n\tusing stack frame \"" + stFrame
+ "\"\n\tin the thread \"" + thrRef[0] + "\"");
+ "\"\n\tin the thread \"" + mainThread + "\"");
tot_res = Consts.TEST_FAILED;
} catch(IllegalArgumentException ee) {
log.display("CHECK PASSED: caught expected " + ee);
@ -184,13 +180,13 @@ public class getvalues003 {
+ ue + "\n\tinstead of IllegalArgumentException"
+ "\n\twhen attempted to get values of local variables:"
+ varNames
+ "\"\n\tgotten from thread \"" + thrRef[0]
+ "\"\n\tgotten from thread \"" + mainThread
+ "\"\n\tand wrongly, of local variable\n\t\t"
+ wrongLocVar.typeName() + " " + wrongLocVar.name()
+ " " + wrongLocVar.signature()
+ "\"\n\tgotten from thread \"" + thrRef[1]
+ "\"\n\tgotten from thread \"" + auxThread
+ "\"\n\tusing stack frame \"" + stFrame
+ "\"\n\tin the thread \"" + thrRef[0] + "\"");
+ "\"\n\tin the thread \"" + mainThread + "\"");
tot_res = Consts.TEST_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -35,7 +35,9 @@ import nsk.share.jdi.*;
public class getvalues003t {
private Log log;
private IOPipe pipe;
private OtherThr auxThr;
static Thread mainThread = null;
static OtherThr auxThr = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
@ -51,7 +53,8 @@ public class getvalues003t {
log = argHandler.createDebugeeLog();
pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(getvalues003.DEBUGGEE_THRDNAMES[0]);
mainThread = Thread.currentThread();
mainThread.setName(getvalues003.DEBUGGEE_MAIN_THREAD_NAME);
startThread();
// dummy local vars used by debugger for testing
@ -90,8 +93,7 @@ public class getvalues003t {
private void startThread() {
Object readyObj = new Object();
auxThr = new OtherThr(readyObj,
getvalues003.DEBUGGEE_THRDNAMES[1]);
auxThr = new OtherThr(readyObj, getvalues003.DEBUGGEE_AUX_THREAD_NAME);
auxThr.setDaemon(true);
log.display("Debuggee: starting thread \""

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -111,7 +111,7 @@ public class setvalue005 {
};
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 67;
static final int DEBUGGEE_STOPATLINE = 70;
static final int DELAY = 500; // in milliseconds
@ -156,19 +156,19 @@ public class setvalue005 {
return quitDebuggee();
}
ThreadReference thrRef = null;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRDNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "mainThread", DEBUGGEE_THRDNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRDNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// find a stack frame which belongs to the "setvalue005tMainThr" thread

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class setvalue005t {
static Thread mainThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -46,7 +48,8 @@ public class setvalue005t {
Log log = argHandler.createDebugeeLog();
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(setvalue005.DEBUGGEE_THRDNAME);
mainThread = Thread.currentThread();
mainThread.setName(setvalue005.DEBUGGEE_THRDNAME);
// dummy local var used by debugger for stack frame searching
int setvalue005tFindMe = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -132,7 +132,7 @@ public class setvalue006 {
};
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 72;
static final int DEBUGGEE_STOPATLINE = 75;
static final int DELAY = 500; // in milliseconds
@ -177,19 +177,19 @@ public class setvalue006 {
return quitDebuggee();
}
ThreadReference thrRef = null;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRDNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "mainThread", DEBUGGEE_THRDNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRDNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// find a stack frame which belongs to the "setvalue006tMainThr" thread

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class setvalue006t {
static Thread mainThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
}
@ -46,7 +48,8 @@ public class setvalue006t {
Log log = argHandler.createDebugeeLog();
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(setvalue006.DEBUGGEE_THRDNAME);
mainThread = Thread.currentThread();
mainThread.setName(setvalue006.DEBUGGEE_THRDNAME);
// dummy local vars used by debugger to provoke InvalidTypeException
byte byteVar = Byte.MAX_VALUE;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -73,7 +73,9 @@ package nsk.jdi.StepEvent._itself_.stepEvent003;
import java.io.*;
import java.util.*;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.StepRequest;
import com.sun.jdi.ThreadReference;
import nsk.share.Consts;
import nsk.share.jdi.EventHandler;
import nsk.share.jdi.sde.*;
@ -165,8 +167,12 @@ public class stepEvent003 extends SDEDebugger {
StepEventListener stepEventListener = new StepEventListener();
eventHandler.addListener(stepEventListener);
ReferenceType debuggeeClass = debuggee.classByName(SDEDebuggee.class.getName());
ThreadReference mainThread =
debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread",
SDEDebuggee.mainThreadName);
StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest(
debuggee.threadByName(SDEDebuggee.mainThreadName),
mainThread,
StepRequest.STEP_LINE,
StepRequest.STEP_INTO);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -79,7 +79,9 @@ package nsk.jdi.StepEvent._itself_.stepEvent004;
import java.io.*;
import java.util.*;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.StepRequest;
import com.sun.jdi.ThreadReference;
import nsk.share.Consts;
import nsk.share.jdi.EventHandler;
import nsk.share.jdi.sde.*;
@ -230,8 +232,12 @@ public class stepEvent004 extends SDEDebugger {
StepEventListener stepEventListener = new StepEventListener();
eventHandler.addListener(stepEventListener);
ReferenceType debuggeeClass = debuggee.classByName(SDEDebuggee.class.getName());
ThreadReference mainThread =
debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread",
SDEDebuggee.mainThreadName);
StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest(
debuggee.threadByName(SDEDebuggee.mainThreadName),
mainThread,
StepRequest.STEP_LINE,
StepRequest.STEP_INTO);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -104,7 +104,7 @@ public class filter001 extends TestDebuggerType1 {
switch (i) {
case 0:
thread1 = debuggee.threadByName(threadName1);
thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1);
eventRequest1 = setting23StepRequest(thread1, "*" + testedClassName1,
EventRequest.SUSPEND_NONE, property1);
@ -131,7 +131,7 @@ public class filter001 extends TestDebuggerType1 {
break;
case 1:
thread2 = debuggee.threadByName(threadName2);
thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName2);
eventRequest2 = setting23StepRequest(thread2, testedClassName2 + "*",
EventRequest.SUSPEND_NONE, property2);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -105,7 +105,7 @@ public class filter_rt001 extends TestDebuggerType1 {
case 0:
testClassReference = (ReferenceType)debuggee.classByName(testedClassName);
thread1 = debuggee.threadByName(threadName1);
thread1 = debuggee.threadByFieldName(debuggeeClass, threadName1);
if (thread1 == null)
throw new Failure("Cannot get ThreadReference for " + threadName1);
eventRequest1 = setting21StepRequest(thread1, testClassReference,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -124,8 +124,8 @@ public class filter_rt003 extends TestDebuggerType1 {
testClassReference11 = (ReferenceType)debuggee.classByName(testedClassName11);
testClassReference21 = (ReferenceType)debuggee.classByName(testedClassName21);
thread1 = debuggee.threadByName(threadName1);
thread2 = debuggee.threadByName(threadName2);
thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1);
thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName2);
eventRequest1 = setting21StepRequest(thread1, testClassReference11,
EventRequest.SUSPEND_ALL, property1);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -105,7 +105,7 @@ public class filter_s001 extends TestDebuggerType1 {
switch (i) {
case 0:
thread1 = debuggee.threadByName(threadName1);
thread1 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName1);
eventRequest1 = setting23StepRequest(thread1, "*" + testedClassName1,
EventRequest.SUSPEND_ALL, property1);
@ -131,7 +131,7 @@ public class filter_s001 extends TestDebuggerType1 {
break;
case 1:
thread2 = debuggee.threadByName(threadName2);
thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, threadName2);
eventRequest2 = setting23StepRequest(thread2, testedClassName2 + "*",
EventRequest.SUSPEND_ALL, property2);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -205,7 +205,9 @@ public class interrupt001 {
}
private void executeCase(int testCase, String threadName2) {
ThreadReference thread2 = debuggee.threadByName(threadName2);
ReferenceType debuggeeClass = debuggee.classByName(debuggeeName);
ThreadReference thread2 =
debuggee.threadByFieldName(debuggeeClass, "thread2", threadName2);
if (thread2 == null) {
debuggee.quit();
throw new TestBug("ERROR: Not found ThreadReference for name :" + threadName2);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -91,10 +91,13 @@ public class ownedmonitors002 {
return quitDebuggee();
}
ThreadReference thrRef;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -31,13 +31,16 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class ownedmonitors002t {
static Thread testThread = null;
public static void main(String args[]) {
ArgumentHandler argHandler = new ArgumentHandler(args);
Log log = argHandler.createDebugeeLog();
IOPipe pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(ownedmonitors002.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(ownedmonitors002.DEBUGGEE_THRNAME);
// Now the debuggee is ready for testing
pipe.println(ownedmonitors002.COMMAND_READY);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -59,7 +59,7 @@ public class popframes006 {
static final String DEBUGGEE_FIELD = "wasPopped";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 80;
static final int DEBUGGEE_STOPATLINE = 83;
static final int ATTEMPTS = 5;
static final int DELAY = 500; // in milliseconds
@ -106,10 +106,13 @@ public class popframes006 {
return quitDebuggee();
}
ThreadReference thrRef = null;
if ((thrRef =
debuggee.threadByName(DEBUGGEE_THRNAME)) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef =
debuggee.threadByFieldName(rType, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
@ -117,9 +120,6 @@ public class popframes006 {
Field doExit = null;
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// debuggee field used to indicate that popping has been done

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,6 +33,8 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class popframes006t {
static Thread testThread = null;
private Log log;
private IOPipe pipe;
volatile boolean wasPopped = false;
@ -51,7 +53,8 @@ public class popframes006t {
log = argHandler.createDebugeeLog();
pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(popframes006.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(popframes006.DEBUGGEE_THRNAME);
pipe.println(popframes006.COMMAND_READY);
String cmd = pipe.readln();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -50,16 +50,16 @@ public class popframes007 {
"nsk.jdi.ThreadReference.popFrames.popframes007t";
// names of debuggee threads
static final String DEBUGGEE_THRDS[] = {
"popframes007tMainThr", "popframes007tAuxThr"
};
static final String DEBUGGEE_MAIN_THREAD_NAME = "popframes007tMainThr";
static final String DEBUGGEE_AUX_THREAD_NAME = "popframes007tAuxThr";
// debuggee local var used to find needed stack frame
static final String DEBUGGEE_LOCALVAR = "popframes007tFindMe";
// debuggee field used to indicate that popping has been done
static final String DEBUGGEE_FIELD = "leaveMethod";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 83;
static final int DEBUGGEE_STOPATLINE = 86;
static final int ATTEMPTS = 5;
static final int DELAY = 500; // in milliseconds
@ -106,44 +106,52 @@ public class popframes007 {
return quitDebuggee();
}
ThreadReference thrRef[] = new ThreadReference[2];
for (int i=0; i<2; i++)
if ((thrRef[i] =
debuggee.threadByName(DEBUGGEE_THRDS[i])) == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
+ DEBUGGEE_THRDS[i]);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference mainThread =
debuggee.threadByFieldName(rType, "mainThread", DEBUGGEE_MAIN_THREAD_NAME);
if (mainThread == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_MAIN_THREAD_NAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
ThreadReference auxThread =
debuggee.threadByFieldName(rType, "auxThr", DEBUGGEE_AUX_THREAD_NAME);
if (auxThread == null) {
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_AUX_THREAD_NAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
}
Field doExit = null;
try {
// debuggee main class
ReferenceType rType = debuggee.classByName(DEBUGGEE_CLASS);
suspendAtBP(rType, DEBUGGEE_STOPATLINE);
// debuggee field used to indicate that popping has been done
doExit = rType.fieldByName(DEBUGGEE_FIELD);
// debuggee stack frame to be popped which is not on specified thread's call stack
StackFrame stFrame = findFrame(thrRef[1], DEBUGGEE_LOCALVAR);
StackFrame stFrame = findFrame(auxThread, DEBUGGEE_LOCALVAR);
log.display("\nTrying to pop stack frame \"" + stFrame
+ "\"\n\tlocation \"" + stFrame.location()
+ "\"\n\tgot from thread reference \"" + thrRef[1]
+ "\"\n\tgot from thread reference \"" + auxThread
+ "\"\n\tand the frame is not on the following thread's call stack: \""
+ thrRef[0] + "\" ...");
+ mainThread + "\" ...");
// Check the tested assersion
try {
thrRef[0].popFrames(stFrame);
mainThread.popFrames(stFrame);
log.complain("TEST FAILED: expected IllegalArgumentException was not thrown"
+ "\n\twhen attempted to pop stack frame \"" + stFrame
+ "\"\n\tlocation \"" + stFrame.location()
+ "\"\n\tgot from thread reference \"" + thrRef[1]
+ "\"\n\tgot from thread reference \"" + auxThread
+ "\"\n\tand the frame is not on the following thread's call stack: \""
+ thrRef[0] + "\"");
+ mainThread + "\"");
tot_res = Consts.TEST_FAILED;
} catch(IllegalArgumentException ee) {
log.display("CHECK PASSED: caught expected " + ee);
@ -167,9 +175,9 @@ public class popframes007 {
+ ue + "\n\tinstead of IllegalArgumentException"
+ "\n\twhen attempted to pop stack \"" + stFrame
+ "\"\n\tlocation \"" + stFrame.location()
+ "\"\n\tgot from thread reference \"" + thrRef[1]
+ "\"\n\tgot from thread reference \"" + auxThread
+ "\"\n\tand the frame is not on the following thread's call stack: \""
+ thrRef[0] + "\"");
+ mainThread + "\"");
tot_res = Consts.TEST_FAILED;
}
} catch (Exception e) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, 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
@ -33,9 +33,11 @@ import nsk.share.jdi.*;
* This is a debuggee class.
*/
public class popframes007t {
static Thread mainThread = null;
static OtherThr auxThr = null;
private Log log;
private IOPipe pipe;
private OtherThr auxThr;
volatile boolean leaveMethod = false;
public static void main(String args[]) {
@ -52,7 +54,8 @@ public class popframes007t {
log = argHandler.createDebugeeLog();
pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(popframes007.DEBUGGEE_THRDS[0]);
mainThread = Thread.currentThread();
mainThread.setName(popframes007.DEBUGGEE_MAIN_THREAD_NAME);
startThread();
// Now the debuggee is ready for testing
@ -93,7 +96,7 @@ public class popframes007t {
Object readyObj = new Object();
auxThr = new OtherThr(readyObj,
popframes007.DEBUGGEE_THRDS[1], this);
popframes007.DEBUGGEE_AUX_THREAD_NAME, this);
auxThr.setDaemon(true);
log.display("Debuggee: starting thread \""

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -67,7 +67,7 @@ public class stop002 {
static final String DEBUGGEE_STOP_LOOP2_FIELD = "stopLooping2";
// debuggee source line where it should be stopped
static final int DEBUGGEE_STOPATLINE = 88;
static final int DEBUGGEE_STOPATLINE = 90;
static final int DELAY = 500; // in milliseconds
@ -115,9 +115,12 @@ public class stop002 {
return quitDebuggee();
}
ThreadReference thrRef = debuggee.threadByName(DEBUGGEE_THRNAME);
// debuggee main class
mainClass = debuggee.classByName(DEBUGGEE_CLASS);
ThreadReference thrRef = debuggee.threadByFieldName(mainClass, "testThread", DEBUGGEE_THRNAME);
if (thrRef == null) {
log.complain("TEST FAILURE: method Debugee.threadByName() returned null for debuggee thread "
log.complain("TEST FAILURE: method Debugee.threadByFieldName() returned null for debuggee thread "
+ DEBUGGEE_THRNAME);
tot_res = Consts.TEST_FAILED;
return quitDebuggee();
@ -128,9 +131,6 @@ public class stop002 {
ObjectReference objRef = null;
ObjectReference throwableRef = null;
try {
// debuggee main class
mainClass = debuggee.classByName(DEBUGGEE_CLASS);
suspendAtBP(mainClass, DEBUGGEE_STOPATLINE);
objRef = findObjRef(thrRef, DEBUGGEE_NON_THROWABLE_VAR);
throwableRef = findObjRef(thrRef, DEBUGGEE_THROWABLE_VAR);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, 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
@ -39,6 +39,7 @@ public class stop002t {
volatile boolean stopLooping2 = false;
volatile static int testNumReady = 0;
static final boolean vthreadMode = "Virtual".equals(System.getProperty("test.thread.factory"));
static Thread testThread = null;
public static void main(String args[]) {
System.exit(run(args) + Consts.JCK_STATUS_BASE);
@ -54,7 +55,8 @@ public class stop002t {
log = argHandler.createDebugeeLog();
pipe = argHandler.createDebugeeIOPipe();
Thread.currentThread().setName(stop002.DEBUGGEE_THRNAME);
testThread = Thread.currentThread();
testThread.setName(stop002.DEBUGGEE_THRNAME);
// non-throwable object which will be used by debugger
// as wrong parameter of JDI method ThreadReference.stop()

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -75,7 +75,9 @@ package nsk.jdi.VirtualMachine.setDefaultStratum.setDefaultStratum003;
import java.io.*;
import java.util.*;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.request.*;
import com.sun.jdi.ThreadReference;
import nsk.share.Consts;
import nsk.share.jdi.EventHandler;
import nsk.share.jdi.sde.*;
@ -150,8 +152,12 @@ public class setDefaultStratum003 extends SDEDebugger {
StepEventListener stepEventListener = new StepEventListener();
eventHandler.addListener(stepEventListener);
ReferenceType debuggeeClass = debuggee.classByName(SDEDebuggee.class.getName());
ThreadReference mainThread =
debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread",
SDEDebuggee.mainThreadName);
StepRequest stepRequest = debuggee.getEventRequestManager().createStepRequest(
debuggee.threadByName(SDEDebuggee.mainThreadName),
mainThread,
StepRequest.STEP_LINE,
StepRequest.STEP_INTO);

View File

@ -290,6 +290,24 @@ public class Debugee extends DebugeeProcess {
/**
* Return a debuggee thread by fetching it from a static field in the debuggee.
*/
public ThreadReference threadByFieldName(ReferenceType debuggeeClass,
String threadFieldName) {
return threadByFieldName(debuggeeClass, threadFieldName, threadFieldName);
}
public ThreadReference threadByFieldName(ReferenceType debuggeeClass,
String threadFieldName,
String threadName) {
try {
return threadByFieldNameOrThrow(debuggeeClass, threadFieldName, threadName);
} catch (JDITestRuntimeException e) {
log.display("** Unexpected exception trying to find thread \"" + threadName + "\"");
e.printStackTrace(log.getOutStream());
return null;
}
}
public ThreadReference threadByFieldNameOrThrow(ReferenceType debuggeeClass,
String threadFieldName)
throws JDITestRuntimeException {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -28,6 +28,7 @@ import nsk.share.jdi.*;
public class SDEDebuggee extends AbstractJDIDebuggee {
public static String mainThreadName = "SDEDebuggee_mainThread";
public static Thread mainThread = null;
// command:class_name
public static String COMMAND_EXECUTE_TEST_METHODS = "executeTestMethods";
@ -42,7 +43,8 @@ public class SDEDebuggee extends AbstractJDIDebuggee {
if (classpath == null)
throw new TestBug("Debuggee requires '-testClassPath' parameter");
Thread.currentThread().setName(mainThreadName);
mainThread = Thread.currentThread();
mainThread.setName(mainThreadName);
return args;
}