1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

dbghelp: Fixed module information when unmatched pdb file is loaded.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2024-02-25 12:12:41 +01:00 committed by Alexandre Julliard
parent 6ab88cafaa
commit d094bde414
3 changed files with 23 additions and 8 deletions

View file

@ -49,6 +49,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_msc);
static const GUID null_guid;
struct pdb_stream_name
{
const char* name;
@ -4467,6 +4469,26 @@ typedef struct _FPO_DATA
ret = FALSE;
}
__ENDTRY
/* we haven't found yet any debug information, fallback to unmatched pdb */
if (module->module.SymType == SymDeferred)
{
SYMSRV_INDEX_INFOW info = {.sizeofstruct = sizeof(info)};
char buffer[MAX_PATH];
char *ext;
DWORD options;
WideCharToMultiByte(CP_ACP, 0, module->module.LoadedImageName, -1, buffer, ARRAY_SIZE(buffer), 0, NULL);
ext = strrchr(buffer, '.');
if (ext) strcpy(ext + 1, "pdb"); else strcat(buffer, ".pdb");
options = SymGetOptions();
SymSetOptions(options | SYMOPT_LOAD_ANYTHING);
ret = pdb_process_file(pcs, &msc_dbg, buffer, &null_guid, 0, 0);
SymSetOptions(options);
if (!ret && module->dont_load_symbols)
module->module.TimeDateStamp = 0;
}
return ret;
}

View file

@ -598,7 +598,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod
if (!(mapping = pe_map_full(fmap, &nth))) return FALSE;
/* Read in debug directory */
dbg = RtlImageDirectoryEntryToData( mapping, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &nDbg );
if (!dbg || !(nDbg /= sizeof(IMAGE_DEBUG_DIRECTORY))) goto done;
nDbg = dbg ? nDbg / sizeof(IMAGE_DEBUG_DIRECTORY) : 0;
/* Parse debug directory */
if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED)
@ -624,7 +624,6 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod
ret = pe_load_debug_directory(pcs, module, mapping, IMAGE_FIRST_SECTION( nth ),
nth->FileHeader.NumberOfSections, dbg, nDbg);
}
done:
pe_unmap_full(fmap);
return ret;
}

View file

@ -1805,7 +1805,6 @@ static void test_load_modules_details(void)
loaded_img_name = test->in_image_name;
ok(!wcsicmp(im.LoadedImageName, (test->options & SYMOPT_DEFERRED_LOADS) ? L"" : loaded_img_name),
"Unexpected loaded image name '%ls' (%ls)\n", im.LoadedImageName, loaded_img_name);
todo_wine_if(i == 4 || i == 6 || i == 16)
ok(im.SymType == test->sym_type, "Unexpected module type %u\n", im.SymType);
if (test->mismatch_in)
{
@ -1814,16 +1813,12 @@ static void test_load_modules_details(void)
{
ok(val < ARRAY_SIZE(test_files), "Incorrect index\n");
make_path(filename, topdir, NULL, L"bar.pdb");
todo_wine
ok(!wcscmp(filename, im.LoadedPdbName), "Unexpected value '%ls\n", im.LoadedPdbName);
todo_wine
ok(im.PdbUnmatched, "Unexpected value\n");
ok(!im.DbgUnmatched, "Unexpected value\n");
todo_wine
ok(IsEqualGUID(&im.PdbSig70, test_files[val].guid), "Unexpected value %s %s\n",
wine_dbgstr_guid(&im.PdbSig70), wine_dbgstr_guid(test_files[val].guid));
ok(im.PdbSig == 0, "Unexpected value\n");
todo_wine
ok(im.PdbAge == test_files[val].age_or_timestamp, "Unexpected value\n");
}
else if (has_mismatch(test->mismatch_in, 'P', &val))
@ -1865,7 +1860,6 @@ static void test_load_modules_details(void)
ok(im.PdbSig == 0, "Unexpected value\n");
ok(!im.PdbAge, "Unexpected value\n");
/* native returns either 0 or the actual timestamp depending on test case */
todo_wine_if(i == 4 || i == 16)
ok(!im.TimeDateStamp || broken(im.TimeDateStamp == 12324), "Unexpected value\n");
}
ok(im.ImageSize == 0x6666, "Unexpected image size\n");