tmr232/Sark

Add a more friendly "decompiler" layer.

Closed this issue · 1 comments

This is not an issue, but just to put it in the queue. I find very useful the relationship between the decompilation line and his dissasembly address.

Taking this code as an example.

def get_decompiled_line(source, ea):
    if ea not in source.eamap:
        print 'strange, %x is not in %x eamap' % (ea, source.entry_ea)
        return
    insnvec = source.eamap[ea]
    lines = []
    for stmt in insnvec:
        qp = idaapi.qstring_printer_t(source.__deref__(), False)
        stmt._print(0, qp)
        s = qp.s.split('\n')[0]        
        lines.append(s)
    return '\n'.join(lines)

ea = idaapi.get_screen_ea()
source = idaapi.decompile(ea)
print get_decompiled_line(source, ea)

Imagine that for each ea in the meaningful plugin you add this information, sounds interesting right?

The bad part is that the layer of this "source" object isn't the friendliest possible. So I think that the powerful of this relationships (editing pseudocode and so on) would be amazing if Sark makes it Pythonic.

Would be happy to help, but I don't have a decompiler license at the moment.
Feel free to submit pull-requests with relevant patches, or buy me a license 😉