none
xperf and FreeLibrary: symbols loading problem RRS feed

  • Question

  • I have discovered the following bug with loading symbols in xperf:

    If exe dynamically load dll (LoadLibrary), use it in any way, and then unloads it (FreeLibary), the symbols to it will not be loaded and displayed in xperview. If exe dynamically load dll and does not unload it, the symbols will be loaded normally.

    Appears on windows 7 x64

    Code to demonstrate the error:

    test.cmd

     

    @echo off
    "C:\Program Files\Debugging Tools for Windows (x64)\symstore.exe" add /r /f ".\x64\*.*" /s d:\Symbols /t "zzz"
    xperf -on PROC_THREAD+LOADER+PROFILE+SYSCALL+MEMINFO -stackwalk profile+SyscallEnter+ImageLoad -setprofint 1221 -BufferSize 1024 -MinBuffers 128 -MaxBuffers 480
    .\x64\RlLoader.exe 
    xperf -d plog1.etl
    xperf -setprofint
    start xperfview plog1.etl
    goto :eof
    

     

    RlLoader.exe

     

    int _tmain(int argc, _TCHAR* argv[])
    {
    	UNREFERENCED_PARAMETER(argc);
    	UNREFERENCED_PARAMETER(argv);
    
    	HMODULE hLib = LoadLibrary(L"RlTestDll1.dll");
    	if (hLib)
    	{
    		pFuncType pFunc = reinterpret_cast<pFuncType>(GetProcAddress(hLib,"DoTest1"));
    		if (pFunc)
    		{
    			(*pFunc)();
    		}
    		FreeLibrary(hLib);
    		hLib = NULL;
    	}
    	return 0;
    }
    
    

     

    RlTestDll1.dll

     

    BOOL WINAPI DoTest1()
    {
    	Sleep(100);
    	return TRUE;
    }
    
    

     

     


    Wednesday, April 6, 2011 8:47 AM