How to debug COM object in Visual Studio 6.0 that

2019-08-10 09:08发布

I have an old C++ COM component which has to stay in Visual Studio 6.0 format. I can't for the life of me figure out how to debug the code in the actual COM component.

I'm able to build it in debug mode, add breakpoints and attach it to the dllhost.exe process, but the Visual Studio environment will only show me the disassembly from dllhost.exe and not my source code (It also doesn't stop on the breakpoints).

I remember a while ago there was a way to make IIS (or inetinfo.exe) the target of your debug action (i.e. when Visual Studio 6.0 asks you for the executable to launch your dll) and IIS would run in a single process mode. There was a registry key you needed to change, but googling hasn't helped.

2条回答
相关推荐>>
2楼-- · 2019-08-10 09:35

First of all, PDB file (produced during the compilation) should be in the same directory with DLL (can be set in project properties).

If your object does not use some ASP-specific functionality (Request, Response, Session objects) you can copy its invocation code to .vbs file and debug via setting cscript.exe your.vbs as debug target program.

There are explanations (for example) how to debug ISAPI DLLs - they are applicable to your COM object too (from OS/debugger point of view both are DLLs loaded into IIS process). Put attention to your IIS version and in/out-of-process stuff.

And finally, if nothing other helps, you can add some logging via OutputDebugString function and see it in free DebugView program.

查看更多
Bombasti
3楼-- · 2019-08-10 09:36

If it is a VB6 based COM component, you can open the project in VB6 and run it (a DLL project cannot be run). The project properties has some option whereby it can be asked to run so that it runs & registers itself.

Now, try hitting the ASP page, which makes a call to COM component. The breakpoints set in the class files will be hit, as the calls are made from ASP page.

查看更多
登录 后发表回答