8203292: Print complete set of flags in the hs_err file
authorsimonis
Mon, 21 May 2018 11:09:58 -0500
changeset 50196 85e3ac4fa57b
parent 50195 ec881a19d294
child 50197 f4735ff8d17d
8203292: Print complete set of flags in the hs_err file Summary: Prints non-default flags to hs_err file Reviewed-by: gziemski, dholmes
src/hotspot/share/runtime/flags/jvmFlag.cpp
src/hotspot/share/runtime/flags/jvmFlag.hpp
src/hotspot/share/utilities/vmError.cpp
--- a/src/hotspot/share/runtime/flags/jvmFlag.cpp	Mon May 21 17:38:46 2018 +0200
+++ b/src/hotspot/share/runtime/flags/jvmFlag.cpp	Mon May 21 11:09:58 2018 -0500
@@ -1474,7 +1474,7 @@
 
 #endif // PRODUCT
 
-void JVMFlag::printFlags(outputStream* out, bool withComments, bool printRanges) {
+void JVMFlag::printFlags(outputStream* out, bool withComments, bool printRanges, bool skipDefaults) {
   // Print the flags sorted by name
   // note: this method is called before the thread structure is in place
   //       which means resource allocation cannot be used.
@@ -1497,7 +1497,7 @@
   }
 
   for (size_t i = 0; i < length; i++) {
-    if (array[i]->is_unlocked()) {
+    if (array[i]->is_unlocked() && !(skipDefaults && array[i]->is_default())) {
       array[i]->print_on(out, withComments, printRanges);
     }
   }
--- a/src/hotspot/share/runtime/flags/jvmFlag.hpp	Mon May 21 17:38:46 2018 +0200
+++ b/src/hotspot/share/runtime/flags/jvmFlag.hpp	Mon May 21 11:09:58 2018 -0500
@@ -275,7 +275,7 @@
   static void printSetFlags(outputStream* out);
 
   // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
-  static void printFlags(outputStream* out, bool withComments, bool printRanges = false);
+  static void printFlags(outputStream* out, bool withComments, bool printRanges = false, bool skipDefaults = false);
 
   static void verify() PRODUCT_RETURN;
 };
--- a/src/hotspot/share/utilities/vmError.cpp	Mon May 21 17:38:46 2018 +0200
+++ b/src/hotspot/share/utilities/vmError.cpp	Mon May 21 11:09:58 2018 -0500
@@ -42,6 +42,7 @@
 #include "runtime/vmThread.hpp"
 #include "runtime/vm_operations.hpp"
 #include "runtime/vm_version.hpp"
+#include "runtime/flags/jvmFlag.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/decoder.hpp"
@@ -911,6 +912,17 @@
        st->cr();
      }
 
+  STEP("printing flags")
+
+    if (_verbose) {
+      JVMFlag::printFlags(
+        st,
+        true, // with comments
+        false, // no ranges
+        true); // skip defaults
+      st->cr();
+    }
+
   STEP("printing warning if internal testing API used")
 
      if (WhiteBox::used()) {