wisk / medusa

An open source interactive disassembler
Other
1.04k stars 92 forks source link

Pybind11 - unknown <unsigned int> in enumeration #61

Closed rutherfm closed 7 years ago

rutherfm commented 7 years ago

While trying to build Medusa, I encountered and error while building "src/tools/pydusa/py_memory_area.cpp" line #24 stating - unknown in enumeration

After reviewing src/tools/pydusa/py_memory_area.cpp#24 I make the following change to get build to complete.

change: py::enum_(rMod, "MemoryAccess")

to: py::enum_MemoryArea::Access(rMod, "MemoryAccess")

OziDrifter

wisk commented 7 years ago

Hi rutherfm,

Thanks for contributing! I also had this issue and didn't take time to provide a correct patch, sorry about that. The initial issue is either C++ or python enum can't act as bitfield, and this is what I was looking for in this case (e.g. MemoryAccess.READ | MemoryAccess.WRITE). As a quick workaround I defined manually these values in python. :(

Regarding your patch, it looks weird for me because enum_MemoryArea isn't declared. Anyways, I tried to change as you told, however it doesn't seem to compile:

error C3083: 'enum_MemoryArea': the symbol to the left of a '::' must be a type
error C2039: 'Access': is not a member of 'pybind11'
error C3861: 'Access': identifier not found
error C2228: left of '.value' must have class/struct/union
error C2228: left of '.value' must have class/struct/union
error C2228: left of '.value' must have class/struct/union

I guess you might added some extra code not present in your message. If so, feel free to share. :)

wisk commented 7 years ago

It should be fixed with this https://github.com/wisk/medusa/commit/c52b7eb6dd70ea91931fe36a536501e85b2f4a8b#diff-5a14c1ca42ec2c00ce0faf6e5d80966cR18 I didn't try on Linux though.