mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-01 22:22:38 +00:00
dbghelp: Support SLMFLAG_NO_SYMBOLS in SymLoadModuleEx*().
Also correctly handling ImageName (the passed image name in SymLoadModule) and LoadedImageName, which is only set when debug info have been loaded (and is always an absolute path, contrary to ImageName which can be relative). Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
51a0aaeff4
commit
61f9f5a05f
|
@ -442,6 +442,7 @@ struct module
|
||||||
struct module* next;
|
struct module* next;
|
||||||
enum dhext_module_type type : 16;
|
enum dhext_module_type type : 16;
|
||||||
unsigned short is_virtual : 1,
|
unsigned short is_virtual : 1,
|
||||||
|
dont_load_symbols : 1,
|
||||||
is_wine_builtin : 1,
|
is_wine_builtin : 1,
|
||||||
has_file_image : 1;
|
has_file_image : 1;
|
||||||
struct cpu* cpu;
|
struct cpu* cpu;
|
||||||
|
|
|
@ -377,7 +377,11 @@ BOOL module_load_debug(struct module* module)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if (module->is_virtual) ret = FALSE;
|
if (module->is_virtual)
|
||||||
|
{
|
||||||
|
module->module.SymType = SymVirtual;
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
else if (module->type == DMT_PE)
|
else if (module->type == DMT_PE)
|
||||||
{
|
{
|
||||||
idslW64.SizeOfStruct = sizeof(idslW64);
|
idslW64.SizeOfStruct = sizeof(idslW64);
|
||||||
|
@ -942,7 +946,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
|
||||||
|
|
||||||
if (!(pcs = process_find_by_handle(hProcess))) return 0;
|
if (!(pcs = process_find_by_handle(hProcess))) return 0;
|
||||||
|
|
||||||
if (Flags & ~(SLMFLAG_VIRTUAL))
|
if (Flags & ~(SLMFLAG_VIRTUAL | SLMFLAG_NO_SYMBOLS))
|
||||||
FIXME("Unsupported Flags %08lx for %s\n", Flags, debugstr_w(wImageName));
|
FIXME("Unsupported Flags %08lx for %s\n", Flags, debugstr_w(wImageName));
|
||||||
|
|
||||||
/* Trying to load a new module at the same address of an existing one,
|
/* Trying to load a new module at the same address of an existing one,
|
||||||
|
@ -970,7 +974,6 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
|
||||||
if (!wImageName) wImageName = L"";
|
if (!wImageName) wImageName = L"";
|
||||||
module = module_new(pcs, wImageName, DMT_PE, FALSE, TRUE, BaseOfDll, SizeOfDll, 0, 0, IMAGE_FILE_MACHINE_UNKNOWN);
|
module = module_new(pcs, wImageName, DMT_PE, FALSE, TRUE, BaseOfDll, SizeOfDll, 0, 0, IMAGE_FILE_MACHINE_UNKNOWN);
|
||||||
if (!module) return 0;
|
if (!module) return 0;
|
||||||
module->module.SymType = SymVirtual;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -996,6 +999,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Flags & SLMFLAG_NO_SYMBOLS) module->dont_load_symbols = 1;
|
||||||
|
|
||||||
/* Store alternate name for module when provided. */
|
/* Store alternate name for module when provided. */
|
||||||
if (wModuleName)
|
if (wModuleName)
|
||||||
|
@ -1531,6 +1535,11 @@ BOOL WINAPI SymGetModuleInfoW64(HANDLE hProcess, DWORD64 dwAddr,
|
||||||
|
|
||||||
if (dbghelp_opt_real_path && module->real_path)
|
if (dbghelp_opt_real_path && module->real_path)
|
||||||
lstrcpynW(miw64.LoadedImageName, module->real_path, ARRAY_SIZE(miw64.LoadedImageName));
|
lstrcpynW(miw64.LoadedImageName, module->real_path, ARRAY_SIZE(miw64.LoadedImageName));
|
||||||
|
else if (miw64.SymType == SymDeferred)
|
||||||
|
{
|
||||||
|
miw64.LoadedImageName[0] = '\0';
|
||||||
|
miw64.TimeDateStamp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* update debug information from container if any */
|
/* update debug information from container if any */
|
||||||
if (module->module.SymType == SymNone)
|
if (module->module.SymType == SymNone)
|
||||||
|
|
|
@ -3889,16 +3889,18 @@ static BOOL pdb_process_file(const struct process *pcs,
|
||||||
const struct msc_debug_info *msc_dbg,
|
const struct msc_debug_info *msc_dbg,
|
||||||
const char *filename, const GUID *guid, DWORD timestamp, DWORD age)
|
const char *filename, const GUID *guid, DWORD timestamp, DWORD age)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
|
||||||
struct module_format* modfmt;
|
struct module_format* modfmt;
|
||||||
struct pdb_module_info* pdb_module_info;
|
struct pdb_module_info* pdb_module_info;
|
||||||
SYMSRV_INDEX_INFOW info;
|
SYMSRV_INDEX_INFOW info;
|
||||||
BOOL unmatched;
|
BOOL unmatched;
|
||||||
|
|
||||||
if (path_find_symbol_file(pcs, msc_dbg->module, filename, TRUE, guid, timestamp, age, &info, &unmatched) &&
|
if (!msc_dbg->module->dont_load_symbols &&
|
||||||
|
path_find_symbol_file(pcs, msc_dbg->module, filename, TRUE, guid, timestamp, age, &info, &unmatched) &&
|
||||||
(modfmt = HeapAlloc(GetProcessHeap(), 0,
|
(modfmt = HeapAlloc(GetProcessHeap(), 0,
|
||||||
sizeof(struct module_format) + sizeof(struct pdb_module_info))))
|
sizeof(struct module_format) + sizeof(struct pdb_module_info))))
|
||||||
{
|
{
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
pdb_module_info = (void*)(modfmt + 1);
|
pdb_module_info = (void*)(modfmt + 1);
|
||||||
msc_dbg->module->format_info[DFI_PDB] = modfmt;
|
msc_dbg->module->format_info[DFI_PDB] = modfmt;
|
||||||
modfmt->module = msc_dbg->module;
|
modfmt->module = msc_dbg->module;
|
||||||
|
@ -3926,6 +3928,7 @@ static BOOL pdb_process_file(const struct process *pcs,
|
||||||
msc_dbg->module->module.TypeInfo = TRUE;
|
msc_dbg->module->module.TypeInfo = TRUE;
|
||||||
msc_dbg->module->module.SourceIndexed = TRUE;
|
msc_dbg->module->module.SourceIndexed = TRUE;
|
||||||
msc_dbg->module->module.Publics = TRUE;
|
msc_dbg->module->module.Publics = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
msc_dbg->module->format_info[DFI_PDB] = NULL;
|
msc_dbg->module->format_info[DFI_PDB] = NULL;
|
||||||
|
@ -3936,7 +3939,7 @@ static BOOL pdb_process_file(const struct process *pcs,
|
||||||
msc_dbg->module->module.PdbSig70 = *guid;
|
msc_dbg->module->module.PdbSig70 = *guid;
|
||||||
else
|
else
|
||||||
memset(&msc_dbg->module->module.PdbSig70, 0, sizeof(GUID));
|
memset(&msc_dbg->module->module.PdbSig70, 0, sizeof(GUID));
|
||||||
msc_dbg->module->module.PdbSig = timestamp;
|
msc_dbg->module->module.PdbSig = 0;
|
||||||
msc_dbg->module->module.PdbAge = age;
|
msc_dbg->module->module.PdbAge = age;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,6 +498,7 @@ static BOOL CALLBACK module_find_cb(PCWSTR buffer, PVOID user)
|
||||||
mf->info->guid = info.guid;
|
mf->info->guid = info.guid;
|
||||||
mf->info->timestamp = info.timestamp;
|
mf->info->timestamp = info.timestamp;
|
||||||
mf->info->age = info.age;
|
mf->info->age = info.age;
|
||||||
|
mf->info->sig = info.sig;
|
||||||
}
|
}
|
||||||
/* yes, EnumDirTree/do_search and SymFindFileInPath callbacks use the opposite
|
/* yes, EnumDirTree/do_search and SymFindFileInPath callbacks use the opposite
|
||||||
* convention to stop/continue enumeration. sigh.
|
* convention to stop/continue enumeration. sigh.
|
||||||
|
|
|
@ -720,10 +720,13 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module)
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY))
|
if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY))
|
||||||
|
{
|
||||||
|
if (!module->dont_load_symbols)
|
||||||
{
|
{
|
||||||
ret = image_check_alternate(&module->format_info[DFI_PE]->u.pe_info->fmap, module);
|
ret = image_check_alternate(&module->format_info[DFI_PE]->u.pe_info->fmap, module);
|
||||||
ret = pe_load_stabs(pcs, module) || ret;
|
ret = pe_load_stabs(pcs, module) || ret;
|
||||||
ret = pe_load_dwarf(module) || ret;
|
ret = pe_load_dwarf(module) || ret;
|
||||||
|
}
|
||||||
ret = pe_load_msc_debug_info(pcs, module) || ret;
|
ret = pe_load_msc_debug_info(pcs, module) || ret;
|
||||||
ret = ret || pe_load_coff_symbol_table(module); /* FIXME */
|
ret = ret || pe_load_coff_symbol_table(module); /* FIXME */
|
||||||
/* if we still have no debug info (we could only get SymExport at this
|
/* if we still have no debug info (we could only get SymExport at this
|
||||||
|
|
|
@ -1803,10 +1803,9 @@ static void test_load_modules_details(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
loaded_img_name = test->in_image_name;
|
loaded_img_name = test->in_image_name;
|
||||||
todo_wine_if(i == 3 || i == 5 || i == 7 || i == 9 || i == 11 || i == 13 || i == 15 || i == 17)
|
|
||||||
ok(!wcsicmp(im.LoadedImageName, (test->options & SYMOPT_DEFERRED_LOADS) ? L"" : loaded_img_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);
|
"Unexpected loaded image name '%ls' (%ls)\n", im.LoadedImageName, loaded_img_name);
|
||||||
todo_wine_if(i == 3 || i == 4 || i == 6 || i == 8 || i == 16)
|
todo_wine_if(i == 4 || i == 6 || i == 16)
|
||||||
ok(im.SymType == test->sym_type, "Unexpected module type %u\n", im.SymType);
|
ok(im.SymType == test->sym_type, "Unexpected module type %u\n", im.SymType);
|
||||||
if (test->mismatch_in)
|
if (test->mismatch_in)
|
||||||
{
|
{
|
||||||
|
@ -1842,7 +1841,6 @@ static void test_load_modules_details(void)
|
||||||
{
|
{
|
||||||
ok(val < ARRAY_SIZE(test_files), "Incorrect index\n");
|
ok(val < ARRAY_SIZE(test_files), "Incorrect index\n");
|
||||||
if (test->flags & SLMFLAG_NO_SYMBOLS)
|
if (test->flags & SLMFLAG_NO_SYMBOLS)
|
||||||
todo_wine_if(i == 8)
|
|
||||||
ok(!im.LoadedPdbName[0], "Unexpected value\n");
|
ok(!im.LoadedPdbName[0], "Unexpected value\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1853,7 +1851,6 @@ static void test_load_modules_details(void)
|
||||||
ok(!im.DbgUnmatched, "Unexpected value\n");
|
ok(!im.DbgUnmatched, "Unexpected value\n");
|
||||||
ok(IsEqualGUID(&im.PdbSig70, test_files[val].guid), "Unexpected value %s %s\n",
|
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));
|
wine_dbgstr_guid(&im.PdbSig70), wine_dbgstr_guid(test_files[val].guid));
|
||||||
todo_wine_if(i == 10)
|
|
||||||
ok(im.PdbSig == 0, "Unexpected value\n");
|
ok(im.PdbSig == 0, "Unexpected value\n");
|
||||||
ok(im.PdbAge == test_files[val].age_or_timestamp, "Unexpected value\n");
|
ok(im.PdbAge == test_files[val].age_or_timestamp, "Unexpected value\n");
|
||||||
}
|
}
|
||||||
|
@ -1868,7 +1865,7 @@ static void test_load_modules_details(void)
|
||||||
ok(im.PdbSig == 0, "Unexpected value\n");
|
ok(im.PdbSig == 0, "Unexpected value\n");
|
||||||
ok(!im.PdbAge, "Unexpected value\n");
|
ok(!im.PdbAge, "Unexpected value\n");
|
||||||
/* native returns either 0 or the actual timestamp depending on test case */
|
/* native returns either 0 or the actual timestamp depending on test case */
|
||||||
todo_wine_if(i == 4 || i == 5 || i == 7 || i == 9 || i == 11 || i == 13 || (i >= 15 && i <= 17))
|
todo_wine_if(i == 4 || i == 16)
|
||||||
ok(!im.TimeDateStamp || broken(im.TimeDateStamp == 12324), "Unexpected value\n");
|
ok(!im.TimeDateStamp || broken(im.TimeDateStamp == 12324), "Unexpected value\n");
|
||||||
}
|
}
|
||||||
ok(im.ImageSize == 0x6666, "Unexpected image size\n");
|
ok(im.ImageSize == 0x6666, "Unexpected image size\n");
|
||||||
|
@ -1887,7 +1884,7 @@ static void test_load_modules_details(void)
|
||||||
SymFromNameW(dummy, L"foo", sym);
|
SymFromNameW(dummy, L"foo", sym);
|
||||||
}
|
}
|
||||||
ret = SymAddSymbol(dummy, base, "winetest_symbol_virtual", base + 4242, 13, 0);
|
ret = SymAddSymbol(dummy, base, "winetest_symbol_virtual", base + 4242, 13, 0);
|
||||||
todo_wine_if(i >= 12 && i <= 15) { /* temp */
|
todo_wine_if(i == 8 || i == 9 || (i >= 12 && i <= 15)) { /* temp */
|
||||||
ok(ret, "Failed to add symbol\n");
|
ok(ret, "Failed to add symbol\n");
|
||||||
memset(sym, 0, sizeof(*sym));
|
memset(sym, 0, sizeof(*sym));
|
||||||
sym->SizeOfStruct = sizeof(*sym);
|
sym->SizeOfStruct = sizeof(*sym);
|
||||||
|
|
Loading…
Reference in a new issue