Cecil.Decompiler 15 Dec 2008


I know I'm quite late to present what I've been working on during the last Hack-Week we had at Novell, but better late than never, right? Cecil.Decompiler is a library which relies on Cecil, takes one of its method, and give you back an object graph representing the decompiled body of the method, an AST, depending on the language you target. It also provides you ways to pretty print this AST at your convenience. It takes its roots in Cecil and is actually a refactoring of the Cecil.FlowAnalysis library that folks at db4o contributed to the Mono project. During the last Hack-Week, I started refactoring Cecil.FlowAnalysis, and since then, I've been working pretty seldom on it. It was last month that I decided to give it a kick, and even took a week of vacations to organize a CodeCamp with friends to give it a boost and have fun altogether. The next blog post will be the occasion to describe the last week, and to thank my friends for their help. Let me first warn you. It's still very young, and doesn't support a lot of constructions. On the other hand, it can already do pretty neat stuff, and its architecture makes it easy to use and improve, or add new languages. The mandatory picture of a little program using the decompiler to decompile itself: Don't pay attention to the code as it's full of debug code. Basically only the last two lines are interesting. The code can be pulled from SVN: http://anonsvn.mono-project.com/source/trunk/cecil/decompiler I guess this will trigger a few interesting questions, so I cooked a little list of questions I already had, and answers I provided.
Q: What it is usable for?
A: It can be very useful for tools that perform static analysis on the assembly. For instance, Gendarme could use it to detect more complex patterns in your code.
Q: Why would you work on such a project while there's obviously a better known tool that seems to do the same (and which have been working for a long time)?
A: Cecil.Decompiler is Open Source, and licensed under the very liberal MIT/X11. Also it's a library, which makes it easy to use from your own IDE, tool, or whatever project you can think of.
Q: But then what's a good library without a good GUI?
A: I'll write more on that later, but my good friend S├ębastien, author of the fantastic Reflexil project, started a Windows Forms GUI on top of it. And from what I understand, he plans to write the core of his tool using in platform agnostic fashion, so that plugins for his GUI could be re-used by a Gtk# GUI for instance.
Q: Why don't you push a binary distribution for now?
A: The project is still very new, and we're changing it a lot. So if someone is interested in having a look at it, he should rather directly pull the sources from SVN regularly.
Q: Should I start filing bugs ?
A: It's not worth it fom now, we're pretty much aware of what's missing and failing.