19 April 2011

Getting confused when exploring Qemu source? gcc comes to rescue!

Quick summary first: use gcc -save-temps!

Ever dig into Qemu ( source code? OK, I assume you ever did that at least once... may I ask, what's your first impression?

Here's mine: it's complex C code...and to make it more like a nightmare, it heavily uses c (gcc, to be precise) tricks almost everywhere. ifdef, "##", define....almost endless. IMHO, since Fabrice Bellard, its author, is somekind of C compiler wizard, he somehow pull out all of those tricks so easy from his mind. I know it should make the code kinda more readable, but for me, is not.

Take one for example: INDEX_op symbols. AFAIK, it has something to do with code generation, to be precise it's an index toward instruction op which will later be translated to target. Previously, I thought it was defined somewhere in header files, but turns out (after long hours of grep and cscope sessions) they were created by preprocessor (token concatenation, to be precise -- explanation here).

So, what is the recipe? I think I found it (thanks to this URL , although not really ideal. During configuration session, use extra cflags like this:
./configure --extra-cflags="-save-temps"
Put additional parameters as needed. Then do "make". Now, if you do this in main Qemu source tree:
find -iname "*.[is]"
you'll find several files. Each of them are result of  preprocessing (.i) and assembling (.s). Yeap, "-save-temps" comes to rescue, folks! So there you go... open them one by one and hopefully you get better picture on how to code works.


Mulyadi Santosa

04 April 2011

Troubleshooting failed login to GTalk in Empathy 2.30.3

Alright, I just wanna make it quick:
- Check "Ignore SSL certificate errors"
- Uncheck "Encryption required (TLS/SSL)"
- Use "443" as port
- Check "use old SSL"

OK, that's it works for me, hopefully it works for you too. Cheers...


Mulyadi Santosa