--- old/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.c 2020-01-10 19:17:22.815801188 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.c 2020-01-10 19:17:22.104786229 +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,11 @@ return JNI_TRUE; } - -void *ArrayReference_Cmds[] = { (void *)0x3 - ,(void *)length - ,(void *)getValues - ,(void *)setValues}; +CommandSet ArrayReference_Cmds = { + 3, "ArrayReference", + { + {length, "Length"}, + {getValues, "GetValues"}, + {setValues, "SetValues"} + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.h 2020-01-10 19:17:24.369833886 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ArrayReferenceImpl.h 2020-01-10 19:17:23.678819346 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.c 2020-01-10 19:17:25.910866309 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.c 2020-01-10 19:17:25.216851707 +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,9 @@ return JNI_TRUE; } -void *ArrayType_Cmds[] = { (void *)0x1 - ,(void *)newInstance}; +CommandSet ArrayType_Cmds = { + 1, "ArrayType", + { + {newInstance, "NewInstance"} + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.h 2020-01-10 19:17:27.515900079 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ArrayTypeImpl.h 2020-01-10 19:17:26.797884972 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.c 2020-01-10 19:17:29.135934165 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.c 2020-01-10 19:17:28.439919521 +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,9 @@ return JNI_TRUE; } -void *ClassLoaderReference_Cmds[] = { (void *)0x1 - ,(void *)visibleClasses +CommandSet ClassLoaderReference_Cmds = { + 1, "ClassLoaderReference", + { + {visibleClasses, "VisibleClasses"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.h 2020-01-10 19:17:30.763968419 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ClassLoaderReferenceImpl.h 2020-01-10 19:17:30.028952954 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.c 2020-01-10 19:17:32.333001432 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.c 2020-01-10 19:17:31.634986746 +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,9 @@ return JNI_TRUE; } -void *ClassObjectReference_Cmds[] = { (void *)1 - ,(void *)reflectedType +CommandSet ClassObjectReference_Cmds = { + 1, "ClassObjectReference", + { + {reflectedType, "ReflectedType"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.h 2020-01-10 19:17:33.911034634 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ClassObjectReferenceImpl.h 2020-01-10 19:17:33.217020032 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.c 2020-01-10 19:17:35.511068299 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.c 2020-01-10 19:17:34.812053592 +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,12 @@ return sharedInvoke(in, out); } -void *ClassType_Cmds[] = { (void *)0x4 - ,(void *)superclass - ,(void *)setValues - ,(void *)invokeStatic - ,(void *)invokeStatic +CommandSet ClassType_Cmds = { + 4, "ClassType", + { + {superclass, "Superclass"}, + {setValues, "SetValues"}, + {invokeStatic, "InvokeMethod"}, + {invokeStatic, "NewInstance"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.h 2020-01-10 19:17:37.091101543 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ClassTypeImpl.h 2020-01-10 19:17:36.388086752 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c 2020-01-10 19:17:38.690135187 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c 2020-01-10 19:17:37.987120396 +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,11 @@ return JNI_TRUE; } -void *EventRequest_Cmds[] = { (void *)0x3 - ,(void *)setCommand - ,(void *)clearCommand - ,(void *)clearAllBreakpoints}; +CommandSet EventRequest_Cmds = { + 3, "EventRequest", + { + {setCommand, "SetCommand"}, + {clearCommand, "ClearCommand"}, + {clearAllBreakpoints, "ClearAllBreakpoints"} + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.h 2020-01-10 19:17:40.282168684 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.h 2020-01-10 19:17:39.560153492 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.c 2020-01-10 19:17:41.839201444 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.c 2020-01-10 19:17:41.145186842 +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,8 @@ #include "FieldImpl.h" -void *Field_Cmds[] = { (void *)0x0 }; +CommandSet Field_Cmds = { + 0, "Field", + { + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.h 2020-01-10 19:17:43.413234562 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/FieldImpl.h 2020-01-10 19:17:42.716219897 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.c 2020-01-10 19:17:44.961267133 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.c 2020-01-10 19:17:44.268252551 +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,9 @@ return sharedInvoke(in, out); } -void *InterfaceType_Cmds[] = { (void *)0x1 - , (void *)invokeStatic +CommandSet InterfaceType_Cmds = { + 1, "InterfaceType", + { + {invokeStatic, "InvokeMethod"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.h 2020-01-10 19:17:46.522299977 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/InterfaceTypeImpl.h 2020-01-10 19:17:45.820285206 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.c 2020-01-10 19:17:48.120333600 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.c 2020-01-10 19:17:47.417318808 +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,13 @@ return JNI_TRUE; } -void *Method_Cmds[] = { (void *)0x5 - ,(void *)lineTable - ,(void *)variableTable - ,(void *)bytecodes - ,(void *)isObsolete - ,(void *)variableTableWithGenerics +CommandSet Method_Cmds = { + 5, "Method", + { + {lineTable, "lineTable"}, + {variableTable, "variableTable"}, + {bytecodes, "bytecodes"}, + {isObsolete, "isObsolete"}, + {variableTableWithGenerics, "variableTableWithGenerics"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.h 2020-01-10 19:17:49.733367538 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/MethodImpl.h 2020-01-10 19:17:49.003352179 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c 2020-01-10 19:17:51.321400951 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c 2020-01-10 19:17:50.623386265 +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,10 @@ return JNI_TRUE; } - -void *ModuleReference_Cmds[] = { (void *)3 - ,(void *)getName - ,(void *)getClassLoader +CommandSet ModuleReference_Cmds = { + 2, "ModuleReference", + { + {getName, "GetName"}, + {getClassLoader, "GetClassLoader"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.h 2020-01-10 19:17:52.873433606 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.h 2020-01-10 19:17:52.178418983 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.c 2020-01-10 19:17:54.425466261 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.c 2020-01-10 19:17:53.730451638 +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,18 @@ 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 - }; +CommandSet ObjectReference_Cmds = { + 10, "ObjectReference", + { + {referenceType, "ReferenceType"}, + {getValues, "GetValues"}, + {setValues, "SetValues"}, + {NULL, ""}, + {monitorInfo, "MonitorInfo"}, + {invokeInstance, "InvokeInstance"}, + {disableCollection, "DisableCollection"}, + {enableCollection, "EnableCollection"}, + {isCollected, "IsCollected"}, + {referringObjects, "ReferringObjects"} + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.h 2020-01-10 19:17:56.008499568 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ObjectReferenceImpl.h 2020-01-10 19:17:55.309484861 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.c 2020-01-10 19:17:57.578532602 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.c 2020-01-10 19:17:56.864517579 +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,27 @@ 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 +CommandSet ReferenceType_Cmds = { + 19, "ReferenceType", + { + {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"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.h 2020-01-10 19:17:59.179566288 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.h 2020-01-10 19:17:58.482551623 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.c 2020-01-10 19:18:00.777599911 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.c 2020-01-10 19:18:00.055584720 +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,12 @@ return JNI_TRUE; } -void *StackFrame_Cmds[] = { (void *)0x4 - ,(void *)getValues - ,(void *)setValues - ,(void *)thisObject - ,(void *)popFrames +CommandSet StackFrame_Cmds = { + 4, "StackFrame", + { + {getValues, "GetValues"}, + {setValues, "SetValues"}, + {thisObject, "ThisObject"}, + {popFrames, "PopFrames"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.h 2020-01-10 19:18:02.327632524 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/StackFrameImpl.h 2020-01-10 19:18:01.635617964 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.c 2020-01-10 19:18:03.890665410 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.c 2020-01-10 19:18:03.200650892 +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,9 @@ return JNI_TRUE; } -void *StringReference_Cmds[] = { (void *)0x1 - ,(void *)value}; +CommandSet StringReference_Cmds = { + 1, "StringReference", + { + {value, "Value"} + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.h 2020-01-10 19:18:05.440698023 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/StringReferenceImpl.h 2020-01-10 19:18:04.747683442 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.c 2020-01-10 19:18:07.029731457 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.c 2020-01-10 19:18:06.310716328 +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,11 @@ return JNI_TRUE; } -void *ThreadGroupReference_Cmds[] = { (void *)3, - (void *)name, - (void *)parent, - (void *)children }; +CommandSet ThreadGroupReference_Cmds = { + 3, "ThreadGroupReference", + { + {name, "Name"}, + {parent, "Parent"}, + {children, "Children"} + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.h 2020-01-10 19:18:08.610764722 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ThreadGroupReferenceImpl.h 2020-01-10 19:18:07.912750036 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.c 2020-01-10 19:18:10.203798240 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.c 2020-01-10 19:18:09.480783027 +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,22 @@ return JNI_TRUE; } - -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 - }; +CommandSet ThreadReference_Cmds = { + 14, "ThreadReference", + { + {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"} + } +}; --- old/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.h 2020-01-10 19:18:11.800831841 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.h 2020-01-10 19:18:11.097817050 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c 2020-01-10 19:18:13.414865801 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c 2020-01-10 19:18:12.715851094 +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,30 @@ 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 +CommandSet VirtualMachine_Cmds = { + 22, "VirtualMachine", + { + {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"} + } }; --- old/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.h 2020-01-10 19:18:14.970898540 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.h 2020-01-10 19:18:14.276883938 +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_Cmds; --- old/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.c 2020-01-10 19:18:16.524931237 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.c 2020-01-10 19:18:15.821916446 +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,37 @@ * 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; - - 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(VirtualMachine)] = &VirtualMachine_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ReferenceType)] = &ReferenceType_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ClassType)] = &ClassType_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(InterfaceType)] = &InterfaceType_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ArrayType)] = &ArrayType_Cmds; + + cmdSetsArray[JDWP_COMMAND_SET(Field)] = &Field_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(Method)] = &Method_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ObjectReference)] = &ObjectReference_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(StringReference)] = &StringReference_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ThreadReference)] = &ThreadReference_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ThreadGroupReference)] = &ThreadGroupReference_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ClassLoaderReference)] = &ClassLoaderReference_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ArrayReference)] = &ArrayReference_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(EventRequest)] = &EventRequest_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(StackFrame)] = &StackFrame_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ClassObjectReference)] = &ClassObjectReference_Cmds; + cmdSetsArray[JDWP_COMMAND_SET(ModuleReference)] = &ModuleReference_Cmds; + } void @@ -92,25 +93,27 @@ } CommandHandler -debugDispatch_getHandler(int cmdSet, int cmd) +debugDispatch_getHandler(int cmdSetNum, int cmdNum, const char **cmdSetName_p, const char **cmdName_p) { - void **l2Array; - - if (cmdSet > JDWP_HIGHEST_COMMAND_SET) { + CommandSet *cmd_set; + *cmdSetName_p = ""; + *cmdName_p = ""; + + if (cmdSetNum > JDWP_HIGHEST_COMMAND_SET) { return NULL; } - l2Array = (void **)l1Array[cmdSet]; + cmd_set = cmdSetsArray[cmdSetNum]; + if (cmd_set == NULL) { + return NULL; + } - /* - * 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]) { + *cmdSetName_p = cmd_set->cmd_set_name; + if (cmdNum > cmd_set->num_cmds) { + *cmdName_p = ""; return NULL; + } else { + *cmdName_p = cmd_set->cmds[cmdNum - 1].cmd_name; + return cmd_set->cmds[cmdNum - 1].cmd_handler; } - - return (CommandHandler)l2Array[cmd]; } --- old/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.h 2020-01-10 19:18:18.130965029 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/debugDispatch.h 2020-01-10 19:18:17.401949690 +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,18 @@ 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 { + int num_cmds; + const char *cmd_set_name; + const Command cmds[]; +} CommandSet; #endif --- old/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c 2020-01-10 19:18:19.722998525 +0000 +++ new/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c 2020-01-10 19:18:19.008983502 +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