Sunday, August 22, 2010

DILE feature: loading modules from memory dump files

One of the main reasons why I started to work on dump-debugging support for DILE is that I thought I could add a little twist to it once again.

The problem
If you're using VS2010 for analyzing a dump file then you'll run into a quite serious problem very quickly: if VS can't find the original source code and pdb file of the modules then it will show you only the disassembled x86 code. This can really make life difficult as it's quite difficult to map back those x86 instructions to your actual code to figure out which line caused a problem etc.

The solution
DILE has had a very interesting feature for ages: it can load dynamically generated assemblies from the memory of a debuggee process. What this means is that if your application generates assemblies on-the-fly via Reflection.Emit (compiled RegExes do the same or the XSLT compiler if an XSLT file contains C# code) then DILE can load that assembly and treat it as any other assembly even if it's never saved on the hard disk. And of course, all the usual features like breakpoints, stepping etc also work with such dynamic assemblies.
So obviously I wanted to do the same with dump files since they usually contain the full memory of the debuggee, including loaded modules. Fortunately it was quite easy to modify the code to load modules from the memory of the debuggee process (i.e. from the dump file) instead of looking for them on the hard disk. Although fixing the UI wasn't trivial but that's a long story. :-)

Usage
If you download the latest weekly build of DILE and load a dump file in it then you will notice that there's a new menu item in all context menus related to modules: "Add module to project from memory dump". If you click on this option then DILE will read the module from the dump file and not from your local hard drive.

Why is this cool?
As a result you don't have to worry anymore about what version of your application crashed when you created the dump file, you don't have to know what patches were applied on your application/3rd party components/.NET Framework and most importantly you don't have to have exactly the same version of all components on your machine when you're dump debugging. DILE will show you the state of your application _exactly_ as it was when the dump file was created. And that makes finding bugs a lot easier. :-)

Update:
The Screenshots
Alex suggested in the comments section adding screenshots to this post which is definitely a good idea. I used to upload files to FreeWebTown but let's say... I'm not really satisfied with them. They simply deleted my account without any warning so all the files that I had there are lost. Unfortunately I don't have backups as well because over the years I had a few unplanned hard disk crashes etc.
Anyway... I've realized that I can also upload files to SourceForge. I trust them more. :-)
So, the screenshots:



Opening a memory dump file

Loading module from the memory dump file in the Modules Panel



Loading module from the memory dump file in the Call Stack Panel

Loading module from the memory dump file in the Object Viewer

Labels: , ,

Saturday, May 08, 2010

(Almost) Weekly builds

Usually after working on DILE, I make a release build which I upload to SkyDrive for myself. The next day I download it in my office and use it. "Eat your own dogfood.". And I was thinking that others might also be interested in getting such latest builds of DILE. Fortunately my suspicion was confirmed by an e-mail that I received not so long ago. Thus I decided to make weekly builds of DILE publicly available.

First of all a warning: what I upload and make available is _never_ a stable, tested version of DILE. It might crash and cause other problems. I don't promise that it works properly. It is a version that is still under development, features might not be completely implemented and there might be bugs that officially released versions should not have. I strongly recommend using v0.2.6 that is available on SourceForge for doing serious job like debugging on a production server.

But if you're still interested in using the latest version of DILE despite the warning then you can find the build on SourceForge. I will regularly update this file based on the latest modifications in the source code.

I really hope that sharing the latest build of DILE will help me with getting more feedback. Therefore if you have any opinion about the changes that you see in DILE or you find any bug that I introduced since the last official release then please let me know.

Edit: I modified the link to the weekly builds. I will always put the latest weekly build in the DILE/WeeklyBuild folder together with a couple of previous versions.

Labels: ,