1

Is it possible to produce recompilable C code using IDA pro?

What I mean:

I can export binary into C pseudocode using "produce file" feature. But, the code is not recompilable. First, defs.h file is not present (I don't know if this comes with my ida pro license). I assume this file has all the typedefs, etc. I can use something like defs.h. Then I can fix definitions by removing or replacing "__fastcall" and "__noreturn" (I just added #define __fastcall to ignore this) (I don't if any other replacements required). And remove functions like _gmon_start__, etc. Then I can include required libraries.

Is there a way to all automate this (or is there an elegant way to do this)?

  • 2
    Short answer - AFAIK there is no publicly available way to automate the process. – fpmurphy Apr 24 at 17:09
  • thanks for your comment @fpmurphy – R4444 Apr 24 at 17:15
  • 1
    No, the decompiler is not 100% accurate, so you will have to read the assembly... – MindLerp Apr 25 at 3:39
  • BTW, nowadays I tend to use Gidra and Retdec rather than the IDA Decompiler to produce pseudo-C code. – fpmurphy Apr 25 at 4:54
  • yes, voted it as a duplicate, thanks. But, the question was answered 6 years ago, and I was wondering if any progress has been made since then, also, my question tends to - is there any script to automate this process btw thanks @MindLerp and fpmurphy – R4444 Apr 25 at 13:11

Browse other questions tagged or ask your own question.