radareorg / radare2-bindings

Bindings of the r2 api for Valabind and friends
GNU Lesser General Public License v3.0
131 stars 92 forks source link

Add support for archinfo callbacks in Python #211

Closed aronsky closed 5 years ago

aronsky commented 5 years ago

Ran into a problem when adding a new architecture to radare2. It has a variable instruction length, and going backwards in visual mode put me at incorrect addresses (not aligned with opcodes). After digging in radare2 code, I figured that if minimum/maximum instruction lengths were not available (that's the case with Python's analysis plugin), radare2 would not attempt to find the previous opcode, instead jumping back by a default value of 4 bytes.

This PR adds support for implementing the archinfo callback in Python.