[tip]how to diagnose module loading issue

Basically, you have two choices: dependency walker and GFlags from MS.

Tips about using dependency walker to find missed/failed to load dependency modules:
1. Run application.bat and execute depends.exe there to consume your application's environment settings especially about PATH setting for searching for modules.
2. It tells truth about what modules loading a specific module requires fail to be loaded. So believe it. In my case I met, nm.dll failed to be found, told by Depends. BUT actually nmXX.dll exists on the disk. so nmXX.dll should be required for loading instead of nm.dll. Believing it finally revealed that new 3rd party nm.lib changes to target for nm.dll instead.

Tip about checking module depedency:
1. import library file lib file, if directly open it by text editor, you can find its target dll name.
2. by viewing a dll's import table using dumpbin, its required modules's dll name and functions can be viewed directly.

 

About how to use GFlags

GFlags (Global Flags)

Note: basically you need to install Debugging Tools For Windows from http://www.microsoft.com/whdc/devtools/debugging/default.mspx to get it.

Gflags released as part of debugging tools for windows (x86) from MS can be used to set an option for Inventor.exe that will enable additional diagnostic output to the Visual Studio debugger output window. This can help determine who is attempting to load a missing .dll or who is unable to resolve a symbol in a dll.

How To Use It?

1. Get GFlags, open it and do some settings. Keep it running.

You may have a copy of gflags.exe on your machine under c:\Program Files\Support Tools.

Type Inventor.exe in the "Image File Name" edit control, then click on the Image File Options radio button, check the loader snaps option, then press Apply & OK.

If not, you can install the Debugging Tools For Windows from http://www.microsoft.com/whdc/devtools/debugging/default.mspx and there is a newer gflags.exe with a slightly different UI.

Click on the Image File tab, type Inventor.exe then <tab>, check the loader snaps option, Apply, OK.See below snapshot:

2. Load Inventor in the Visual Studio debugger and you will see lots of LDR messages in the output window. If you get an "Entry Point Not found" error dialog showing the symbol name and the dll that was expected to contain the symbol, you can look in the debugger output window and the last entry will tell you exactly which dll was trying to resolve its symbols when the error was detected. For example if DL.dll could not find an entry point in RSe.dll you would see this:

   LDR: rse.dll used by DL.dll

   LDR: Snapping imports for DL.dll from rse.dll

Or, if a dll is missing, for example if DL.dll was not found, you will see the following output:

   LDR: DL.dll used by DWGExt.dll

   LDR: LdrpResolveDllName - call to RtlDosSearchPath_U failed

   DllName: "DL.dll"

If you get the error dialogs but don't get the LDR messages then it probably means the error happened on the initial load of Inventor.exe, in that case you can just run Depends.exe on Inventor.exe to figure out the cause.

Its recommended to turn off the loader snaps option when you are done, otherwise the output window will be too cluttered with these messages during normal debugging. 

 

posted @ 2011-06-16 11:02  能巴  阅读(258)  评论(0编辑  收藏  举报