ExtendedAndroidTools icon indicating copy to clipboard operation
ExtendedAndroidTools copied to clipboard

Describe JDWP messages.

Open michalgr opened this issue 2 years ago • 0 comments

Implement a set of python modules containing objects describing layout of JDWP messages.

An example of such description could look like this:

Version = Command(
    name="version",
    id=1,
    out=None,
    reply=Struct([
        Field("description", types.String),
        Field("jdwp major", types.Int),
        Field("jdwp minor", types.Int),
        Field("vm version", types.String),
        Field("vm name", types.String),
    ]),
)

ClassesBySignature = Command(
    name="classes by signature",
    id=2,
    out=Struct([
        Field("signature", types.String),
    ]),
    reply=Struct([
      ...
    ]),
)

...

VirtualMachine = CommandSet(
    name="VirtualMachine",
    id=1,
    commands=[
      Version,
      ClassesBySignature,
    ],
)

The schema should allow us to express common data types (see table at the bottom of this page), compound structures, arrays (see ClassesBySignature command) and tagged unions (see Composite Command). Schema and each command set should be defined in a separate module. Such JDWP description should support pattern matching as a major tool to analyze shape of structs.

Having such description will allow us to write codegen tools generating JDWP data structures and parsers/serializers for different programming languages.

michalgr avatar Sep 05 '23 22:09 michalgr