-
Notifications
You must be signed in to change notification settings - Fork 49
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
base: master
Are you sure you want to change the base?
Conversation
pyevmasm/evmasm.py
Outdated
|
||
if silent: | ||
if opcode not in instruction_table: | ||
instruction = copy(instruction_table[opcode]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ..
There was a problem hiding this comment.
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
??
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? )