Saturday, December 6, 2008

Stack trace from within a program

Ever coding and want to be able get a stack trace at runtime? Edd Dawson's stack trace source, here, bundles this functionality nicely with C++ with cross-platform support. The MSVC source uses imagehlp.dll or dbghelp.dll to obtain the trace and decipher the addresses to symbol names. GCC/MinGW doesn't produce PDB files which contain the symbol names, which makes it impossible to use dbghelp for the stack trace. To solve this, I have attempted to compile Wine's dbghelp.dll for Windows. Wine's dbghelp.dll is able to interpret dwarf and stabs debugging information, which are produced by GCC/MinGW, and Wine's uses the LGPL license, allowing it to be used in more liberally licensed projects. I started a project on SourceForge to host the code ( basically a makefile to download Wine's source, and compile dbghelp.dll using some modified source files ).

Thursday, November 27, 2008

Alchemy and LLVM


I've just tried Adobe Alchemy, a preview tool that uses LLVM to compile C++ to actionscript. It still has some touching up to do ( see my posts here and here and my experience with alchemy ), but it is very promising. There is even someone working on porting Doom to flash ( here ). This finally opens the door to truly portable binary files. One can now distribute C/C++ applications to anyone as swf files, without requiring the user to compile them. Now we can really have a web-based OS ;) ( kidding ).

Truth is, I've always disapproved of flash, because it seemed to encourage a less semantic web, with many sites just filled with bloated flash. A nice clean web page, with a fallback for no javascript is the way it should be :). But now I just look at flash as another virtual machine, and it can be targeted by LLVM. And so I approve. All we need now is an LLVM JIT implementation of the flash player ;). While your at it, throw in an Actionscript front-end to LLVM.

I hope LLVM grows much more, and solves all of the worlds problems. What will LLVM look like in 5 years? Front-ends, back-ends, optimizations, JIT, etc., I don't see the limit.