From d2e7d3f2fc0f6d9c64e03574e344bace51c23a80 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Thu, 7 May 2015 11:01:37 +0200 Subject: [PATCH] 8079360: AttachProviderImpl could not be instantiated Reviewed-by: dsamersoff, sspitsyn, ihse --- jdk/make/lib/Lib-jdk.attach.gmk | 8 +++++++- .../classes/com/sun/tools/attach/spi/AttachProvider.java | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/jdk/make/lib/Lib-jdk.attach.gmk b/jdk/make/lib/Lib-jdk.attach.gmk index c64867c070d..dbabea5b733 100644 --- a/jdk/make/lib/Lib-jdk.attach.gmk +++ b/jdk/make/lib/Lib-jdk.attach.gmk @@ -27,6 +27,12 @@ include LibCommon.gmk ################################################################################ +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 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \ 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), \ diff --git a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/spi/AttachProvider.java b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/spi/AttachProvider.java index 4948be78031..2d9aa9cfbc2 100644 --- a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/spi/AttachProvider.java +++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/spi/AttachProvider.java @@ -241,7 +241,7 @@ public abstract class AttachProvider { * (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 @@ public abstract class AttachProvider { 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(); } } }