Asm output while executing


I'm trying to catch assembly output and do some formatting for its
presentation while being executed.
I face a problem, which is clear from the error, although I have no
clue on how to do it otherwise.
If generating the code for its asm output and then for jit execution I get:


Well maybe it was pretty obvious for some people, but it took me some
hours. I must point out that I was using llvm 2.2, not svn. An API
change affected me: addPassesToEmitFile function only accepted
FunctionPassManager, now it works with PassManagerBase, which I needed
in order to use the same Pass Manager than my other Passes I'm working
on. So I updated to svn and here I put the code I use: