Summary
Introduce -XX:JFREmergencyDumpPath to specify the path for JFR emergency dump.
Problem
JFR will dump the recording to the file as hs_err_pid.jfr if JVM encountered fatal errors (e.g. crash). It will be dumped to current directory, and we cannot specify dump path.
In other dumps (hs_err log, heap dump, replay & inline data for JIT) can be specified it.
Solution
Introduce -XX:JFREmergencyDumpPath to specify the path for JFR emergency dump. If the user specifies it, JFR would create emergency dump into it.
Specification
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
index 72ce214b8bf..0597ef3b4d9 100644
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -2035,6 +2035,11 @@ const intx ObjectAlignmentInBytes = 8;
   JFR_ONLY(product(ccstr, StartFlightRecording, NULL,                       \
           "Start flight recording with options"))                           \
                                                                             \
+  JFR_ONLY(product(ccstr, JFREmergencyDumpPath, NULL,                       \
+          "The path for JFR emergency dump. "                               \
+          "Flight record will be dumped there "                             \
+          "when the error (OOM, stack overflow, crash) happens."))          \
+                                                                            \
   product(bool, UseFastUnorderedTimeStamps, false, EXPERIMENTAL,            \
           "Use platform unstable time where supported for timestamps only") \
                                                                             \- csr of
- 
                    JDK-8270091 The path of JFR emergency dump should be able to specified by the user -           
- Closed
 
-