How to use Deblector?
Asked Answered
T

2

11

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.

Tournedos answered 22/1, 2009 at 21:35 Comment(0)
R
8

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.

Router answered 18/4, 2009 at 15:29 Comment(3)
Good enough... I did eventually figure it out, but I forgot about this question. Maybe it will be helpful to others in the future! Thanks!Tournedos
what do you mean by "you must have halted the program to set a break point"?? How can I halt a program withouth setting a breakpoint? It's like saying "to set a breakpoint first you must set a breakpoint"!Muttra
You can halt a program at the current position, the point where the program "breaks" is then wherever the instruction pointer happened to be at this moment.Router
R
0

There's Reflector Pro now, which does just that. It decompiles managed assemblies to C# or VB.NET, and creates the necessary PDBs. Then you can set breakpoints and step-into into any managed assembly you like.

http://www.red-gate.com/products/reflector/walkthrough.htm

Ralaigh answered 5/7, 2010 at 10:3 Comment(1)
Yes, thank you Jason! We have been using that, but didn't find it worth paying for. Turns out, now that we have gotten our system up and running, the really tricky problems are mostly solved and we don't need to debug vendor code too often. But it's nice to know we canTournedos

© 2022 - 2024 — McMap. All rights reserved.