I am trying to iterate all the C statement
(could be very coarse-grained, it's fine) in IDA-Pro recovered assembly program.
Suppose I only consider these statements:
State :: =
| if-else cond;
| loop;
| assignment;
| function call
| return
| {s1; s2; s3 ...}
And after some quick search, I know that there are some (third-party) plugins that can help to identify some C
control-flow structure, and I list some of them below:
if-else cond : N/A
So my questions are:
Is there any plugins that can recover if/else statement? It looks easier than loop, but I just cannot find a well-developed way to recover the statement.
Is there anyway/api/scripts to iterate C statements in IDA-Pro? Or I have to implement myself?
Ideally it should look like this as this is essentially used in source code analysis... (sorry for this pseudo code, I just want to clarify)
let aux s =
match s with
| If e1 b1 b2 -> analyze e1 b1 b2
| Loop e1 e2 e3 b1 -> analyze e1 e2 e3 b1
| Assign v1 v2 -> analyze v1 v2
| States sl -> List.iter analyze sl
| ... in
List.iter aux statement_list
...