Skip to content

Commit 20c329d

Browse files
committed
trigger fewer methodentry/exit events
1 parent 31596cf commit 20c329d

6 files changed

Lines changed: 40 additions & 12 deletions

File tree

test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java

Lines changed: 13 additions & 1 deletion
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, 2026, 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
@@ -212,6 +212,13 @@ private void hitClassBreakpoint(MethodEntryEvent event) {
212212
}
213213
display("method:\t" + event.location().method().name());
214214
display("line:\t" + event.location().lineNumber());
215+
216+
// When done() is called we disable the MethodEntryRequest because we don't
217+
// want it enabled while the debuggee exits. See JDK-8375076 and JDK-8384569.
218+
if (event.method().name().equals("done")) {
219+
return;
220+
}
221+
215222
if (event.location().lineNumber() == tc02x004a.checkClassBrkpLine) {
216223
display("ClassBreakpoint stops on the expected line "
217224
+ event.location().lineNumber() + " in method "
@@ -227,5 +234,10 @@ private void hitClassBreakpoint(MethodEntryEvent event) {
227234
display("");
228235

229236
brkpEventCount++;
237+
if (brkpEventCount == tc02x004a.threadCount) {
238+
// When done we disable the MethodEntryRequest because we don't
239+
// want it enabled while the debuggee exits. See JDK-8375076 and JDK-8384569.
240+
event.request().disable();
241+
}
230242
}
231243
}

test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java

Lines changed: 9 additions & 1 deletion
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, 2026, 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
@@ -209,6 +209,14 @@ private void hitMethodBreakpoint(MethodEntryEvent event) {
209209
display("\tmethod\t- " + event.location().method().name());
210210
display("\tline\t- " + event.location().lineNumber());
211211

212+
// When done() is called we disable the MethodEntryRequest because we don't
213+
// want it enabled while the debuggee exits. See JDK-8375076 and JDK-8384569.
214+
if (event.method().name().equals("done")) {
215+
display("done() called - disabling MethodEntryRequest\n");
216+
event.request().disable();
217+
return;
218+
}
219+
212220
if (!event.method().name().equals(methodName)) {
213221
display("the event skipped, method - " + event.method().name() + "\n");
214222
return;

test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java

Lines changed: 8 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, 2026, 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
@@ -29,14 +29,14 @@
2929
// THIS TEST IS LINE NUMBER SENSITIVE
3030

3131
/**
32-
* <code>tc04x001a</code> is deugee's part of the tc04x001.
32+
* <code>tc04x001a</code> is debugee's part of the tc04x001.
3333
*/
3434
public class tc04x001a {
3535

3636
public final static int threadCount = 3;
3737
static Log log;
3838

39-
public final static int checkMethodBrkpLine = 73;
39+
public final static int checkMethodBrkpLine = 74;
4040
Thread[] thrds = new Thread[threadCount];
4141

4242
public static void main (String argv[]) {
@@ -58,6 +58,7 @@ public static void main (String argv[]) {
5858
System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE);
5959
}
6060
}
61+
done(); // Signal the disabling of MethodEntryRequest
6162
log.display("completed succesfully.");
6263
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
6364
}
@@ -77,6 +78,10 @@ public static void bar(String caller) {
7778
log.display(caller + "::bar is called");
7879
}
7980

81+
public static void done() {
82+
log.display("done is called");
83+
}
84+
8085
static class Thready extends NamedTask {
8186
Thready(String name) {
8287
super(name);

test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ private void execTest() throws Failure {
160160
if (eventIterator != null) {
161161
while (eventIterator.hasNext()) {
162162
event = eventIterator.nextEvent();
163-
// display("\nevent ===>>> " + event);
163+
display("\nevent ===>>> " + event);
164164

165165
if (event instanceof ClassPrepareEvent) {
166-
display("\nevent ===>>> " + event);
167166
testedClass = (ClassType )debugee.classByName(testedClassName);
168167
debugeeClass = (ClassType )debugee.classByName(debugeeName);
169168

@@ -179,11 +178,9 @@ private void execTest() throws Failure {
179178
debugee.resume();
180179

181180
} else if (event instanceof MethodExitEvent) {
182-
display("\nevent ===>>> " + event);
183181
hitMethodExitEvent((MethodExitEvent )event);
184182

185183
} else if (event instanceof MethodEntryEvent) {
186-
display("\nevent ===>>> " + event);
187184
hitMethodEntryEvent((MethodEntryEvent )event);
188185
display("\nresuming...");
189186
debugee.resume();

test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java

Lines changed: 7 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, 2026, 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
@@ -30,14 +30,19 @@
3030
import java.io.*;
3131

3232
/**
33-
* <code>popframes001a</code> is deugee's part of the popframes001.
33+
* <code>popframes001a</code> is debugee's part of the popframes001.
3434
*/
3535

3636
public class popframes001a {
3737

3838
volatile public static boolean finishIt = false;
3939

4040
public static void main(String argv[]) {
41+
// The following will cause intialization of a bunch of classes before we
42+
// enable MethoEntry/Exit events, which would otherwise result in long test runs.
43+
// See JDK-8375076 and JDK-8384569.
44+
System.getLogger("java.lang.Runtime");
45+
4146
ArgumentHandler argHandler = new ArgumentHandler(argv);
4247
Log log = new Log(System.out, argHandler);
4348

test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2026, 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
@@ -408,6 +408,7 @@ private void testRun()
408408
}
409409

410410
log2("......disabling requests and resuming vm");
411+
meRequest.disable();
411412
meRequest3.disable();
412413
vm.resume();
413414

0 commit comments

Comments
 (0)