joxeankoret / diaphora

Diaphora, the most advanced Free and Open Source program diffing tool.
http://diaphora.re
GNU Affero General Public License v3.0
3.6k stars 371 forks source link

How does Diaphora handle Hex-Rays INTERR? #163

Closed vient closed 4 years ago

vient commented 5 years ago

After an INTERR occurs in Hex-Rays it can't decompile functions anymore in current session. At the same time, Diaphora can still somehow open working decompiler window from results, even if I can't jump to the same function in decompiler window manually. Sadly, I didn't preserve this IDA session, and next time there was no INTERR.

My question is, does it mean that Diaphora can somehow handle Hex-Rays internal errors and continue to decompile functions after one occurs? I didn't find anything regarding this problem in source code.

If not, first INTERR occuring in analysis stage should be permanently disrupting working of all decompiler-based methods. In that case it may be useful to detect INTERR, save progress to database, notify user so they will reopen the IDA, and continue from next function after reloading Diaphora.

joxeankoret commented 5 years ago

There is no way, as far as I know, to detect if an INTERR happened in the decompiler. If I remember correctly, it just returns a cfunc_t object if it worked, or None if failed to decompile.

vient commented 5 years ago

As Ilfak said,

There is no official way of knowing if an interr occurred in the past but you could hook to UI events and wait for ui_msg. We use msg("%a: INTERR %d\n", errea, code); to inform the user about an internal error. Ah yes, if it was your plugin who requested decompilation, the internal error is returned as a hexrays_failure_t object.

For me, this whole INTERR thing is not really a problem since it happens quite rarely (but happened to me on the first run of Diaphora), but you can consider this as possible enhancement.

joxeankoret commented 5 years ago

I don't think it's worth the effort of hooking to UI events. Closing for now but feel free to re-open if you think something should be done on my side for some reason.