Cecil.Decompiler 7
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.
Trackbacks
Use the following link to trackback from your own site:
http://evain.net/blog/articles/trackback/520
-
Jean-Baptiste Evain vient de l’annoncer sur son blog : il travaille actuellement sur un nouveau projet particulièrement ambitieux appelé Cecil.Decompiler. Comme son nom l’indique, il s’agit d’un décompilateur .NET basé ...


Awesome!
It’s a great beautiful colored console !!! ;)
This is a great idea, thanks for putting this together.
I also like the idea of putting a UI on top of this. Add the ability for authors to write plug-ins into such a tool, and we’d finally have an open-source decompiler ;) ;)
Hey Jason,
That’s definitely the plan. Sébastien will be leading the Windows.Forms GUI effort, and I know he’s cooking something nifty for authoring plugins.
JB,
Very nice! Keep me (and everyone else) informed on this GUI effort. I’d be more than willing to test out the plug-in model.
Awesome. Are there any plans to fix the formatting of properties? (I notice they use getter/setter methods there which I don’t believe will compile.)
Yes, as I said, it’s still pretty early, it’s full of issues. Good news is that we’re aware of most them, so yeah, it will be fixed.
If you look closely, it’s not the only issue the snippet have, for instance, enums are still passed as constants instead of a proper enum use.