8079360: AttachProviderImpl could not be instantiated
authorsla
Thu, 07 May 2015 11:01:37 +0200
changeset 30670 9663e1b741df
parent 30668 0a794f3b88c9
child 30671 e15162aff527
child 30672 304ed79789c7
8079360: AttachProviderImpl could not be instantiated Reviewed-by: dsamersoff, sspitsyn, ihse
jdk/make/lib/Lib-jdk.attach.gmk
jdk/src/jdk.attach/share/classes/com/sun/tools/attach/spi/AttachProvider.java
--- a/jdk/make/lib/Lib-jdk.attach.gmk	Wed May 06 20:37:33 2015 +0200
+++ b/jdk/make/lib/Lib-jdk.attach.gmk	Thu May 07 11:01:37 2015 +0200
@@ -27,6 +27,12 @@
 
 ################################################################################
 
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  # In (at least) VS2013 and later, -DPSAPI_VERSION=1 is needed to generate
+  # a binary that is compatible with windows versions older than 7/2008R2.
+  # See MSDN documentation for GetProcessMemoryInfo for more information.
+  LIBATTACH_CFLAGS := -DPSAPI_VERSION=1
+endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
     LIBRARY := attach, \
@@ -35,7 +41,7 @@
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
-        $(LIBJAVA_HEADER_FLAGS), \
+        $(LIBJAVA_HEADER_FLAGS) $(LIBATTACH_CFLAGS), \
     CFLAGS_windows := /Gy, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
--- a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/spi/AttachProvider.java	Wed May 06 20:37:33 2015 +0200
+++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/spi/AttachProvider.java	Thu May 07 11:01:37 2015 +0200
@@ -241,7 +241,7 @@
      * (using the zero-arg constructor) at the first invocation of this method.
      * The list returned by the first invocation of this method is the list
      * of providers. Subsequent invocations of this method return a list of the same
-     * providers. The list is unmodifable.
+     * providers. The list is unmodifiable.
      *
      * @return  A list of the installed attach providers.
      */
@@ -264,8 +264,8 @@
                             ThreadDeath td = (ThreadDeath)t;
                             throw td;
                         }
-                        // Ignore errors and exceptions
-                        System.err.println(t);
+                        // Log errors and exceptions since we cannot return them
+                        t.printStackTrace();
                     }
                 }
             }