How to setup AppVerifier for "Always running" processes

AppVerifier is a very useful tool when it comes to finding memory leaks. It is relatively easy to configure if you have some understanding of how AKU's and PB work. There are pretty comprehensive instructions on MSDN found here. However if you need to use AppVerifier on something that loads during boot time, you need to perform extra steps that are harder to find. The purpose of this article is to explain in a greater detail what you need to do to setup AppVerifier for processes that load at boot time.

Here are simple steps that you need to follow to make AppVerifier work for "Always Running" processes:

1. Install Platform Builder (tools only install is enough because CETK is included with that install), install AKU if you haven't already
2. Open your AKU build window where you build images
3. (Optional) Removed/reset all the security or make sure it's configured properly
4. Copy all the AppVerifier binaries to your %_FLATRELEASEDIR% by running getappverif_cetk.bat from your wcetk directory. 

a. Default is "c:\Program Files\Platform Builder for Windows Mobile\5.00\CEPB\wcetk\DDTK\DESKTOP\getappverif_cetk.bat"
b. Or copy them manually. Here is the list of files needed (AppVerif* shim_*.dll symhlp.dll vlog.dll lmemdebug_autoshim.dll shimeng.dll)

5. Set the environment variables for the modules that need to be shimmed in our case device.exe and the OEM dlls that you want to check

a. Run SET VERIFY_MODULES=device.exe <list the rest of your dlls and exes delimited by spaces>. For example: SET VERIFY_MODULE=device.exe atidrv.dll

6. Set IMGSHIMENABLE=1 if you have set IMGPERSISTENTSTORAGE=1
7. Set VERIFY_OPTIONS=EnableFanOut (read more about options later ion the article)
8. Run makeverifyfile.bat from your WCETK directory (default is at "c:\Program Files\Platform Builder for Windows Mobile\5.00\CEPB\wcetk\DDTK\DESKTOP\makeverifyfile.bat")
9. Run makeimg.exe
10. Make sure that all shim dlls got signed properly
11. Flash the image on to the device
12. Connect the device to KITL and boot it (you don't need KITL but it's much more convenient to have it)
13. To make sure that KITL is connected you should see things like

a. TID:<address> ++Shim autoloader
b. Found shim 'shim_heap.dll'
c. And so on

14. Unfortunately there is no magic bullet that would just show all the memory leaks. The best way to find a leak is to get a snapshot then run user scenarios then get a delta. Here is an example of what can be done:

a. Boot the device
b. Run 'heapverif device.exe chk' (this will create a check point on device.exe)

d. Run 'heapverif device.exe delta' (this will report the potential leaks since the last check point on device.exe)
e. Repeat these steps to find all the leaks

Obtaining the log file

If you are connected with KITL the log file with AppVerifier information can be found in your release directory it should be called something like this
AppVerifier_<ProcessName>_<ProcessIdentifier>.log older versions of AppVerifier might call it VerifierLog_<AppName_<ProcessIdentifier>.log

Comments

  • Anonymous
    September 29, 2006
    Good article! However, there's a typo in step 6 - the flag should be IMGSHIMENABLE (letter G was dropped)

  • Anonymous
    October 02, 2006
    Thanks for pointing this out.

  • Anonymous
    June 24, 2008
    Nice article, But one small correction: instead of SET VERIFY_MODULE= it should be SET VERIFY_MODULES= and also its makeimg.bat instead of makeimg.exe Also have a doubt, when i tried running makeimg, there was an error saying: SignTool Error: File not found: shimeng.dll Could you help me? Srikrishna