changeset 12828:877fc099100f

8183098: SA: Enable corefile debugging on Portola for gcore dumped files Summary: Avoid checking for address conflicts in the mappings created from segments read in from shared libraries if the libc used is musl libc. Reviewed-by: poonam, mikael
author jgeorge
date Wed, 28 Jun 2017 11:51:37 +0530
parents aa97e774c57e
children 4bfb9f3df638
files make/lib/Lib-jdk.hotspot.agent.gmk src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Jun 27 12:06:05 2017 -0700
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Wed Jun 28 11:51:37 2017 +0530
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, 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
@@ -102,6 +102,8 @@
   SA_CFLAGS += -DINCLUDE_SA_ATTACH
 endif
 
+SA_CFLAGS += -DLIBC=\"$(OPENJDK_TARGET_LIBC)\"
+
 ################################################################################
 
 $(eval $(call SetupNativeCompilation, BUILD_LIBSA, \
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Tue Jun 27 12:06:05 2017 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Wed Jun 28 11:51:37 2017 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -731,6 +731,10 @@
   ELF_PHDR* phbuf;
   ELF_PHDR* lib_php = NULL;
 
+#ifndef LIBC
+#error "LIBC not set"
+#endif
+
   int page_size = sysconf(_SC_PAGE_SIZE);
 
   if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) {
@@ -755,7 +759,8 @@
         // Coredump stores value of p_memsz elf field
         // rounded up to page boundary.
 
-        if ((existing_map->memsz != page_size) &&
+        if ((strcmp(LIBC, "musl")) &&
+            (existing_map->memsz != page_size) &&
             (existing_map->fd != lib_fd) &&
             (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) {