Search code examples
.netdebuggingreflector

How to use Deblector?


I am working with a third-party framework, and the code is pretty bad, and I'm getting exceptions that I can't figure out. I was able to decompile using .NET Reflector, and now I'm trying to debug using Deblector, but I can't even figure out how to get a breakpoint set. Why is there no documentation for this tool?

There is nothing available about how to use it. The built-in help simply gives a list of commands, which I understand just fine, as they are the standard debugger commands... but I can't figure out how to get it working so I can step through code and I need to examine variables too.

I have been googling for a long time and all I can find is blogs saying how wonderful this tool is. Well, I'm sure it would be pretty cool if I could make it work. Where is the documentation, or how do I set a breakpoint?

I can get it to attach to my process, but I can't pause or anything, and it doesn't break when the exception happens, even though I have activated that option.

Seriously... we should do some documentation - I will post them somewhere that Google can reach.


Solution

  • Maybe this will help you:

    First of all, I am using the DeblectorAddin-1.01-Alpha from (I don't know if it works like this in older versions too) from http://www.codeplex.com/deblector.

    With this version, it is quite simple with the following procedure:

    • Attach to a process

      • With the a[ttach] command in the command line: a <pid> .
      • Using the attach button in the toolbar (window with a gear in it).
    • If the attach was a success (you see this in the console, activated with Tools->Deblector) all referenced assemblies should be loaded.

    • Setting a break point (you must have halted the program to set a break point):

      • Using the b[reak] command: e.g. b <Namespace.Class.Function> - there are more options available use help b for that.
      • Much simpler: Use the Break button (or F9) and select a row in the Deblector IL view.

    Additional usage notes:

    Deblector Commandline:
    The command line will not respond if you are currently attached to a process and running, you must halt first or it will not respond properly.

    For 64-bit platforms:
    The application must be set to run as 32-bit application or it can't be attached to.

    In Visual Studio: Project -> Properties -> Build Platform target: x86

    With the corflags tool: This should be installed with Visual Studio (use the Visual Studio command prompt).

     To set 32-bit mode: corflags <ProgramName> /32BIT+ 
     To unset it:        corflags <ProgramName> /32BIT-
    

    To find the process ID and check if a program runs in 32 or 64-bit mode:
    Process Explorer is very helpful for that.