diff --git a/dlls/dbghelp/coff.c b/dlls/dbghelp/coff.c index e0ff3550d9b..a344ac984b6 100644 --- a/dlls/dbghelp/coff.c +++ b/dlls/dbghelp/coff.c @@ -298,8 +298,8 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg) DWORD base = msc_dbg->sectp[coff_sym->SectionNumber - 1].VirtualAddress; nampnt = coff_get_name(coff_sym, coff_strtab); - TRACE("%d: %lx %s\n", - i, msc_dbg->module->module.BaseOfImage + base + coff_sym->Value, + TRACE("%d: %s %s\n", + i, wine_dbgstr_longlong(msc_dbg->module->module.BaseOfImage + base + coff_sym->Value), nampnt); TRACE("\tAdding global symbol %s (sect=%s)\n", nampnt, msc_dbg->sectp[coff_sym->SectionNumber - 1].Name); @@ -343,8 +343,8 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg) */ nampnt = coff_get_name(coff_sym, coff_strtab); - TRACE("%d: %lx %s\n", - i, msc_dbg->module->module.BaseOfImage + base + coff_sym->Value, + TRACE("%d: %s %s\n", + i, wine_dbgstr_longlong(msc_dbg->module->module.BaseOfImage + base + coff_sym->Value), nampnt); TRACE("\tAdding global data symbol %s\n", nampnt); @@ -442,6 +442,12 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg) } HeapFree(GetProcessHeap(), 0, coff_files.files); msc_dbg->module->module.SymType = SymCoff; + /* FIXME: we could have a finer grain here */ + msc_dbg->module->module.LineNumbers = TRUE; + msc_dbg->module->module.GlobalSymbols = TRUE; + msc_dbg->module->module.TypeInfo = FALSE; + msc_dbg->module->module.SourceIndexed = TRUE; + msc_dbg->module->module.Publics = TRUE; ret = TRUE; } diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 50a38a4a5f3..72930bafb3a 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -274,7 +274,7 @@ enum module_type struct module { - IMAGEHLP_MODULE module; + IMAGEHLP_MODULE64 module; struct module* next; enum module_type type : 16; unsigned short is_virtual : 1; diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index ec3a5e6dcfb..01250a5f864 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1679,5 +1679,12 @@ BOOL dwarf2_parse(struct module* module, unsigned long load_offset, comp_unit_cursor += comp_unit.length + sizeof(unsigned); } module->module.SymType = SymDia; + module->module.CVSig = 'D' | ('W' << 8) | ('A' << 16) | ('R' << 24); + /* FIXME: we could have a finer grain here */ + module->module.LineNumbers = TRUE; + module->module.GlobalSymbols = TRUE; + module->module.TypeInfo = TRUE; + module->module.SourceIndexed = TRUE; + module->module.Publics = TRUE; return TRUE; } diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index 495dcbaf6e2..4e86ec2f56b 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -929,7 +929,9 @@ static BOOL elf_load_debug_info_from_map(struct module* module, fmap_link.with_crc = 1; lret = elf_load_debug_info_from_map(module, &fmap_link, pool, ht_symtab); - if (!lret) + if (lret) + strcpy(module->module.LoadedPdbName, dbg_link); + else WARN("Couldn't load debug information from %s\n", dbg_link); ret = ret || lret; } diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index c8bd0ce0878..c1c5dedef24 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -125,6 +125,20 @@ struct module* module_new(struct process* pcs, const char* name, module->module.TimeDateStamp = stamp; module->module.CheckSum = checksum; + memset(module->module.LoadedPdbName, 0, sizeof(module->module.CVData)); + module->module.CVSig = 0; + memset(module->module.CVData, 0, sizeof(module->module.CVData)); + module->module.PdbSig = 0; + memset(&module->module.PdbSig70, 0, sizeof(module->module.PdbSig70)); + module->module.PdbAge = 0; + module->module.PdbUnmatched = FALSE; + module->module.DbgUnmatched = FALSE; + module->module.LineNumbers = FALSE; + module->module.GlobalSymbols = FALSE; + module->module.TypeInfo = FALSE; + module->module.SourceIndexed = 0; + module->module.Publics = 0; + module->type = type; module->is_virtual = virtual ? TRUE : FALSE; module->sortlist_valid = FALSE; @@ -640,23 +654,34 @@ BOOL WINAPI SymGetModuleInfo(HANDLE hProcess, DWORD dwAddr, { struct process* pcs = process_find_by_handle(hProcess); struct module* module; + IMAGEHLP_MODULE mod; if (!pcs) return FALSE; if (ModuleInfo->SizeOfStruct < sizeof(*ModuleInfo)) return FALSE; module = module_find_by_addr(pcs, dwAddr, DMT_UNKNOWN); if (!module) return FALSE; - *ModuleInfo = module->module; + mod.SizeOfStruct = ModuleInfo->SizeOfStruct; + mod.BaseOfImage = module->module.BaseOfImage; + mod.ImageSize = module->module.ImageSize; + mod.TimeDateStamp = module->module.TimeDateStamp; + mod.CheckSum = module->module.CheckSum; + mod.NumSyms = module->module.NumSyms; + mod.SymType = module->module.SymType; + strcpy(mod.ModuleName, module->module.ModuleName); + strcpy(mod.ImageName, module->module.ImageName); + strcpy(mod.LoadedImageName, module->module.LoadedImageName); + if (module->module.SymType == SymNone) { module = module_get_container(pcs, module); if (module && module->module.SymType != SymNone) { - ModuleInfo->SymType = module->module.SymType; - ModuleInfo->NumSyms = module->module.NumSyms; + mod.SymType = module->module.SymType; + mod.NumSyms = module->module.NumSyms; } } - + memcpy(ModuleInfo, &mod, ModuleInfo->SizeOfStruct); return TRUE; } @@ -702,8 +727,6 @@ BOOL WINAPI SymGetModuleInfo64(HANDLE hProcess, DWORD64 dwAddr, { struct process* pcs = process_find_by_handle(hProcess); struct module* module; - IMAGEHLP_MODULE64 mod; - char* ptr; TRACE("%p %s %p\n", hProcess, wine_dbgstr_longlong(dwAddr), ModuleInfo); @@ -712,44 +735,17 @@ BOOL WINAPI SymGetModuleInfo64(HANDLE hProcess, DWORD64 dwAddr, module = module_find_by_addr(pcs, dwAddr, DMT_UNKNOWN); if (!module) return FALSE; - mod.SizeOfStruct = ModuleInfo->SizeOfStruct; - mod.BaseOfImage = module->module.BaseOfImage; - mod.ImageSize = module->module.ImageSize; - mod.TimeDateStamp = module->module.TimeDateStamp; - mod.CheckSum = module->module.CheckSum; - mod.NumSyms = module->module.NumSyms; - mod.SymType = module->module.SymType; - strcpy(mod.ModuleName, module->module.ModuleName); - strcpy(mod.ImageName, module->module.ImageName); - strcpy(mod.LoadedImageName, module->module.LoadedImageName); - /* FIXME: for now, using some 'rather sane' value */ - sprintf(mod.LoadedPdbName, ".\%s.pdb", module->module.ModuleName); - mod.CVSig = 0x53445352; /* RSDS */ - memset(mod.CVData, 0, sizeof(mod.CVData)); - strcpy(mod.CVData, module->module.LoadedImageName); - if ((ptr = strrchr(mod.CVData, '.'))) - strcpy(ptr + 1, "pdb"); - mod.PdbSig = 0; - memset(&mod.PdbSig70, 0, sizeof(mod.PdbSig70)); - mod.PdbAge = 0; - mod.PdbUnmatched = FALSE; - mod.DbgUnmatched = FALSE; - mod.LineNumbers = TRUE; - mod.GlobalSymbols = TRUE; - mod.TypeInfo = TRUE; - mod.SourceIndexed = 0; - mod.Publics = 0; + memcpy(ModuleInfo, &module->module, ModuleInfo->SizeOfStruct); if (module->module.SymType == SymNone) { module = module_get_container(pcs, module); if (module && module->module.SymType != SymNone) { - mod.SymType = module->module.SymType; - mod.NumSyms = module->module.NumSyms; + ModuleInfo->SymType = module->module.SymType; + ModuleInfo->NumSyms = module->module.NumSyms; } } - memcpy(ModuleInfo, &mod, mod.SizeOfStruct); return TRUE; } @@ -781,6 +777,8 @@ BOOL WINAPI SymGetModuleInfoW64(HANDLE hProcess, DWORD64 dwAddr, miw.ImageName, sizeof(miw.ImageName) / sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, mi.LoadedImageName, -1, miw.LoadedImageName, sizeof(miw.LoadedImageName) / sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, mi.LoadedPdbName, -1, + miw.LoadedPdbName, sizeof(miw.LoadedPdbName) / sizeof(WCHAR)); miw.CVSig = mi.CVSig; MultiByteToWideChar(CP_ACP, 0, mi.CVData, -1, diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 2bde2bfca09..748f46bc433 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2189,7 +2189,6 @@ static BOOL pdb_process_internal(const struct process* pcs, else pdb_process_symbol_imports(pcs, msc_dbg, NULL, NULL, image, pdb_lookup, module_index); - msc_dbg->module->module.SymType = SymCv; ret = TRUE; leave: @@ -2214,6 +2213,22 @@ static BOOL pdb_process_file(const struct process* pcs, codeview_init_basic_types(msc_dbg->module); ret = pdb_process_internal(pcs, msc_dbg, pdb_lookup, -1); codeview_clear_type_table(); + if (ret) + { + msc_dbg->module->module.SymType = SymCv; + if (pdb_lookup->kind == PDB_JG) + msc_dbg->module->module.PdbSig = pdb_lookup->u.jg.timestamp; + else + msc_dbg->module->module.PdbSig70 = pdb_lookup->u.ds.guid; + msc_dbg->module->module.PdbAge = pdb_lookup->age; + strcpy(msc_dbg->module->module.LoadedPdbName, pdb_lookup->filename); + /* FIXME: we could have a finer grain here */ + msc_dbg->module->module.LineNumbers = TRUE; + msc_dbg->module->module.GlobalSymbols = TRUE; + msc_dbg->module->module.TypeInfo = TRUE; + msc_dbg->module->module.SourceIndexed = TRUE; + msc_dbg->module->module.Publics = TRUE; + } return ret; } @@ -2336,6 +2351,12 @@ static BOOL codeview_process_info(const struct process* pcs, } msc_dbg->module->module.SymType = SymCv; + /* FIXME: we could have a finer grain here */ + msc_dbg->module->module.LineNumbers = TRUE; + msc_dbg->module->module.GlobalSymbols = TRUE; + msc_dbg->module->module.TypeInfo = TRUE; + msc_dbg->module->module.SourceIndexed = TRUE; + msc_dbg->module->module.Publics = TRUE; codeview_clear_type_table(); ret = TRUE; break; @@ -2362,6 +2383,7 @@ static BOOL codeview_process_info(const struct process* pcs, pdb_lookup.kind = PDB_DS; pdb_lookup.u.ds.guid = rsds->guid; pdb_lookup.u.ds.toc = NULL; + pdb_lookup.age = rsds->unknown; ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup); break; } @@ -2370,7 +2392,12 @@ static BOOL codeview_process_info(const struct process* pcs, cv->dwSignature, msc_dbg->module->module.ModuleName); break; } - + if (ret) + { + msc_dbg->module->module.CVSig = cv->dwSignature; + memcpy(msc_dbg->module->module.CVData, cv, + sizeof(msc_dbg->module->module.CVData)); + } return ret; } diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index bf5922a4042..e75b1500809 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -1534,6 +1534,13 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset, stab_ptr->n_type, stab_ptr->n_value, debugstr_a(strs + stab_ptr->n_un.n_strx)); } module->module.SymType = SymDia; + module->module.CVSig = 'S' | ('T' << 8) | ('A' << 16) | ('B' << 24); + /* FIXME: we could have a finer grain here */ + module->module.LineNumbers = TRUE; + module->module.GlobalSymbols = TRUE; + module->module.TypeInfo = TRUE; + module->module.SourceIndexed = TRUE; + module->module.Publics = TRUE; done: HeapFree(GetProcessHeap(), 0, stabbuff); stabs_free_includes();