Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Numeric labels as PC assertionss #20

@fjl

Description

@fjl

The geas disassembler should be usable not just for inspecting bytecode, but also for editing bytecode. One challenge with this are jumps. The disassembler output for jumps looks like thi:

     ...
     push 0x23
     jump
     ...
     jumpdest
     ...

There is no way to infer where the jump actually goes. To help with this, the disassembler can print PC numbers (geas -d -pc):

           ...
000a:      push 0x23
000c:      jump
           ...
0023:      jumpdest
           ...

This makes jumpdest offsets visible, but it also means the disassembler output is no longer a valid assembler input. But there is no reason it couldn't be. We just have to make numeric labels valid in the input language, and turn them into a kind of assertion. When the assembler encounters a numeric label, it should check the computed PC at that point matches the label.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions