From b37653f1135aeccd2caacb775450a324c6a8db86 Mon Sep 17 00:00:00 2001 From: sla Date: Tue, 19 Mar 2013 09:53:36 +0100 Subject: [PATCH] 8006637: Failure to filter out native frame events on Solaris Summary: Test is confused by other threads calling String.intern(). Add a thread filter to avoid this. Reviewed-by: sspitsyn, alanb --- test/com/sun/jdi/NativeInstanceFilter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/com/sun/jdi/NativeInstanceFilter.java b/test/com/sun/jdi/NativeInstanceFilter.java index eaa501a35..790297111 100644 --- a/test/com/sun/jdi/NativeInstanceFilter.java +++ b/test/com/sun/jdi/NativeInstanceFilter.java @@ -57,6 +57,7 @@ public class NativeInstanceFilter extends JDIScaffold { static EventRequestManager requestManager = null; static MethodExitRequest request = null; + static ThreadReference mainThread = null; private void listen() { TargetAdapter adapter = new TargetAdapter() { @@ -77,6 +78,7 @@ public class NativeInstanceFilter extends JDIScaffold { requestManager.deleteEventRequest(request); request = requestManager.createMethodExitRequest(); request.addInstanceFilter(instance); + request.addThreadFilter(mainThread); request.enable(); } else if (instance != null && name.equals("intern")) { // If not for the filter, this will be called twice @@ -101,10 +103,12 @@ public class NativeInstanceFilter extends JDIScaffold { // VM has started, but hasn't started running the test program yet. requestManager = vm().eventRequestManager(); - ReferenceType referenceType = - resumeToPrepareOf("NativeInstanceFilterTarg").referenceType(); + ClassPrepareEvent e = resumeToPrepareOf("NativeInstanceFilterTarg"); + ReferenceType referenceType = e.referenceType(); + mainThread = e.thread(); request = requestManager.createMethodExitRequest(); + request.addThreadFilter(mainThread); request.enable(); listen(); -- GitLab