From 37037f4f6b33f9f4d96aa48485b9b671b206cd74 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Wed, 12 Mar 2025 16:47:40 +0100 Subject: [PATCH 1/2] JDK-8351842 --- make/Bundles.gmk | 18 ++++++------------ make/CreateJmods.gmk | 14 ++++---------- make/common/native/DebugSymbols.gmk | 7 ++++--- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/make/Bundles.gmk b/make/Bundles.gmk index 58950b5fb1f71..ee5bc06c56873 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -125,11 +125,11 @@ define SetupBundleFileBody && $(TAR) cf - -$(TAR_INCLUDE_PARAM) $$($1_$$d_LIST_FILE) \ $(TAR_IGNORE_EXIT_VALUE) ) \ | ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )$$(NEWLINE) ) - # Rename stripped pdb files + # Rename full pdb files for symbols bundle ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public) - for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.stripped.pdb"`; do \ - $(ECHO) Renaming $$$${f} to $$$${f%stripped.pdb}pdb $(LOG_INFO); \ - $(MV) $$$${f} $$$${f%stripped.pdb}pdb; \ + for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.full.pdb"`; do \ + $(ECHO) Renaming $$$${f} to $$$${f%full.pdb}pdb $(LOG_INFO); \ + $(MV) $$$${f} $$$${f%full.pdb}pdb; \ done endif # Unzip any zipped debuginfo files @@ -223,10 +223,7 @@ ifneq ($(filter product-bundles% legacy-bundles, $(MAKECMDGOALS)), ) else ifeq ($(SHIP_DEBUG_SYMBOLS), public) JDK_SYMBOLS_EXCLUDE_PATTERN := \ - $(filter-out \ - %.stripped.pdb, \ - $(filter %.pdb, $(ALL_JDK_FILES)) \ - ) + $(filter %.full.pdb, $(ALL_JDK_FILES)) endif endif endif @@ -265,10 +262,7 @@ ifneq ($(filter product-bundles% legacy-bundles, $(MAKECMDGOALS)), ) else ifeq ($(SHIP_DEBUG_SYMBOLS), public) JRE_SYMBOLS_EXCLUDE_PATTERN := \ - $(filter-out \ - %.stripped.pdb, \ - $(filter %.pdb, $(ALL_JRE_FILES)) \ - ) + $(filter %.full.pdb, $(ALL_JRE_FILES)) endif endif endif diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index 40bceda69a97f..551dcebd7ee2b 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -60,16 +60,13 @@ $(call FillFindCache, \ ifneq ($(LIBS_DIR), ) DEPS += $(call FindFiles, $(LIBS_DIR)) ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public) - # For public debug symbols on Windows, we have to use stripped pdbs and rename them - rename_stripped = $(patsubst %.stripped.pdb,%.pdb,$1) + # For public debug symbols on Windows, we have to filter out full pdbs LIBS_DIR_FILTERED := $(subst modules_libs,modules_libs_filtered, $(LIBS_DIR)) - FILES_LIBS := $(filter-out %.pdb, $(call FindFiles, $(LIBS_DIR))) \ - $(filter %.stripped.pdb, $(call FindFiles, $(LIBS_DIR))) + FILES_LIBS := $(filter-out %.full.pdb, $(call FindFiles, $(LIBS_DIR))) $(eval $(call SetupCopyFiles, COPY_FILTERED_LIBS, \ SRC := $(LIBS_DIR), \ DEST := $(LIBS_DIR_FILTERED), \ FILES := $(FILES_LIBS), \ - NAME_MACRO := rename_stripped, \ )) DEPS += $(COPY_FILTERED_LIBS) JMOD_FLAGS += --libs $(LIBS_DIR_FILTERED) @@ -80,16 +77,13 @@ endif ifneq ($(CMDS_DIR), ) DEPS += $(call FindFiles, $(CMDS_DIR)) ifeq ($(call isTargetOs, windows)+$(SHIP_DEBUG_SYMBOLS), true+public) - # For public debug symbols on Windows, we have to use stripped pdbs and rename them - rename_stripped = $(patsubst %.stripped.pdb,%.pdb,$1) + # For public debug symbols on Windows, we have to filter out full pdbs CMDS_DIR_FILTERED := $(subst modules_cmds,modules_cmds_filtered, $(CMDS_DIR)) - FILES_CMDS := $(filter-out %.pdb, $(call FindFiles, $(CMDS_DIR))) \ - $(filter %.stripped.pdb, $(call FindFiles, $(CMDS_DIR))) + FILES_CMDS := $(filter-out %.full.pdb, $(call FindFiles, $(CMDS_DIR))) $(eval $(call SetupCopyFiles, COPY_FILTERED_CMDS, \ SRC := $(CMDS_DIR), \ DEST := $(CMDS_DIR_FILTERED), \ FILES := $(FILES_CMDS), \ - NAME_MACRO := rename_stripped, \ )) DEPS += $(COPY_FILTERED_CMDS) JMOD_FLAGS += --cmds $(CMDS_DIR_FILTERED) diff --git a/make/common/native/DebugSymbols.gmk b/make/common/native/DebugSymbols.gmk index 7f21fd8cbf337..c5395d9c5b2d9 100644 --- a/make/common/native/DebugSymbols.gmk +++ b/make/common/native/DebugSymbols.gmk @@ -64,10 +64,11 @@ define CreateDebugSymbols endif ifeq ($(call isTargetOs, windows), true) - $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).pdb" \ - "-map:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).map" + $1_EXTRA_LDFLAGS += -debug "-map:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).map" ifeq ($(SHIP_DEBUG_SYMBOLS), public) - $1_EXTRA_LDFLAGS += "-pdbstripped:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).stripped.pdb" + $1_EXTRA_LDFLAGS += "-pdbstripped:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).pdb" "-pdb:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).full.pdb" + else + $1_EXTRA_LDFLAGS += "-pdb:$$($1_SYMBOLS_DIR)/$$($1_BASENAME).pdb" endif endif From f560fd210ba0f3570f42b2cf4e388d7befe9847d Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Thu, 13 Mar 2025 08:35:55 +0100 Subject: [PATCH 2/2] Fix tests --- test/hotspot/gtest/runtime/test_os.cpp | 10 +++++++++- test/jdk/jdk/modules/etc/JmodExcludedFiles.java | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index ee6d1427d0b8b..f4d889deb2e89 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -934,7 +934,7 @@ TEST_VM(os, dll_address_to_function_and_library_name) { LOG("shorten_paths=%d, demangle=%d, strip_arguments=%d, provide_scratch_buffer=%d", shorten_paths, demangle, strip_arguments, provide_scratch_buffer); - // Should show os::min_page_size in libjvm + // Should show Threads::create_vm in libjvm addr = CAST_FROM_FN_PTR(address, Threads::create_vm); st.reset(); EXPECT_TRUE(os::print_function_and_library_name(&st, addr, @@ -942,8 +942,16 @@ TEST_VM(os, dll_address_to_function_and_library_name) { sizeof(tmp), shorten_paths, demangle, strip_arguments)); + +#ifdef _WINDOWS + // On Windows, if no full .pdb file is available, the output can be something like "0x... in ..." + if (strncmp(output, "0x", 2) != 0) { +#endif EXPECT_CONTAINS(output, "Threads"); EXPECT_CONTAINS(output, "create_vm"); +#ifdef _WINDOWS + } +#endif EXPECT_CONTAINS(output, "jvm"); // "jvm.dll" or "libjvm.so" or similar LOG("%s", output); diff --git a/test/jdk/jdk/modules/etc/JmodExcludedFiles.java b/test/jdk/jdk/modules/etc/JmodExcludedFiles.java index 90ca6840d52a6..d24f83f84e600 100644 --- a/test/jdk/jdk/modules/etc/JmodExcludedFiles.java +++ b/test/jdk/jdk/modules/etc/JmodExcludedFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,10 +82,10 @@ boolean isNativeDebugSymbol(String name) { } if (OperatingSystem.isWindows() && name.endsWith(".pdb")) { // on Windows we check if we should have public symbols through --with-external-symbols-in-bundles=public (JDK-8237192) - String strippedpdb = javaHome + "/bin/" + name.substring(index + 1, name.length() - 4) + ".stripped.pdb"; - if (!Files.exists(Paths.get(strippedpdb))) { + String fullpdb = javaHome + "/bin/" + name.substring(index + 1, name.length() - 4) + ".full.pdb"; + if (!Files.exists(Paths.get(fullpdb))) { System.err.println("Found symbols in " + jmod + ": " + name + - ". No stripped pdb file " + strippedpdb + " exists."); + ". No full pdb file " + fullpdb + " exists."); return true; } }