Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 593
GregC Avatar asked Feb 04 '26 13:02

GregC


2 Answers

I always check dll-dependency issue by DependencyWalker and then using the Global Flags Editor gFlags.exe, in the "Image File" tab, setup your program and check "Show loader snaps".

When your programs runs, WinDbg.exe should output lots of DLL loading messages, from them, with the help of dependencyWalker along with your source code(if you use LoadLibrary), you should be able find out where goes wrong.

like image 104
Peter Avatar answered Feb 06 '26 04:02

Peter


See if the /VERBOSE switch can help you know which dependency the linker is trying to load and run when you build and start debugging the code.

If you use the /VERBOSE switch, basically the linker will write the messages to the output window about the libraries the linker is loading, which is also available in the build log so you can look in it for reference. This way if there is an error in loading a particular dependency MAY BE this might help you.

I have tried /VERBOSE when I had link errors and knew which dependency caused the problem in my code.

Refer http://msdn.microsoft.com/en-us/library/wdsk6as6(v=vs.80).aspx to check if this can help you.

like image 32
aeon Avatar answered Feb 06 '26 03:02

aeon