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
--- a/jdk/test/com/sun/jdi/NativeInstanceFilter.java Sun Mar 17 09:55:03 2013 +0000
+++ b/jdk/test/com/sun/jdi/NativeInstanceFilter.java Tue Mar 19 09:53:36 2013 +0100
@@ -57,6 +57,7 @@
static EventRequestManager requestManager = null;
static MethodExitRequest request = null;
+ static ThreadReference mainThread = null;
private void listen() {
TargetAdapter adapter = new TargetAdapter() {
@@ -77,6 +78,7 @@
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 @@
// 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();