changeset 57805:ccf562b9b63c

8236913: debug agent's jdwp command logging should include the command set name and command name Reviewed-by: amenkov, sspitsyn
author cjplummer
date Thu, 23 Jan 2020 04:14:11 +0000
parents 36218eab4255
children d4821c2dc343
files src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.h src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.h src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.c src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.h src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.c src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.h src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.c src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.h src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.c src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.h src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.c src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.h src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.h src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.c src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.h src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c
diffstat 37 files changed, 324 insertions(+), 210 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -586,8 +586,10 @@
     return JNI_TRUE;
 }
 
+Command ArrayReference_Commands[] = {
+    {length, "Length"},
+    {getValues, "GetValues"},
+    {setValues, "SetValues"}
+};
 
-void *ArrayReference_Cmds[] = { (void *)0x3
-    ,(void *)length
-    ,(void *)getValues
-    ,(void *)setValues};
+DEBUG_DISPATCH_DEFINE_CMDSET(ArrayReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ArrayReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ArrayReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -240,5 +240,8 @@
     return JNI_TRUE;
 }
 
-void *ArrayType_Cmds[] = { (void *)0x1
-                          ,(void *)newInstance};
+Command ArrayType_Commands[] = {
+    {newInstance, "NewInstance"}
+};
+
+DEBUG_DISPATCH_DEFINE_CMDSET(ArrayType)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ArrayType_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ArrayType_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -71,6 +71,8 @@
     return JNI_TRUE;
 }
 
-void *ClassLoaderReference_Cmds[] = { (void *)0x1
-    ,(void *)visibleClasses
+Command ClassLoaderReference_Commands[] = {
+    {visibleClasses, "VisibleClasses"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(ClassLoaderReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ClassLoaderReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ClassLoaderReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, 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
@@ -55,6 +55,8 @@
     return JNI_TRUE;
 }
 
-void *ClassObjectReference_Cmds[] = { (void *)1
-    ,(void *)reflectedType
+Command ClassObjectReference_Commands[] = {
+    {reflectedType, "ReflectedType"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(ClassObjectReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ClassObjectReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ClassObjectReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -175,9 +175,11 @@
     return sharedInvoke(in, out);
 }
 
-void *ClassType_Cmds[] = { (void *)0x4
-    ,(void *)superclass
-    ,(void *)setValues
-    ,(void *)invokeStatic
-    ,(void *)invokeStatic
+Command ClassType_Commands[] = {
+    {superclass, "Superclass"},
+    {setValues, "SetValues"},
+    {invokeStatic, "InvokeMethod"},
+    {invokeStatic, "NewInstance"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(ClassType)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ClassType_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ClassType_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -346,7 +346,10 @@
     return JNI_TRUE;
 }
 
-void *EventRequest_Cmds[] = { (void *)0x3
-    ,(void *)setCommand
-    ,(void *)clearCommand
-    ,(void *)clearAllBreakpoints};
+Command EventRequest_Commands[] = {
+    {setCommand, "SetCommand"},
+    {clearCommand, "ClearCommand"},
+    {clearAllBreakpoints, "ClearAllBreakpoints"}
+};
+
+DEBUG_DISPATCH_DEFINE_CMDSET(EventRequest)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *EventRequest_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet EventRequest_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -25,4 +25,6 @@
 
 #include "FieldImpl.h"
 
-void *Field_Cmds[] = { (void *)0x0 };
+CommandSet Field_CmdSet = {
+    0, "Field", NULL
+};
--- a/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *Field_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet Field_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -34,6 +34,8 @@
     return sharedInvoke(in, out);
 }
 
-void *InterfaceType_Cmds[] = { (void *)0x1
-    , (void *)invokeStatic
+Command InterfaceType_Commands[] = {
+    {invokeStatic, "InvokeMethod"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(InterfaceType)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *InterfaceType_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet InterfaceType_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -231,10 +231,12 @@
     return JNI_TRUE;
 }
 
-void *Method_Cmds[] = { (void *)0x5
-    ,(void *)lineTable
-    ,(void *)variableTable
-    ,(void *)bytecodes
-    ,(void *)isObsolete
-    ,(void *)variableTableWithGenerics
+Command Method_Commands[] = {
+    {lineTable, "LineTable"},
+    {variableTable, "VariableTable"},
+    {bytecodes, "Bytecodes"},
+    {isObsolete, "IsObsolete"},
+    {variableTableWithGenerics, "VariableTableWithGenerics"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(Method)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *Method_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet Method_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, 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
@@ -83,8 +83,9 @@
     return JNI_TRUE;
 }
 
+Command ModuleReference_Commands[] = {
+    {getName, "GetName"},
+    {getClassLoader, "GetClassLoader"}
+};
 
-void *ModuleReference_Cmds[] = { (void *)3
-    ,(void *)getName
-    ,(void *)getClassLoader
-};
+DEBUG_DISPATCH_DEFINE_CMDSET(ModuleReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ModuleReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ModuleReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -352,15 +352,17 @@
     return JNI_TRUE;
 }
 
-void *ObjectReference_Cmds[] = { (void *)10
-    ,(void *)referenceType
-    ,(void *)getValues
-    ,(void *)setValues
-    ,(void *)NULL      /* no longer used */
-    ,(void *)monitorInfo
-    ,(void *)invokeInstance
-    ,(void *)disableCollection
-    ,(void *)enableCollection
-    ,(void *)isCollected
-    ,(void *)referringObjects
-    };
+Command ObjectReference_Commands[] = {
+    {referenceType, "ReferenceType"},
+    {getValues, "GetValues"},
+    {setValues, "SetValues"},
+    {NULL, "<unused>"},
+    {monitorInfo, "MonitorInfo"},
+    {invokeInstance, "InvokeInstance"},
+    {disableCollection, "DisableCollection"},
+    {enableCollection, "EnableCollection"},
+    {isCollected, "IsCollected"},
+    {referringObjects, "ReferringObjects"}
+};
+
+DEBUG_DISPATCH_DEFINE_CMDSET(ObjectReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ObjectReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ObjectReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -233,8 +233,7 @@
 }
 
 static jboolean
-methods(PacketInputStream *in, PacketOutputStream *out,
-         int outputGenerics)
+methods(PacketInputStream *in, PacketOutputStream *out)
 {
     return methods1(in, out, 0);
 }
@@ -625,24 +624,26 @@
     return JNI_TRUE;
 }
 
-void *ReferenceType_Cmds[] = { (void *)19
-    ,(void *)signature
-    ,(void *)getClassLoader
-    ,(void *)modifiers
-    ,(void *)fields
-    ,(void *)methods
-    ,(void *)getValues
-    ,(void *)sourceFile
-    ,(void *)nestedTypes
-    ,(void *)getClassStatus
-    ,(void *)interfaces
-    ,(void *)classObject
-    ,(void *)sourceDebugExtension
-    ,(void *)signatureWithGeneric
-    ,(void *)fieldsWithGeneric
-    ,(void *)methodsWithGeneric
-    ,(void *)instances
-    ,(void *)getClassVersion
-    ,(void *)getConstantPool
-    ,(void *)getModule
+Command ReferenceType_Commands[] = {
+    {signature, "Signature"},
+    {getClassLoader, "GetClassLoader"},
+    {modifiers, "Modifiers"},
+    {fields, "Fields"},
+    {methods, "Methods"},
+    {getValues, "GetValues"},
+    {sourceFile, "SourceFile"},
+    {nestedTypes, "NestedTypes"},
+    {getClassStatus, "GetClassStatus"},
+    {interfaces, "Interfaces"},
+    {classObject, "ClassObject"},
+    {sourceDebugExtension, "SourceDebugExtension"},
+    {signatureWithGeneric, "SignatureWithGeneric"},
+    {fieldsWithGeneric, "FieldsWithGeneric"},
+    {methodsWithGeneric, "MethodsWithGeneric"},
+    {instances, "Instances"},
+    {getClassVersion, "GetClassVersion"},
+    {getConstantPool, "GetConstantPool"},
+    {getModule, "GetModule"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(ReferenceType)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ReferenceType_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ReferenceType_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -456,9 +456,11 @@
     return JNI_TRUE;
 }
 
-void *StackFrame_Cmds[] = { (void *)0x4
-    ,(void *)getValues
-    ,(void *)setValues
-    ,(void *)thisObject
-    ,(void *)popFrames
+Command StackFrame_Commands[] = {
+    {getValues, "GetValues"},
+    {setValues, "SetValues"},
+    {thisObject, "ThisObject"},
+    {popFrames, "PopFrames"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(StackFrame)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *StackFrame_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet StackFrame_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -56,5 +56,8 @@
     return JNI_TRUE;
 }
 
-void *StringReference_Cmds[] = { (void *)0x1
-    ,(void *)value};
+Command StringReference_Commands[] = {
+    {value, "Value"}
+};
+
+DEBUG_DISPATCH_DEFINE_CMDSET(StringReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *StringReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet StringReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -135,7 +135,10 @@
      return JNI_TRUE;
 }
 
-void *ThreadGroupReference_Cmds[] = { (void *)3,
-                                      (void *)name,
-                                      (void *)parent,
-                                      (void *)children };
+Command ThreadGroupReference_Commands[] = {
+    {name, "Name"},
+    {parent, "Parent"},
+    {children, "Children"}
+};
+
+DEBUG_DISPATCH_DEFINE_CMDSET(ThreadGroupReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ThreadGroupReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ThreadGroupReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -665,20 +665,21 @@
     return JNI_TRUE;
 }
 
+Command ThreadReference_Commands[] = {
+    {name, "Name"},
+    {suspend, "Suspend"},
+    {resume, "Resume"},
+    {status, "Status"},
+    {threadGroup, "ThreadGroup"},
+    {frames, "Frames"},
+    {getFrameCount, "GetFrameCount"},
+    {ownedMonitors, "OwnedMonitors"},
+    {currentContendedMonitor, "CurrentContendedMonitor"},
+    {stop, "Stop"},
+    {interrupt, "Interrupt"},
+    {suspendCount, "SuspendCount"},
+    {ownedMonitorsWithStackDepth, "OwnedMonitorsWithStackDepth"},
+    {forceEarlyReturn, "ForceEarlyReturn"}
+};
 
-void *ThreadReference_Cmds[] = { (void *)14,
-    (void *)name,
-    (void *)suspend,
-    (void *)resume,
-    (void *)status,
-    (void *)threadGroup,
-    (void *)frames,
-    (void *)getFrameCount,
-    (void *)ownedMonitors,
-    (void *)currentContendedMonitor,
-    (void *)stop,
-    (void *)interrupt,
-    (void *)suspendCount,
-    (void *)ownedMonitorsWithStackDepth,
-    (void *)forceEarlyReturn
-    };
+DEBUG_DISPATCH_DEFINE_CMDSET(ThreadReference)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -22,4 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-extern void *ThreadReference_Cmds[];
+
+#include "debugDispatch.h"
+
+extern CommandSet ThreadReference_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -927,27 +927,29 @@
     return JNI_TRUE;
 }
 
-void *VirtualMachine_Cmds[] = { (void *)22
-    ,(void *)version
-    ,(void *)classesForSignature
-    ,(void *)allClasses
-    ,(void *)getAllThreads
-    ,(void *)topLevelThreadGroups
-    ,(void *)dispose
-    ,(void *)idSizes
-    ,(void *)suspend
-    ,(void *)resume
-    ,(void *)doExit
-    ,(void *)createString
-    ,(void *)capabilities
-    ,(void *)classPaths
-    ,(void *)disposeObjects
-    ,(void *)holdEvents
-    ,(void *)releaseEvents
-    ,(void *)capabilitiesNew
-    ,(void *)redefineClasses
-    ,(void *)setDefaultStratum
-    ,(void *)allClassesWithGeneric
-    ,(void *)instanceCounts
-    ,(void *)allModules
+Command VirtualMachine_Commands[] = {
+    {version, "Version"},
+    {classesForSignature, "ClassesForSignature"},
+    {allClasses, "AllClasses"},
+    {getAllThreads, "GetAllThreads"},
+    {topLevelThreadGroups, "TopLevelThreadGroups"},
+    {dispose, "Dispose"},
+    {idSizes, "IDSizes"},
+    {suspend, "Suspend"},
+    {resume, "Resume"},
+    {doExit, "DoExit"},
+    {createString, "CreateString"},
+    {capabilities, "Capabilities"},
+    {classPaths, "ClassPaths"},
+    {disposeObjects, "DisposeObjects"},
+    {holdEvents, "HoldEvents"},
+    {releaseEvents, "ReleaseEvents"},
+    {capabilitiesNew, "CapabilitiesNew"},
+    {redefineClasses, "RedefineClasses"},
+    {setDefaultStratum, "SetDefaultStratum"},
+    {allClassesWithGeneric, "AllClassesWithGeneric"},
+    {instanceCounts, "InstanceCounts"},
+    {allModules, "AllModules"}
 };
+
+DEBUG_DISPATCH_DEFINE_CMDSET(VirtualMachine)
--- a/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -23,4 +23,6 @@
  * questions.
  */
 
-extern void *VirtualMachine_Cmds[];
+#include "debugDispatch.h"
+
+extern CommandSet VirtualMachine_CmdSet;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -44,7 +44,7 @@
 #include "EventRequestImpl.h"
 #include "StackFrameImpl.h"
 
-static void **l1Array;
+static CommandSet **cmdSetsArray;
 
 void
 debugDispatch_initialize(void)
@@ -54,36 +54,36 @@
      * Zero the table so that unknown CommandSets do not
      * cause random errors.
      */
-    l1Array = jvmtiAllocate((JDWP_HIGHEST_COMMAND_SET+1) * sizeof(void *));
+    cmdSetsArray = jvmtiAllocate((JDWP_HIGHEST_COMMAND_SET+1) * sizeof(CommandSet *));
 
-    if (l1Array == NULL) {
+    if (cmdSetsArray == NULL) {
         EXIT_ERROR(AGENT_ERROR_OUT_OF_MEMORY,"command set array");
     }
 
-    (void)memset(l1Array, 0, (JDWP_HIGHEST_COMMAND_SET+1) * sizeof(void *));
+    (void)memset(cmdSetsArray, 0, (JDWP_HIGHEST_COMMAND_SET+1) * sizeof(CommandSet *));
 
     /*
      * Create the level-two (Command) dispatch tables to the
      * corresponding slots in the CommandSet dispatch table..
      */
-    l1Array[JDWP_COMMAND_SET(VirtualMachine)] = (void *)VirtualMachine_Cmds;
-    l1Array[JDWP_COMMAND_SET(ReferenceType)] = (void *)ReferenceType_Cmds;
-    l1Array[JDWP_COMMAND_SET(ClassType)] = (void *)ClassType_Cmds;
-    l1Array[JDWP_COMMAND_SET(InterfaceType)] = (void *)InterfaceType_Cmds;
-    l1Array[JDWP_COMMAND_SET(ArrayType)] = (void *)ArrayType_Cmds;
+    cmdSetsArray[JDWP_COMMAND_SET(VirtualMachine)] = &VirtualMachine_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ReferenceType)] = &ReferenceType_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ClassType)] = &ClassType_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(InterfaceType)] = &InterfaceType_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ArrayType)] = &ArrayType_CmdSet;
 
-    l1Array[JDWP_COMMAND_SET(Field)] = (void *)Field_Cmds;
-    l1Array[JDWP_COMMAND_SET(Method)] = (void *)Method_Cmds;
-    l1Array[JDWP_COMMAND_SET(ObjectReference)] = (void *)ObjectReference_Cmds;
-    l1Array[JDWP_COMMAND_SET(StringReference)] = (void *)StringReference_Cmds;
-    l1Array[JDWP_COMMAND_SET(ThreadReference)] = (void *)ThreadReference_Cmds;
-    l1Array[JDWP_COMMAND_SET(ThreadGroupReference)] = (void *)ThreadGroupReference_Cmds;
-    l1Array[JDWP_COMMAND_SET(ClassLoaderReference)] = (void *)ClassLoaderReference_Cmds;
-    l1Array[JDWP_COMMAND_SET(ArrayReference)] = (void *)ArrayReference_Cmds;
-    l1Array[JDWP_COMMAND_SET(EventRequest)] = (void *)EventRequest_Cmds;
-    l1Array[JDWP_COMMAND_SET(StackFrame)] = (void *)StackFrame_Cmds;
-    l1Array[JDWP_COMMAND_SET(ClassObjectReference)] = (void *)ClassObjectReference_Cmds;
-    l1Array[JDWP_COMMAND_SET(ModuleReference)] = (void *)ModuleReference_Cmds;
+    cmdSetsArray[JDWP_COMMAND_SET(Field)] = &Field_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(Method)] = &Method_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ObjectReference)] = &ObjectReference_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(StringReference)] = &StringReference_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ThreadReference)] = &ThreadReference_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ThreadGroupReference)] = &ThreadGroupReference_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ClassLoaderReference)] = &ClassLoaderReference_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ArrayReference)] = &ArrayReference_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(EventRequest)] = &EventRequest_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(StackFrame)] = &StackFrame_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ClassObjectReference)] = &ClassObjectReference_CmdSet;
+    cmdSetsArray[JDWP_COMMAND_SET(ModuleReference)] = &ModuleReference_CmdSet;
 }
 
 void
@@ -92,25 +92,27 @@
 }
 
 CommandHandler
-debugDispatch_getHandler(int cmdSet, int cmd)
+debugDispatch_getHandler(int cmdSetNum, int cmdNum, const char **cmdSetName_p, const char **cmdName_p)
 {
-    void **l2Array;
+    CommandSet *cmd_set;
+    *cmdSetName_p = "<Invalid CommandSet>";
+    *cmdName_p = "<Unkown Command>";
 
-    if (cmdSet > JDWP_HIGHEST_COMMAND_SET) {
+    if (cmdSetNum > JDWP_HIGHEST_COMMAND_SET) {
         return NULL;
     }
 
-    l2Array = (void **)l1Array[cmdSet];
-
-    /*
-     * If there is no such CommandSet or the Command
-     * is greater than the nummber of commands (the first
-     * element) in the CommandSet, indicate this is invalid.
-     */
-    /*LINTED*/
-    if (l2Array == NULL || cmd > (int)(intptr_t)(void*)l2Array[0]) {
-        return NULL;
+    cmd_set = cmdSetsArray[cmdSetNum];
+    if (cmd_set == NULL) {
+      return NULL;
     }
 
-    return (CommandHandler)l2Array[cmd];
+    *cmdSetName_p = cmd_set->cmd_set_name;
+    if (cmdNum > cmd_set->num_cmds) {
+        *cmdName_p = "<Invalid Command>";
+        return NULL;
+    } else {
+        *cmdName_p = cmd_set->cmds[cmdNum - 1].cmd_name;
+        return cmd_set->cmds[cmdNum - 1].cmd_handler;
+    }
 }
--- a/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.h	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.h	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -26,6 +26,8 @@
 #ifndef JDWP_DEBUGDISPATCH_H
 #define JDWP_DEBUGDISPATCH_H
 
+#include "vm_interface.h"
+
 /*
  * Type of all command handler functions. First argument is the
  * input stream. Second argument is the output sent back to the
@@ -39,6 +41,25 @@
                                   struct PacketOutputStream *);
 void debugDispatch_initialize(void);
 void debugDispatch_reset(void);
-CommandHandler debugDispatch_getHandler(int cmdSet, int cmd) ;
+CommandHandler debugDispatch_getHandler(int cmdSetNum, int cmdNum,
+                                        const char **cmdSetName_p, const char **cmdName_p);
+
+typedef struct Command {
+    CommandHandler cmd_handler;
+    const char *cmd_name;
+} Command;
+
+typedef struct CommandSet {
+    const int num_cmds;
+    const char *cmd_set_name;
+    const Command *cmds;
+} CommandSet;
+
+#define DEBUG_DISPATCH_DEFINE_CMDSET(_name)     \
+CommandSet _name##_CmdSet = {                   \
+    sizeof(_name##_Commands) / sizeof(Command), \
+    #_name,                                     \
+    _name##_Commands                            \
+};
 
 #endif
--- a/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c	Wed Jan 22 20:07:49 2020 -0500
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c	Thu Jan 23 04:14:11 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -117,6 +117,8 @@
             PacketInputStream in;
             PacketOutputStream out;
             CommandHandler func;
+            const char *cmdSetName;
+            const char *cmdName;
 
             /* Should reply be sent to sender.
              * For error handling, assume yes, since
@@ -137,9 +139,9 @@
             inStream_init(&in, p);
             outStream_initReply(&out, inStream_id(&in));
 
-            LOG_MISC(("Command set %d, command %d", cmd->cmdSet, cmd->cmd));
-
-            func = debugDispatch_getHandler(cmd->cmdSet,cmd->cmd);
+            func = debugDispatch_getHandler(cmd->cmdSet, cmd->cmd, &cmdSetName, &cmdName);
+            LOG_MISC(("Command set %s(%d), command %s(%d)",
+                      cmdSetName, cmd->cmdSet, cmdName, cmd->cmd));
             if (func == NULL) {
                 /* we've never heard of this, so I guess we
                  * haven't implemented it.
@@ -229,9 +231,13 @@
             shouldListen = JNI_FALSE;
             notifyTransportError();
         } else {
+            const char *cmdSetName;
+            const char *cmdName;
             cmd = &packet.type.cmd;
 
-            LOG_MISC(("Command set %d, command %d", cmd->cmdSet, cmd->cmd));
+            debugDispatch_getHandler(cmd->cmdSet, cmd->cmd, &cmdSetName, &cmdName);
+            LOG_MISC(("Command set %s(%d), command %s(%d)",
+                      cmdSetName, cmd->cmdSet, cmdName, cmd->cmd));
 
             /*
              * FIXME! We need to deal with high priority