Instruction schema
- Explore
- View source
- Playground
Loading ....
- YAML
- JSON
ethdebug/format/program/instruction
$schema: "https://json-schema.org/draft/2020-12/schema"
$id: "schema:ethdebug/format/program/instruction"
title: ethdebug/format/program/instruction
description: |
A schema for representing the information pertaining to a particular
instruction in machine code.
type: object
properties:
offset:
title: Instruction byte offset
description: |
The byte offset where the instruction begins within the bytecode.
For legacy contract bytecode (non-EOF), this value is equivalent to the
instruction's program counter. For EOF bytecode, this value **must** be
the offset from the start of the container, not the start of a particular
code section within that container.
oneOf:
- $ref: "schema:ethdebug/format/data/unsigned"
- $ref: "schema:ethdebug/format/data/hex"
operation:
title: Machine operation information
type: object
properties:
mnemonic:
description: The mnemonic operation code (PUSH1, e.g.)
type: string
arguments:
description: The immediate arguments to the operation, if relevant.
type: array
minItems: 1
items:
description: |
An immediate value, specified as a `0x`-prefixed hexadecimal string.
type: string
pattern: "^0x[0-9a-fA-F]{1,}$"
required:
- mnemonic
context:
description: |
The context known to exist following the execution of this instruction.
$ref: "schema:ethdebug/format/program/context"
required:
- offset
- context
examples:
- offset: 0
operation:
mnemonic: "PUSH1"
arguments: ["0x60"]
context:
code:
source:
id: 5
range:
offset: 10
length: 30
ethdebug/format/program/instruction
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:ethdebug/format/program/instruction",
"title": "ethdebug/format/program/instruction",
"description": "A schema for representing the information pertaining to a particular\ninstruction in machine code.\n",
"type": "object",
"properties": {
"offset": {
"title": "Instruction byte offset",
"description": "The byte offset where the instruction begins within the bytecode.\n\nFor legacy contract bytecode (non-EOF), this value is equivalent to the\ninstruction's program counter. For EOF bytecode, this value **must** be\nthe offset from the start of the container, not the start of a particular\ncode section within that container.\n",
"oneOf": [
{
"$ref": "schema:ethdebug/format/data/unsigned"
},
{
"$ref": "schema:ethdebug/format/data/hex"
}
]
},
"operation": {
"title": "Machine operation information",
"type": "object",
"properties": {
"mnemonic": {
"description": "The mnemonic operation code (PUSH1, e.g.)",
"type": "string"
},
"arguments": {
"description": "The immediate arguments to the operation, if relevant.",
"type": "array",
"minItems": 1,
"items": {
"description": "An immediate value, specified as a `0x`-prefixed hexadecimal string.\n",
"type": "string",
"pattern": "^0x[0-9a-fA-F]{1,}$"
}
}
},
"required": [
"mnemonic"
]
},
"context": {
"description": "The context known to exist following the execution of this instruction.\n",
"$ref": "schema:ethdebug/format/program/context"
}
},
"required": [
"offset",
"context"
],
"examples": [
{
"offset": 0,
"operation": {
"mnemonic": "PUSH1",
"arguments": [
"0x60"
]
},
"context": {
"code": {
"source": {
"id": 5
},
"range": {
"offset": 10,
"length": 30
}
}
}
}
]
}
Loading...