[Bug 37746] Wine builtin dbghelp fails to process stream name table of PDBs created with recent Visual Studio 2010-2013 (mfc120.pdb)

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Jan 3 06:39:46 CST 2015


https://bugs.winehq.org/show_bug.cgi?id=37746

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |focht at gmx.net
          Component|winedbg                     |dbghelp
            Version|unspecified                 |1.7.33
            Summary|Unable to load mfc120.pdb   |Wine builtin dbghelp fails
                   |                            |to process stream name
                   |                            |table of PDBs created with
                   |                            |recent Visual Studio
                   |                            |2010-2013 (mfc120.pdb)
     Ever confirmed|0                           |1

--- Comment #2 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming.

Next time provide a small MFC example app linked to VC++ 2013 runtime that
causes a crash otherwise it's hard to reproduce.

I used this app which makes use of VC++ 2013 runtime/MFC:
http://www.aio-sim.com/downloads-page-2/

--- snip ---
...
0023:trace:dbghelp_msc:codeview_process_info Processing signature RSDS
0023:trace:dbghelp_msc:codeview_process_info Got RSDS type of PDB file:
guid={e791f372-5b2b-40a0-99c5-a90ba5da57a5} age=00000017 name=mfc120u.i386.pdb
0023:trace:dbghelp_msc:pdb_process_internal Processing PDB file
mfc120u.i386.pdb
0023:trace:dbghelp:path_find_symbol_file (pcs = 0x113708, full_path =
"mfc120u.i386.pdb", guid = {e791f372-5b2b-40a0-99c5-a90ba5da57a5}, dw1 =
0x00000000, dw2 = 0x00000017, buffer = 0x33a2d8)
0023:trace:dbghelp_msc:pdb_init PDB(mfc120u.i386.pdb): "Microsoft C/C++ MSF
7.00\r\n\x1aDS\x00\
0023:warn:dbghelp_msc:pdb_init Found mfc120u.i386.pdb, but wrong age: 00000019
00000017
0023:trace:dbghelp_msc:pdb_init found DS for mfc120u.i386.pdb: age=19
guid={e791f372-5b2b-40a0-99c5-a90ba5da57a5}
0023:fixme:dbghelp_msc:pdb_load_stream_name_table unexpected value
--- snip ---

Debugging 'winedbg' with 'winedbg' yields:

--- snip ---
Wine-dbg>bt

Backtrace:
=>0 0x7ece87a1 pdb_load_stream_name_table+0xdd(pdb_file=0x3399dc, str="/names",
cb=0x39) [/home/focht/projects/wine/wine.repo/src/dlls/dbghelp/msc.c:2267] in
dbghelp (0x003398f8)
  1 0x7ece9847 pdb_init+0x741(pdb_lookup=0x339a68, pdb_file=0x3399dc,
image="Microsoft C/C++ MSF 7.00
DS", matched=0x339b8c)
[/home/focht/projects/wine/wine.repo/src/dlls/dbghelp/msc.c:2585] in dbghelp
(0x003399a8)
...

Wine-dbg>n

2264        pdw += *ok_bits++ + 1;

Wine-dbg>info locals

0x7ece877e pdb_load_stream_name_table+0xba: (003398f8)
    struct pdb_file_info* pdb_file=0x3399dc (parameter [EBP+8])
    char* str="/names" (parameter [EBP+12])
    unsigned int cb=0x39 (parameter [EBP+16])
    DWORD* pdw=0xf4b619 (local [EBP-12])
    DWORD* ok_bits=0xf4b619 (local [EBP-36])
    DWORD count=0xa (local [EBP-28])
    DWORD numok=0x4 (local [EBP-24])
    unsigned int i=0x23 (local [EBP-16])
    unsigned int j=0x7ece86c9 (local [EBP-20])
    char* cpstr="/names" (local [EBP-32])

Wine-dbg>x/30x str 

0x00f4b5d8:  6d616e2f 2f007365 632f6566 72746e6f
0x00f4b5e8:  702f6269 2f006863 6b6e694c 6f666e49
0x00f4b5f8:  72732f00 65682f63 72656461 636f6c62
0x00f4b608:  7273006b 76727363 00000400 00000a00
0x00f4b618:  00000100 00022600 00000100 00001000
0x00f4b628:  00002100 00020a00 00001700 00000900
0x00f4b638:  00000000 00000500 00000700 00000600
0x00f4b648:  00000000 32914100

Wine-dbg>x/10x ok_bits

0x00f4b619:  00000001 00000226 00000001 00000010
0x00f4b629:  00000021 0000020a 00000017 00000009
0x00f4b639:  00000000 00000005
--- snip ---

Source:
http://source.winehq.org/git/wine.git/blob/b2f967e0865f231991a8c83693bbc81ef5afba74:/dlls/dbghelp/msc.c#l2245

--- snip ---
2245 static void pdb_load_stream_name_table(struct pdb_file_info* pdb_file,
const char* str, unsigned cb)
2246 {
2247     DWORD* pdw;
2248     DWORD* ok_bits;
2249     DWORD count, numok;
2250     unsigned i, j;
2251     char* cpstr;
2252
2253     pdw = (DWORD*)(str + cb);
2254     numok = *pdw++;
2255     count = *pdw++;
2256
2257     pdb_file->stream_dict = HeapAlloc(GetProcessHeap(), 0, (numok + 1) *
sizeof(struct pdb_stream_name) + cb);
2258     if (!pdb_file->stream_dict) return;
2259     cpstr = (char*)(pdb_file->stream_dict + numok + 1);
2260     memcpy(cpstr, str, cb);
2261
2262     /* bitfield: first dword is len (in dword), then data */
2263     ok_bits = pdw;
2264     pdw += *ok_bits++ + 1;
2265     if (*pdw++ != 0)
2266     {
2267         FIXME("unexpected value\n");
2268         return;
2269     }
...
--- snip ---

PDB formats created by newer Visual Studio versions are not documented and
subject to changes at any time by Microsoft.
For my experience, tools which parse/dump raw PDB information don't work with
newer PDB formats.

Even specialized (commercial) debugging tools, such as IDA (PDB plugin) make
use of MS DIA (Debug Interface Access SDK) to access PDB structures without
knowing the raw data formats/internals because of this.

http://msdn.microsoft.com/en-us/library/x93ctkx8.aspx

---

You might want to try native 'dbghelp' with MS Symbol Server properly
configured.

Anyway, debugging Windows apps with 'winedbg' is something I wouldn't recommend
to inexperienced developers unless they need to debug Wine bugs or winelib
apps.

If the focus is on the application side it's definitely not suited for the task
and wastes more time than using Wine's builtin trace capability properly in
conjunction with 3rd party user mode debuggers.

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list