What is the best way to translate Z3's AST into ASM code? [closed]

怎甘沉沦 提交于 2020-05-17 06:05:21

问题


There is an example:

mov edi, dword ptr [0x7fc70000]
add edi, 0x11
sub edi, 0x33F0B753

After Z3 simplification I have got (memory 0x7FC70000 is symbolized):

bvadd (_ bv3423553726 32) MEM_0x7FC70000

Now I need to convert Z3 into ASM to get result like this:

mov edi, 0xCC0F48BE
add edi, dword ptr [0x7fc70000]

Or like that:

mov edi, dword ptr [0x7fc70000]
add edi, 0xCC0F48BE

回答1:


There is no such tool publically available, to the best of my knowledge. And it's not quite clear how one would design one, as it would have to be very specific for a given machine's assembly language. (X86 assumption can take you far I suppose.) It might be better to compile it to straight-line C, and then use the ubiquitously available gnu-c toolchain to go the last mile. But of course, it all depends on your specific use case and needs.

Take a look at this page: http://smtlib.cs.uiowa.edu/utilities.shtml

Perhaps the tools listed there can give you a starting point if you go down the path of developing one. And if you do develop such a tool, please do advertise it there as well.



来源:https://stackoverflow.com/questions/61801235/what-is-the-best-way-to-translate-z3s-ast-into-asm-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!