views:

1780

answers:

2

I am working with a 3rd 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 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 docs - I will post them somewhere that Google can reach.

+7  A: 

Hi, maybe this will help you:

First of all I am using the DeblectorAddin-1.01-Alpha from (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 followin 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 64bit platforms:
The application must be set to run as 32bit 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.

Fionn
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!
Jasmine
@Fionn: 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"!
Piotr Owsiak
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.
Fionn
A: 

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

Jason Crease
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 can
Jasmine