JDWP协议支持的功能号
static const JdwpHandlerMap gHandlers[] = {
/*VirtualMachine command set (1) */
{1, 1, VM_Version, "VirtualMachine.Version" },
{1, 2, VM_ClassesBySignature, "VirtualMachine.ClassesBySignature" },
{1, 3, VM_AllClasses, "VirtualMachine.AllClasses" },
{1, 4, VM_AllThreads, "VirtualMachine.AllThreads" },
{1, 5, VM_TopLevelThreadGroups, "VirtualMachine.TopLevelThreadGroups" },
{1, 6, VM_Dispose, "VirtualMachine.Dispose" },
{1, 7, VM_IDSizes, "VirtualMachine.IDSizes" },
{1, 8, VM_Suspend, "VirtualMachine.Suspend" },
{1, 9, VM_Resume, "VirtualMachine.Resume" },
{1, 10, VM_Exit, "VirtualMachine.Exit" },
{1, 11, VM_CreateString, "VirtualMachine.CreateString" },
{1, 12, VM_Capabilities, "VirtualMachine.Capabilities" },
{1, 13, VM_ClassPaths, "VirtualMachine.ClassPaths"},
{1, 14, VM_DisposeObjects, "VirtualMachine.DisposeObjects" },
{1, 15, nullptr, "VirtualMachine.HoldEvents" },
{1, 16, nullptr, "VirtualMachine.ReleaseEvents" },
{1, 17, VM_CapabilitiesNew, "VirtualMachine.CapabilitiesNew" },
{1, 18, nullptr, "VirtualMachine.RedefineClasses" },
{1, 19, nullptr, "VirtualMachine.SetDefaultStratum" },
{1, 20, VM_AllClassesWithGeneric,"VirtualMachine.AllClassesWithGeneric" },
{1, 21, VM_InstanceCounts, "VirtualMachine.InstanceCounts" },
/*ReferenceType command set (2) */
{2, 1, RT_Signature, "ReferenceType.Signature" },
{2, 2, RT_ClassLoader, "ReferenceType.ClassLoader" },
{2, 3, RT_Modifiers, "ReferenceType.Modifiers" },
{2, 4, RT_Fields, "ReferenceType.Fields" },
{2, 5, RT_Methods, "ReferenceType.Methods" },
{2, 6, RT_GetValues, "ReferenceType.GetValues" },
{2, 7, RT_SourceFile, "ReferenceType.SourceFile" },
{2, 8, nullptr, "ReferenceType.NestedTypes" },
{2, 9, RT_Status, "ReferenceType.Status" },
{2, 10, RT_Interfaces, "ReferenceType.Interfaces"},
{2, 11, RT_ClassObject, "ReferenceType.ClassObject"},
{2, 12, RT_SourceDebugExtension,"ReferenceType.SourceDebugExtension" },
{2, 13, RT_SignatureWithGeneric,"ReferenceType.SignatureWithGeneric" },
{2, 14, RT_FieldsWithGeneric, "ReferenceType.FieldsWithGeneric"},
{2, 15, RT_MethodsWithGeneric, "ReferenceType.MethodsWithGeneric"},
{2, 16, RT_Instances, "ReferenceType.Instances"},
{2, 17, nullptr, "ReferenceType.ClassFileVersion" },
{2, 18, nullptr, "ReferenceType.ConstantPool" },
/*ClassType command set (3) */
{3, 1, CT_Superclass, "ClassType.Superclass" },
{3, 2, CT_SetValues, "ClassType.SetValues" },
{3, 3, CT_InvokeMethod, "ClassType.InvokeMethod" },
{3, 4, CT_NewInstance, "ClassType.NewInstance" },
/*ArrayType command set (4) */
{4, 1, AT_newInstance, "ArrayType.NewInstance"},
/*InterfaceType command set (5) */
/*Method command set (6) */
{6, 1, M_LineTable, "Method.LineTable" },
{6, 2, M_VariableTable, "Method.VariableTable" },
{6, 3, M_Bytecodes, "Method.Bytecodes" },
{6, 4, M_IsObsolete, "Method.IsObsolete" },
{6, 5, M_VariableTableWithGeneric, "Method.VariableTableWithGeneric"},
/*Field command set (8) */
/*ObjectReference command set (9) */
{9, 1, OR_ReferenceType, "ObjectReference.ReferenceType" },
{9, 2, OR_GetValues, "ObjectReference.GetValues" },
{9, 3, OR_SetValues, "ObjectReference.SetValues" },
{9, 4, nullptr, "ObjectReference.UNUSED" },
{9, 5, OR_MonitorInfo, "ObjectReference.MonitorInfo" },
{9, 6, OR_InvokeMethod, "ObjectReference.InvokeMethod" },
{9, 7, OR_DisableCollection, "ObjectReference.DisableCollection" },
{9, 8, OR_EnableCollection, "ObjectReference.EnableCollection" },
{9, 9, OR_IsCollected, "ObjectReference.IsCollected" },
{9, 10, OR_ReferringObjects, "ObjectReference.ReferringObjects"},
/*StringReference command set (10) */
{10, 1, SR_Value, "StringReference.Value" },
/*ThreadReference command set (11) */
{11, 1, TR_Name, "ThreadReference.Name" },
{11, 2, TR_Suspend, "ThreadReference.Suspend" },
{11, 3, TR_Resume, "ThreadReference.Resume"},
{11, 4, TR_Status, "ThreadReference.Status" },
{11, 5, TR_ThreadGroup, "ThreadReference.ThreadGroup" },
{11, 6, TR_Frames, "ThreadReference.Frames" },
{11, 7, TR_FrameCount, "ThreadReference.FrameCount" },
{11, 8, TR_OwnedMonitors, "ThreadReference.OwnedMonitors" },
{11, 9, TR_CurrentContendedMonitor, "ThreadReference.CurrentContendedMonitor" },
{11, 10, nullptr, "ThreadReference.Stop" },
{11, 11, TR_Interrupt, "ThreadReference.Interrupt" },
{11, 12, TR_DebugSuspendCount, "ThreadReference.SuspendCount" },
{11, 13, TR_OwnedMonitorsStackDepthInfo,"ThreadReference.OwnedMonitorsStackDepthInfo" },
{11, 14, nullptr, "ThreadReference.ForceEarlyReturn" },
/*ThreadGroupReference command set (12) */
{12, 1, TGR_Name, "ThreadGroupReference.Name" },
{12, 2, TGR_Parent, "ThreadGroupReference.Parent" },
{12, 3, TGR_Children, "ThreadGroupReference.Children" },
/*ArrayReference command set (13) */
{13, 1, AR_Length, "ArrayReference.Length" },
{13, 2, AR_GetValues, "ArrayReference.GetValues" },
{13, 3, AR_SetValues, "ArrayReference.SetValues" },
/*ClassLoaderReference command set (14) */
{14, 1, CLR_VisibleClasses, "ClassLoaderReference.VisibleClasses" },
/*EventRequest command set (15) */
{15, 1, ER_Set, "EventRequest.Set" },
{15, 2, ER_Clear, "EventRequest.Clear" },
{15, 3, nullptr, "EventRequest.ClearAllBreakpoints" },
/*StackFrame command set (16) */
{16, 1, SF_GetValues, "StackFrame.GetValues" },
{16, 2, SF_SetValues, "StackFrame.SetValues" },
{16, 3, SF_ThisObject, "StackFrame.ThisObject" },
{16, 4, nullptr, "StackFrame.PopFrames" },
/*ClassObjectReference command set (17) */
{17, 1, COR_ReflectedType, "ClassObjectReference.ReflectedType" },
/*Event command set (64) */
{64, 100, nullptr,"Event.Composite" }, // sentfrom VM to debugger, never received by VM
{199, 1, DDM_Chunk, "DDM.Chunk" },
};
支持的能力:
4.1.2 4.2 4.2.2 4.3 4.4dvm | 4.4art | 5.0.0 5.1.0 5.1.1 6.0.0 6.0.1 | |
---|---|---|---|
WatchFieldModification | false | false | true |
WatchFieldAccess | false | false | true |
GetBytecodes | false | true | true |
GetSyntheticAttribute | true | true | true |
GetOwnedMonitorInfo | false | true | true |
GetCurrentContendedMonitor | false | true | true |
GetMonitorInfo | false | true | true |
RedefineClasses | false | false | false |
AddMethod | false | false | false |
UnrestrictedlyRedefineClasses | false | false | false |
PopFrames | false | false | false |
UseInstanceFilters | false | true | true |
GetSourceDebugExtension | false | false | false |
RequestVMDeathEvent | false | false | false |
SetDefaultStratum | false | false | false |
GetInstanceInfo | false | true | true |
RequestMonitorEvents | false | false | false |
GetMonitorFrameInfo | false | true | true |
UseSourceNameFilters | false | false | false |
GetConstantPool | false | false | false |
ForceEarlyReturn | false | false | false |
jdb自开发以来,只有根据源码调试的功能,一旦源码改动或者没有源码(逆向分析)就无能为力,不像c/c++调试器可以直接看到当前反汇编,但是其实根据上述特性java调试也是可以有的,只不过android版本需要>5,jvm则无限制。利用jdwp协议提供的每个method自带的bytecode功能,自己实现字节码反汇编工具,便可以进行逐行反汇编,当前执行位置距离字节码偏移在location结构里也是存在的. GetByteCode可以实现java bytecode层级的调试
> bytecodes org.json.JSON <init>
0000: 70 10 3e 0b 00 00 0e 00