1
votes

Here is the scenario. I am using Visual Studio 2010. I have a C++ COM dll. This dll is used by another C++ dll project which is not a COM project. The second dll exposes API's to client applications. The dependency is Client->Non-COM dll->COM dll. I would like to debug the COM dll from any client application.

Here are the things that I have already tried.

  1. Created a C++ win32 console application that makes use of the non-COM dll.
  2. Kept both COM dll and non-COM dll and the corresponding pdb files in the debug directory of the win32 application. In Options->Debugging->Symbols, I have selected the path to the debug directory and checked "only specified modules" option to load these files.
  3. Set all include and library dependencies.
  4. Now, I can successfully run the application. But while debugging, I can navigate only to the non-COM dll by pressing F11 and the same F11 navigation is not working from this dll to the COM dll.
  5. When I tried this with two non-COM dll's and a client application, I could navigate upto the innermost dll. At this point, I realized I should change the corresponding registry entry to point to my COM dll file located in the debug directory of the client application, but no luck!

I am sorry that I cannot share the code or describe in detail.

Any solutions?

2
Simplest explanation is that you just didn't create the COM object successfully. Debug + Windows + Modules, ensure you see the COM dll listed there. Right-click it and select "Symbol Load Information" to see where the debugger looked for the PDB file.Hans Passant

2 Answers

1
votes

You can set a break-point in your COM dll source code and then attach it to process named 'dllhost.exe'. Whenever native dll makes a call to COM dll, breakpoint will hit.

0
votes
  1. Set the COM dll project as the startup project. Right click on the project. Navigate to Properties->Configuration Properties->Debugging->Command. Enter the complete path to the client application. Eg: C:\Users...\Debug\ClientApplication.exe.

  2. Register the COM dll by the command regsvr32 "pathToCOMDll" running windows command prompt as admin. Breakpoint will be hit. Eg: regsvr32 "C:\Users...\COMDll.dll" where COMDll.dll is the COM dll. It should not really matter what dll is referencing what dll.

Note: Avoid editing the windows registry directly and try to use regsvr32 command.