changeset 60258:56684e4fc417

8249713: JFR: java.base events have incomplete stacktraces Reviewed-by: egahlin
author mgronlun
date Tue, 21 Jul 2020 11:54:19 +0200
parents faac79795a4d
children 4bf2a3f7e05a
files src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java
diffstat 1 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java	Mon Jul 20 09:11:53 2020 -0700
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java	Tue Jul 21 11:54:19 2020 +0200
@@ -75,13 +75,34 @@
         this.stackTraceOffset = stackTraceOffset(name, isJDK);
     }
 
+    private static boolean isExceptionEvent(String name) {
+        switch (name) {
+            case Type.EVENT_NAME_PREFIX + "JavaErrorThrow" :
+            case Type.EVENT_NAME_PREFIX + "JavaExceptionThrow" :
+                return true;
+        }
+        return false;
+    }
+
+    private static boolean isUsingHandler(String name) {
+        switch (name) {
+            case Type.EVENT_NAME_PREFIX + "SocketRead"  :
+            case Type.EVENT_NAME_PREFIX + "SocketWrite" :
+            case Type.EVENT_NAME_PREFIX + "FileRead"    :
+            case Type.EVENT_NAME_PREFIX + "FileWrite"   :
+            case Type.EVENT_NAME_PREFIX + "FileForce"   :
+                return true;
+        }
+        return false;
+    }
+
     private static int stackTraceOffset(String name, boolean isJDK) {
         if (isJDK) {
-            if (name.equals(Type.EVENT_NAME_PREFIX + "JavaExceptionThrow")) {
-                return 5;
+            if (isExceptionEvent(name)) {
+                return 4;
             }
-            if (name.equals(Type.EVENT_NAME_PREFIX + "JavaErrorThrow")) {
-                return 5;
+            if (isUsingHandler(name)) {
+                return 3;
             }
         }
         return 4;