Search code examples
c++visual-c++windbgstatic-linking

How to debug static dependency loading problems?


How can I debug a scenario where a Visual C++ 2010 SP1 application is unable to completely load its dependencies, and quits prematurely, without showing its UI?

I am interested in a good guides to Fusion Logs, dependency walker, and remote debugger, if you think they are relevant. Is it something that can be easily verified with WinDbg? What about Process Explorer?

Is it possible to launch a process on a remote machine with remote debugger attached?

Would it be possible to verify if a proper Visual C++ 2010 SP1 run-time is installed?

One limitation: the application runs fine on the developer's box with Visual Studio installed. Problem can only be observed on a clean target machine. This means that problem might disappear when a tool chain is installed.


Solution

  • Is it possible to launch a process on a remote machine with remote debugger attached?

    Sure you can. For example in Visual Studio 2008, right-click your project -> Properties -> Configuration Properties -> Debugging, select "Remote Windows Debugger" in the "Debugger to launch" dropdown list. Then type the full path of your EXE on your remote machine and according arguments if any.

    Before doing so, you need first run remote debugging monitor on your remote machine. Copy \Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86(or other platform) to your remote machine, and run msvsmon.exe.

    Generally, if your application quits due to the missing of some static dependency, you can use dependency walker to check which one is missing.