Debugging InProc COM Dll
I have a project in VC++ 6.0 where there is an exe and a InProc COM Dll. I want to be able to place a breakpoint somewhere in the InProc COM DLL, but VC++ won't allow me to set a breakpoint.
I have the source code for this DLL, however I ca开发者_JAVA技巧nnot figure out how I can place a breakpoint in the code and the debug it?
Can someone help me.
It has been some time since I worked with COM but IIRIC, inside your COM project configure your executable as the launching application. It should work (sorry, I don't have VC++ 6.0 installed here anymore :().
If it doesn't work, you can try to attach the debugger to the running application.
In either cases make sure you have full debug information in your COM server.
Hope this helps.
- Attach to the process
- Open Project->Settings (Alt+F7)
- Open Debug tab, category Additional DLLs
- Add you in-proc server DLL
- Save .opt file on closing the debugger
This way next time you attach to process or manually open the .opt file, your in-proc server DLL gets loaded, its PDB gets parsed, last open source files get loaded, breakpoints get loaded.
The reason why "additional dlls" setting is needed here is because you in-proc server doesn't get loaded until an instance of his is CoCreated. So the debugger doesn't load its PDB file and the source files are treated as unknown text files, so the breakpoints in them get inactive (white).
Two things you can look into
- Uncheck Require source files to exactly match the original version in the Debugging options dialog
- If that fails, compile the DLL again (preferably with optimizations disabled
/Od
) and use the new DLL with its PDB file.
Not sure if this will work in VC6 but you could try _asm int 3
where you want the code to break, this should cause a breakpoint in your code and allow you to debug it.
精彩评论