问题
I am writing an inproc com dll that runs in the dllhost.exe surrogate, but I am running into an issue debugging it.
if there were multiple dllhost.exe's running at once, it would be annoying to find the right one to attach a debugger to. Is there an easy way to identify yours if a lot are running?
Thanks
回答1:
Process explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653) has convenient feature that allows you to look at which processes have loaded which DLLs. You can also do a search for DLLs in all running processes.
Sysinternals also has a command line utility called ListDLLs (http://technet.microsoft.com/en-us/sysinternals/bb896656) that should work for you.
Once you find the PID of the process that has your DLL, you can attach to it.
回答2:
There's an alternative strategy. Just don't try to identify which to attach to. Set a breakpoint in your code and attach to all dllhost.exe processes - when a breakpoint is hit that process will pause under debugger.
来源:https://stackoverflow.com/questions/5541256/debugging-an-inproc-com-server-running-in-dllhost-exe