changeset 257:bec923d3aeb6

Bug 3498: Agent cannot work on brandnew glibc Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/127
author Yasumasa Suenaga <yasuenag@gmail.com>
date Tue, 05 Dec 2017 16:18:49 +0900
parents ca86f078eb34
children 9a13d070bb77
files ChangeLog agent/src/heapstats-engines/vmFunctions.cpp agent/src/heapstats-engines/vmFunctions.hpp
diffstat 3 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 08 13:41:08 2017 +0900
+++ b/ChangeLog	Tue Dec 05 16:18:49 2017 +0900
@@ -1,3 +1,7 @@
+2017-12-05 Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug 3498: Agent cannot work on brandnew glibc
+
 2017-11-08 KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp>
 
 	* Bug 3491: Fix potential error when conflict between VMDeath and interval logging
--- a/agent/src/heapstats-engines/vmFunctions.cpp	Wed Nov 08 13:41:08 2017 +0900
+++ b/agent/src/heapstats-engines/vmFunctions.cpp	Tue Dec 05 16:18:49 2017 +0900
@@ -188,8 +188,12 @@
       sr_handler = (TSR_Handler) this->symFinder->findSymbol(
                                                         SR_HANDLER_SYMBOL_JDK6);
       if (sr_handler == NULL) {
-        logger->printWarnMsg("SR_handler() not found.");
-        return false;
+        sr_handler = (TSR_Handler) this->symFinder->findSymbol(
+                                                   SR_HANDLER_SYMBOL_FALLBACK2);
+        if (sr_handler == NULL) {
+          logger->printWarnMsg("SR_handler() not found.");
+          return false;
+        }
       }
     }
   }
--- a/agent/src/heapstats-engines/vmFunctions.hpp	Wed Nov 08 13:41:08 2017 +0900
+++ b/agent/src/heapstats-engines/vmFunctions.hpp	Tue Dec 05 16:18:49 2017 +0900
@@ -1,7 +1,7 @@
 /*!
  * \file vmFunctions.hpp
  * \brief This file includes functions in HotSpot VM.
- * Copyright (C) 2014-2016 Yasumasa Suenaga
+ * Copyright (C) 2014-2017 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -113,12 +113,27 @@
 #define USERHANDLER_SYMBOL "_ZL11UserHandleriPvS_"
 #define USERHANDLER_SYMBOL_JDK6 "_Z11UserHandleriPvS_"
 
+
 /*!
  * \brief Symbol of SR_handler()
  */
-#define SR_HANDLER_SYMBOL          "_ZL10SR_handleriP7siginfoP8ucontext"
-#define SR_HANDLER_SYMBOL_FALLBACK "_ZL10SR_handleriP9siginfo_tP8ucontext"
-#define SR_HANDLER_SYMBOL_JDK6     "_Z10SR_handleriP7siginfoP8ucontext"
+#define SR_HANDLER_SYMBOL           "_ZL10SR_handleriP7siginfoP8ucontext"
+/* 
+ * Adapt to rename siginfo to siginfo_t
+ *   https://sourceware.org/git/?p=glibc.git;a=commit;h=87df4a4b09abdb1b1af41c9c398b86ecdedcb635
+ */
+#define SR_HANDLER_SYMBOL_FALLBACK  "_ZL10SR_handleriP9siginfo_tP8ucontext"
+/* 
+ * Adapt to old C++ compiler
+ * (Sun/Oracle JDK 6 FCS, etc)
+ */
+#define SR_HANDLER_SYMBOL_JDK6      "_Z10SR_handleriP7siginfoP8ucontext"
+/*
+ * Adapt to rename ucontext to ucontext_t
+ *   https://sourceware.org/bugzilla/show_bug.cgi?id=21457
+ */
+#define SR_HANDLER_SYMBOL_FALLBACK2 "_ZL10SR_handleriP9siginfo_tP10ucontext_t"
+
 
 /*!
  * \brief Symbol of ObjectSynchronizer::get_lock_owner().