From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/dbghelp_private.h | 10 ++++---- dlls/dbghelp/module.c | 2 +- dlls/dbghelp/msc.c | 44 +++++++++++++++------------------- dlls/dbghelp/path.c | 8 +++---- dlls/dbghelp/pdb.c | 3 +-- dlls/dbghelp/pe_module.c | 27 ++++++++++----------- 6 files changed, 42 insertions(+), 52 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 55001902b47..11094cca122 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -827,8 +827,7 @@ extern BOOL module_is_wine_host(const WCHAR* module_name, const WCHAR* e extern BOOL module_refresh_list(struct process *pcs);
/* msc.c */ -extern BOOL pe_load_debug_directory(const struct process* pcs, - struct module* module, +extern BOOL pe_load_debug_directory(struct module* module, const BYTE* mapping, const IMAGE_SECTION_HEADER* sectp, DWORD nsect, const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg); @@ -839,7 +838,7 @@ extern DWORD dbg_get_file_indexinfo(void* image, DWORD size, SYMSRV_INDEX extern BOOL old_pdb_virtual_unwind(struct cpu_stack_walk *csw, DWORD_PTR ip, union ctx *context);
/* path.c */ -extern BOOL path_find_symbol_file(const struct process *pcs, const struct module *module, +extern BOOL path_find_symbol_file(const struct module *module, const WCHAR *full_path, BOOL is_pdb, const GUID* guid, DWORD dw1, DWORD dw2, SYMSRV_INDEX_INFOW *info, BOOL *unmatched); extern WCHAR *get_dos_file_name(const WCHAR *filename) __WINE_DEALLOC(HeapFree, 3) __WINE_MALLOC; @@ -850,7 +849,7 @@ extern const WCHAR* file_name(const WCHAR* str); extern const char* file_nameA(const char* str);
/* pdb.c */ -extern BOOL pdb_init_modfmt(const struct process *pcs, const struct msc_debug_info *msc_dbg, +extern BOOL pdb_init_modfmt(const struct msc_debug_info *msc_dbg, const WCHAR *filename, BOOL *has_linenumber_info); extern BOOL pdb_virtual_unwind(struct cpu_stack_walk *csw, DWORD_PTR ip, union ctx *context); struct _PDB_FPO_DATA; @@ -865,8 +864,7 @@ extern struct module* extern struct module* pe_load_builtin_module(struct process* pcs, const WCHAR* name, DWORD64 base, DWORD64 size); -extern BOOL pe_load_debug_info(const struct process* pcs, - struct module* module); +extern BOOL pe_load_debug_info(struct module* module); extern const char* pe_map_directory(struct module* module, int dirno, DWORD* size); extern BOOL pe_unmap_directory(struct module* module, int dirno, const char*); extern DWORD pe_get_file_indexinfo(void* image, DWORD size, SYMSRV_INDEX_INFOW* info); diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 90641bcc0ca..43b174fe35d 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -339,7 +339,7 @@ BOOL module_load_debug(struct module* module) idslW64.hFile = INVALID_HANDLE_VALUE;
pcs_callback(module->process, CBA_DEFERRED_SYMBOL_LOAD_START, &idslW64); - ret = pe_load_debug_info(module->process, module); + ret = pe_load_debug_info(module); pcs_callback(module->process, ret ? CBA_DEFERRED_SYMBOL_LOAD_COMPLETE : CBA_DEFERRED_SYMBOL_LOAD_FAILURE, &idslW64); diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 8aafd7c6b40..b55ce1ea6e9 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3604,8 +3604,7 @@ static BOOL pdb_init(struct pdb_file_info* pdb_file, const char* image) return pdb_file->stream_dict != NULL; }
-static BOOL pdb_process_internal(const struct process *pcs, - const struct msc_debug_info *msc_dbg, +static BOOL pdb_process_internal(const struct msc_debug_info *msc_dbg, const WCHAR *filename, struct old_pdb_module_info *pdb_module_info, unsigned module_index, @@ -3720,8 +3719,7 @@ DWORD pdb_get_file_indexinfo(void* image, DWORD size, SYMSRV_INDEX_INFOW* info) return ERROR_BAD_FORMAT; }
-static void pdb_process_symbol_imports(const struct process *pcs, - const struct msc_debug_info *msc_dbg, +static void pdb_process_symbol_imports(const struct msc_debug_info *msc_dbg, const PDB_SYMBOLS *symbols, const void *symbols_image, const char *image, @@ -3752,9 +3750,9 @@ static void pdb_process_symbol_imports(const struct process *pcs, TRACE("got for %s: age=%u ts=%x\n", debugstr_a(imp->filename), imp->Age, imp->TimeDateStamp); MultiByteToWideChar(CP_ACP, 0, imp->filename, -1, buffer, ARRAY_SIZE(buffer)); - if (path_find_symbol_file(pcs, msc_dbg->module, buffer, TRUE, NULL, imp->TimeDateStamp, imp->Age, &info, + if (path_find_symbol_file(msc_dbg->module, buffer, TRUE, NULL, imp->TimeDateStamp, imp->Age, &info, &msc_dbg->module->module.PdbUnmatched)) - pdb_process_internal(pcs, msc_dbg, info.pdbfile, pdb_module_info, i, &line_info); + pdb_process_internal(msc_dbg, info.pdbfile, pdb_module_info, i, &line_info); i++; imp = (const PDB_SYMBOL_IMPORT*)((const char*)first + ((ptr - (const char*)first + strlen(ptr) + 1 + 3) & ~3)); } @@ -3770,8 +3768,7 @@ static void pdb_process_symbol_imports(const struct process *pcs, cv_current_module->allowed = TRUE; }
-static BOOL pdb_process_internal(const struct process *pcs, - const struct msc_debug_info *msc_dbg, +static BOOL pdb_process_internal(const struct msc_debug_info *msc_dbg, const WCHAR *filename, struct old_pdb_module_info *pdb_module_info, unsigned module_index, @@ -3846,7 +3843,7 @@ static BOOL pdb_process_internal(const struct process *pcs,
files_image = pdb_read_strings(pdb_file);
- pdb_process_symbol_imports(pcs, msc_dbg, &symbols, symbols_image, image, + pdb_process_symbol_imports(msc_dbg, &symbols, symbols_image, image, pdb_module_info, module_index); pdb_process_types(msc_dbg, pdb_file);
@@ -3944,7 +3941,7 @@ static BOOL pdb_process_internal(const struct process *pcs, pdb_free(ipi_image); } else - pdb_process_symbol_imports(pcs, msc_dbg, NULL, NULL, image, + pdb_process_symbol_imports(msc_dbg, NULL, NULL, image, pdb_module_info, module_index);
pdb_free(symbols_image); @@ -3967,8 +3964,7 @@ static const struct module_format_vtable old_pdb_module_format_vtable = pdb_location_compute, };
-static BOOL old_pdb_process_file(const struct process *pcs, - const struct msc_debug_info *msc_dbg, +static BOOL old_pdb_process_file(const struct msc_debug_info *msc_dbg, const WCHAR *filename, BOOL *has_linenumber_info) { struct module_format* modfmt; @@ -3987,7 +3983,7 @@ static BOOL old_pdb_process_file(const struct process *pcs,
memset(cv_zmodules, 0, sizeof(cv_zmodules)); codeview_init_basic_types(msc_dbg->module); - ret = pdb_process_internal(pcs, msc_dbg, filename, + ret = pdb_process_internal(msc_dbg, filename, msc_dbg->module->format_info[DFI_OLD_PDB]->u.old_pdb_info, -1, has_linenumber_info); codeview_clear_type_table(); if (!ret) @@ -3998,20 +3994,19 @@ static BOOL old_pdb_process_file(const struct process *pcs, return ret; }
-static BOOL pdb_process_file(const struct process *pcs, - const struct msc_debug_info *msc_dbg, +static BOOL pdb_process_file(const struct msc_debug_info *msc_dbg, const WCHAR *filename, const GUID *guid, DWORD timestamp, DWORD age) { SYMSRV_INDEX_INFOW info; BOOL unmatched, has_linenumber_info, ret;
if (!msc_dbg->module->dont_load_symbols && - path_find_symbol_file(pcs, msc_dbg->module, filename, TRUE, guid, timestamp, age, &info, &unmatched)) + path_find_symbol_file(msc_dbg->module, filename, TRUE, guid, timestamp, age, &info, &unmatched)) { if (getenv("WINE_DBGHELP_OLD_PDB")) /* keep using old pdb reader */ - ret = old_pdb_process_file(pcs, msc_dbg, info.pdbfile, &has_linenumber_info); + ret = old_pdb_process_file(msc_dbg, info.pdbfile, &has_linenumber_info); else - ret = pdb_init_modfmt(pcs, msc_dbg, info.pdbfile, &has_linenumber_info); + ret = pdb_init_modfmt(msc_dbg, info.pdbfile, &has_linenumber_info);
if (ret) { @@ -4052,8 +4047,7 @@ static BOOL pdb_process_file(const struct process *pcs, #define CODEVIEW_NB11_SIG MAKESIG('N','B','1','1') #define CODEVIEW_RSDS_SIG MAKESIG('R','S','D','S')
-static BOOL codeview_process_info(const struct process *pcs, - const struct msc_debug_info *msc_dbg) +static BOOL codeview_process_info(const struct msc_debug_info *msc_dbg) { const DWORD* signature = (const DWORD*)msc_dbg->root; BOOL ret = FALSE; @@ -4152,7 +4146,7 @@ static BOOL codeview_process_info(const struct process *pcs, WCHAR buffer[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, pdb->name, -1, buffer, ARRAY_SIZE(buffer)); - ret = pdb_process_file(pcs, msc_dbg, buffer, NULL, pdb->timestamp, pdb->age); + ret = pdb_process_file(msc_dbg, buffer, NULL, pdb->timestamp, pdb->age); break; } case CODEVIEW_RSDS_SIG: @@ -4169,7 +4163,7 @@ static BOOL codeview_process_info(const struct process *pcs, WCHAR buffer[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, rsds->name, -1, buffer, ARRAY_SIZE(buffer)); - ret = pdb_process_file(pcs, msc_dbg, buffer, &rsds->guid, 0, rsds->age); + ret = pdb_process_file(msc_dbg, buffer, &rsds->guid, 0, rsds->age); } else ret = TRUE; @@ -4193,7 +4187,7 @@ static BOOL codeview_process_info(const struct process *pcs, /*======================================================================== * Process debug directory. */ -BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, +BOOL pe_load_debug_directory(struct module* module, const BYTE* mapping, const IMAGE_SECTION_HEADER* sectp, DWORD nsect, const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg) @@ -4229,7 +4223,7 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module, if (dbg[i].Type == IMAGE_DEBUG_TYPE_CODEVIEW) { msc_dbg.root = mapping + dbg[i].PointerToRawData; - if ((ret = codeview_process_info(pcs, &msc_dbg))) goto done; + if ((ret = codeview_process_info(&msc_dbg))) goto done; } }
@@ -4293,7 +4287,7 @@ typedef struct _FPO_DATA if (ext) wcscpy(ext + 1, L"pdb"); else wcscat(buffer, L".pdb"); options = SymGetOptions(); SymSetOptions(options | SYMOPT_LOAD_ANYTHING); - ret = pdb_process_file(pcs, &msc_dbg, buffer, &null_guid, 0, 0); + ret = pdb_process_file(&msc_dbg, buffer, &null_guid, 0, 0); SymSetOptions(options); if (!ret && module->dont_load_symbols) module->module.TimeDateStamp = 0; diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index 3ce68d3431a..3148c7494d6 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -506,18 +506,18 @@ static BOOL CALLBACK module_find_cb(PCWSTR buffer, PVOID user) return mf->matched == 4; }
-BOOL path_find_symbol_file(const struct process* pcs, const struct module* module, +BOOL path_find_symbol_file(const struct module* module, const WCHAR *full_path, BOOL is_pdb, const GUID* guid, DWORD dw1, DWORD dw2, SYMSRV_INDEX_INFOW *info, BOOL* is_unmatched) { struct module_find mf; WCHAR *ptr, *ext; const WCHAR* filename; - WCHAR *searchPath = pcs->search_path; + WCHAR *searchPath = module->process->search_path; WCHAR buffer[MAX_PATH];
- TRACE("(pcs = %p, full_path = %s, guid = %s, dw1 = 0x%08lx, dw2 = 0x%08lx)\n", - pcs, debugstr_w(full_path), debugstr_guid(guid), dw1, dw2); + TRACE("(module = %p, full_path = %s, guid = %s, dw1 = 0x%08lx, dw2 = 0x%08lx)\n", + module, debugstr_w(full_path), debugstr_guid(guid), dw1, dw2);
mf.info = info; mf.guid = guid; diff --git a/dlls/dbghelp/pdb.c b/dlls/dbghelp/pdb.c index c4f4319de43..2ff1ca119cb 100644 --- a/dlls/dbghelp/pdb.c +++ b/dlls/dbghelp/pdb.c @@ -4844,8 +4844,7 @@ static struct module_format_vtable pdb_module_format_vtable = pdb_method_enumerate_sources, };
-BOOL pdb_init_modfmt(const struct process *pcs, - const struct msc_debug_info *msc_dbg, +BOOL pdb_init_modfmt(const struct msc_debug_info *msc_dbg, const WCHAR *filename, BOOL *has_linenumber_info) { struct module_format *modfmt; diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index f86fb7c00e8..5229ff6ba75 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -527,10 +527,10 @@ static BOOL pe_load_coff_symbol_table(struct module* module) /****************************************************************** * pe_load_stabs * - * look for stabs information in PE header (it's how the mingw compiler provides + * look for stabs information in PE header (it's how the mingw compiler provides * its debugging information) */ -static BOOL pe_load_stabs(const struct process* pcs, struct module* module) +static BOOL pe_load_stabs(struct module* module) { struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap; struct image_section_map sect_stabs, sect_stabstr; @@ -585,8 +585,7 @@ static BOOL pe_load_dwarf(struct module* module) * * loads a .dbg file */ -static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module, - const WCHAR* dbg_name, DWORD timestamp) +static BOOL pe_load_dbg_file(struct module* module, const WCHAR* dbg_name, DWORD timestamp) { HANDLE hFile = INVALID_HANDLE_VALUE, hMap = 0; const BYTE* dbg_mapping = NULL; @@ -595,7 +594,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
TRACE("Processing DBG file %s\n", debugstr_w(dbg_name));
- if (path_find_symbol_file(pcs, module, dbg_name, FALSE, NULL, timestamp, 0, &info, &module->module.DbgUnmatched) && + if (path_find_symbol_file(module, dbg_name, FALSE, NULL, timestamp, 0, &info, &module->module.DbgUnmatched) && (hFile = CreateFileW(info.dbgfile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE && ((hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != 0) && @@ -614,7 +613,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module, hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) + hdr->ExportedNamesSize);
- ret = pe_load_debug_directory(pcs, module, dbg_mapping, sectp, + ret = pe_load_debug_directory(module, dbg_mapping, sectp, hdr->NumberOfSections, dbg, hdr->DebugDirectorySize / sizeof(*dbg)); } @@ -632,7 +631,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module, * * Process MSC debug information in PE file. */ -static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* module) +static BOOL pe_load_msc_debug_info(struct module* module) { struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap; BOOL ret = FALSE; @@ -659,7 +658,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod WCHAR buffer[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, (const char*)misc->Data, -1, buffer, ARRAY_SIZE(buffer)); - ret = pe_load_dbg_file(pcs, module, buffer, nth->FileHeader.TimeDateStamp); + ret = pe_load_dbg_file(module, buffer, nth->FileHeader.TimeDateStamp); } else misc = NULL; @@ -671,7 +670,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod else { /* Debug info is embedded into PE module */ - ret = pe_load_debug_directory(pcs, module, mapping, IMAGE_FIRST_SECTION( nth ), + ret = pe_load_debug_directory(module, mapping, IMAGE_FIRST_SECTION( nth ), nth->FileHeader.NumberOfSections, dbg, nDbg); } pe_unmap_full(fmap); @@ -681,7 +680,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod /*********************************************************************** * pe_load_export_debug_info */ -static BOOL pe_load_export_debug_info(const struct process* pcs, struct module* module) +static BOOL pe_load_export_debug_info(struct module* module) { struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap; unsigned int i; @@ -764,7 +763,7 @@ static BOOL pe_load_export_debug_info(const struct process* pcs, struct module* * pe_load_debug_info * */ -BOOL pe_load_debug_info(const struct process* pcs, struct module* module) +BOOL pe_load_debug_info(struct module* module) { BOOL ret = FALSE;
@@ -773,10 +772,10 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module) if (!module->dont_load_symbols) { 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(module) || ret; ret = pe_load_dwarf(module) || ret; } - ret = pe_load_msc_debug_info(pcs, module) || ret; + ret = pe_load_msc_debug_info(module) || ret; ret = ret || pe_load_coff_symbol_table(module); /* FIXME */ /* if we still have no debug info (we could only get SymExport at this * point), then do the SymExport except if we have an ELF container, @@ -789,7 +788,7 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module) */ if (module->module.SymType == SymDeferred) { - ret = pe_load_export_debug_info(pcs, module) || ret; + ret = pe_load_export_debug_info(module) || ret; if (module->module.SymType == SymDeferred) module->module.SymType = SymNone; }