In my application i am using the third party dll and i dont have any soruce code avialable. Now i am getting the exception in Windows7 OS, so i would like to debug and kwow what is the exact reason.
Reflector will not help me in this case as its a unmanaged dll. And decompiler is giving error on passing this dll(Extraction of source code).
To debug in visual studio, it expects the PDB file and .pdb can be generated only from source code.
In the debug section i slected "Enable Native code debugging option" and in security section i selected the option as paritially trusted application to get rid of the exception.
I am not able to conclude, what could be the problem and dont have any idea apart from above, how to resolve?
On my knowlege we can not debug unmanaged dll, if we dont have source code available.
Can any one please suggest, if we have any techniques around that.
My thought process: If i can get runtime information on which API its failing, i could opt for alternative API and resolve the problem.
Thanks in advance.
Regards, Siva.
Of course you can debug it. You can step through assembly code just fine and check the state of registers, etc.
It seems that you really want to debug by inspecting and executing the original source code. This is obviously impossible without the source code, as it is in general not possible to reverse engineer the source code from optimized native executable (it is possible to reverse engineer functionally equivalent code, but this can differ heavily from the original source). Native dll usually doesn't contain names of the symbols (classes, functions, members, etc) except for the exported ones, so it is not possible to create e.g. a friendly stack trace with method names.
Besides that, even if you had source code, it would be useless without symbol file (.pdb), as pdb contains data about mapping between original source code and compiled instructions, as well as other information (symbol names, optimization info, etc).
However, it is not that hard to debug using assembly code if you have a pdb file but not the source code (ok, it is not that easy, either :). These 2 articles (http://www.microsoft.com/msj/0298/hood0298.aspx and http://www.microsoft.com/msj/0698/hood0698.aspx) have enough info to debug most of the usual situations where you might need that.