Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to make disassembly more forgiving #19

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

feliam
Copy link
Contributor

@feliam feliam commented Sep 29, 2018

For consideration...

Added "silent" to disassemble_one, disassemble_all, disassemble so it returns an INVALID when undefined opcode or a zero completed operand when no more data in bytecode.

(Also it adds a copy.copy there. May be a bug not to do it because several disassemblies? will be using the same Instruction instance? )


if silent:
if opcode not in instruction_table:
instruction = copy(instruction_table[opcode])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just get instruction_table[0xfe] for INVALID? Also is there something in the yellow paper that describes the behavior when an unimplemented instruction is run? Just want to make sure it's semantically the same as INVALID, but I don't see anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps I ment to get 0xfe.

Unimplemented instruction is defined in the yellow (if I remember correctly) as the same as an INVALID. Only diff is that it may get redefined I guess ..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    try:
        instruction = copy(instruction_table[opcode])
    except KeyError:
        if silent:
            instruction = copy(instruction_table[0xfe])
        else:
            raise

??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants