none
SymFindFileInPath doesn't work with compressed pdb files RRS feed

  • Question

  • I can't get SymFindFileInPath to work with compressed pdb files. I add the file to my symbol server using symstore.exe with the /compress flag. This adds the file with the .pd_ extension to signify that it is compressed. This is the message I get from SymSrv:

    “SYMSRV: UNC: d:\SymbolServer\MemPro_Test.pdb\AF2B5AF7FF014075BAAF5488BB8479572\MemPro_Test.pdb – file not found”

    If I don't compress the file it works fine.

    If I rename the file extension from ".pd_" to ".pdb" then it does find it, but obviously this isn't a valid solution. Is this a known bug with SymFindFileInPath?

    I'm using Visual Studio 2010 with symstore.exe from "Debugging Tools for Windows 10".


    Friday, April 13, 2018 6:15 PM

Answers

  • #include <Windows.h>
    #include <Dbghelp.h>
    
    #define GUIDSTRING "{4EE505B3-EDCD-4479-A558-70B1997C82A6}"
    
    int main() {
    	SymSetOptions(SYMOPT_DEBUG | SYMOPT_FAIL_CRITICAL_ERRORS |
    		SYMOPT_IGNORE_CVREC | SYMOPT_EXACT_SYMBOLS | SYMOPT_IGNORE_NT_SYMPATH);
    	HANDLE hProcess = GetCurrentProcess();
    	SymInitialize(hProcess, NULL, FALSE);
    	SymSetSearchPath(hProcess, "srv*c:\\tools*c:\\temp");
    	const char* fileName = "ntkrnlmp.pdb";
    	GUID guid;
    	CLSIDFromString(TEXT(GUIDSTRING), (LPCLSID)&guid);
    	DWORD age = 1;
    	DWORD three = 0;
    	DWORD flags = SSRVOPT_GUIDPTR;
    	char filePath[MAX_PATH + 1] = {};
    	SymFindFileInPath(hProcess, NULL, fileName, (void*)&guid, age, three,
    		flags, filePath, NULL, NULL);
    	return 0;
    }

    Looks up compressed

    C:\TEMP\ntkrnlmp.pdb\4EE505B3EDCD4479A55870B1997C82A61\ntkrnlmp.pd_
    copies and decompress to
    C:\Tools\ntkrnlmp.pdb\4EE505B3EDCD4479A55870B1997C82A61\ntkrnlmp.pdb
    provided dbghelp.dll and symsrv.dll is accessible:

    With kind regards


    • Edited by MaybeCompletelyW Saturday, April 14, 2018 9:47 PM retrieves substituted with Looks up
    • Marked as answer by PureDev Software Sunday, April 15, 2018 1:38 PM
    Saturday, April 14, 2018 9:37 PM

All replies

  • Does it help calling SymSetOptions with symbol option

    SYMOPT_FAVOR_COMPRESSED
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms681366(v=vs.85).aspx

    With kind regards

    Friday, April 13, 2018 10:44 PM
  • Thank for your reply. No, that doesn't help.
    Saturday, April 14, 2018 9:25 AM
  • When I take a quick look into 'symchk' (10.0.16299.15) - using manifest file , there is one call to SymFindFileInPath looking for "*.pdb" :
    With local Symbol-Path:
    srv*c:\tools*c:\temp
    Arguments SymFindFileInPath:
    0:000> dd esp
    024defd4  000e91cf ffffffff 00000000 024dfa98
    024defe4  024dfaa5 00000000 00000000 00400000
    024deff4  024df990 00000000 00000000 024dfe4c
    024df004  04ba32c0 00000000 00201680 04ba32c0
    024df014  74502660 024dfac7 024dfe40 ffffffff
    024df024  024df038 00000000 00000000 774b5b73
    024df034  00000005 00000040 00000000 00000000
    024df044  00000000 00000000 00000000 00000000
    0:000> da 024dfa98
    024dfa98  "ntkrnlmp.pdb"
    0:000> da 024dfaa5
    024dfaa5  "4EE505B3EDCD4479A55870B1997C82A6"
    024dfac5  "1"
    0:000> da 024df990
    024df990  "."

    After leaving function('Step out'), a manually compressed *.pd_ has been found, copied and uncompressed to destination dir, though SYMSRV claimed 'file not found':

    With kind regards
    Saturday, April 14, 2018 3:27 PM
  • Thanks, that's interesting. I guess it must be a bug in SymSrv then.

    Unfortunately I need to use a run-time function rather than a command line tool. 


    Saturday, April 14, 2018 3:37 PM
  • #include <Windows.h>
    #include <Dbghelp.h>
    
    #define GUIDSTRING "{4EE505B3-EDCD-4479-A558-70B1997C82A6}"
    
    int main() {
    	SymSetOptions(SYMOPT_DEBUG | SYMOPT_FAIL_CRITICAL_ERRORS |
    		SYMOPT_IGNORE_CVREC | SYMOPT_EXACT_SYMBOLS | SYMOPT_IGNORE_NT_SYMPATH);
    	HANDLE hProcess = GetCurrentProcess();
    	SymInitialize(hProcess, NULL, FALSE);
    	SymSetSearchPath(hProcess, "srv*c:\\tools*c:\\temp");
    	const char* fileName = "ntkrnlmp.pdb";
    	GUID guid;
    	CLSIDFromString(TEXT(GUIDSTRING), (LPCLSID)&guid);
    	DWORD age = 1;
    	DWORD three = 0;
    	DWORD flags = SSRVOPT_GUIDPTR;
    	char filePath[MAX_PATH + 1] = {};
    	SymFindFileInPath(hProcess, NULL, fileName, (void*)&guid, age, three,
    		flags, filePath, NULL, NULL);
    	return 0;
    }

    Looks up compressed

    C:\TEMP\ntkrnlmp.pdb\4EE505B3EDCD4479A55870B1997C82A61\ntkrnlmp.pd_
    copies and decompress to
    C:\Tools\ntkrnlmp.pdb\4EE505B3EDCD4479A55870B1997C82A61\ntkrnlmp.pdb
    provided dbghelp.dll and symsrv.dll is accessible:

    With kind regards


    • Edited by MaybeCompletelyW Saturday, April 14, 2018 9:47 PM retrieves substituted with Looks up
    • Marked as answer by PureDev Software Sunday, April 15, 2018 1:38 PM
    Saturday, April 14, 2018 9:37 PM
  • Thank you very much, that solved my problem. The key was using the SymSetSearchPath function rather than just passing the path in to the second argument of SymFindFileInPath. For compressed files it seems that the search path needs a temporary folder to decompress to, for example:

    SymSetSearchPath(g_FakeProcess, "srv*d:\\temp\\DecompressedSymbols*d:\\MySymbolServer");

    Thanks again,

    Stewart.



    Sunday, April 15, 2018 1:38 PM