dbghelp: Module info.
- now internally storing module info as a 64bit module structure (the interest in not in the 64 bit side of things, but because it allows storing lots of usefull information) - fixed SymGetModuleInfo64W which wasn't returning the LoadedPdbName field - now filling for MSC files with the extended information (instead of guessing it) - reused the extended module info to store wine ELF module information (link for map link, stabs vs dwarf symbol info)
This commit is contained in:
parent
40b411824e
commit
e4441d7e6f
|
@ -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;
|
DWORD base = msc_dbg->sectp[coff_sym->SectionNumber - 1].VirtualAddress;
|
||||||
nampnt = coff_get_name(coff_sym, coff_strtab);
|
nampnt = coff_get_name(coff_sym, coff_strtab);
|
||||||
|
|
||||||
TRACE("%d: %lx %s\n",
|
TRACE("%d: %s %s\n",
|
||||||
i, msc_dbg->module->module.BaseOfImage + base + coff_sym->Value,
|
i, wine_dbgstr_longlong(msc_dbg->module->module.BaseOfImage + base + coff_sym->Value),
|
||||||
nampnt);
|
nampnt);
|
||||||
TRACE("\tAdding global symbol %s (sect=%s)\n",
|
TRACE("\tAdding global symbol %s (sect=%s)\n",
|
||||||
nampnt, msc_dbg->sectp[coff_sym->SectionNumber - 1].Name);
|
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);
|
nampnt = coff_get_name(coff_sym, coff_strtab);
|
||||||
|
|
||||||
TRACE("%d: %lx %s\n",
|
TRACE("%d: %s %s\n",
|
||||||
i, msc_dbg->module->module.BaseOfImage + base + coff_sym->Value,
|
i, wine_dbgstr_longlong(msc_dbg->module->module.BaseOfImage + base + coff_sym->Value),
|
||||||
nampnt);
|
nampnt);
|
||||||
TRACE("\tAdding global data symbol %s\n", 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);
|
HeapFree(GetProcessHeap(), 0, coff_files.files);
|
||||||
msc_dbg->module->module.SymType = SymCoff;
|
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;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ enum module_type
|
||||||
|
|
||||||
struct module
|
struct module
|
||||||
{
|
{
|
||||||
IMAGEHLP_MODULE module;
|
IMAGEHLP_MODULE64 module;
|
||||||
struct module* next;
|
struct module* next;
|
||||||
enum module_type type : 16;
|
enum module_type type : 16;
|
||||||
unsigned short is_virtual : 1;
|
unsigned short is_virtual : 1;
|
||||||
|
|
|
@ -1679,5 +1679,12 @@ BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
|
||||||
comp_unit_cursor += comp_unit.length + sizeof(unsigned);
|
comp_unit_cursor += comp_unit.length + sizeof(unsigned);
|
||||||
}
|
}
|
||||||
module->module.SymType = SymDia;
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -929,7 +929,9 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
|
||||||
fmap_link.with_crc = 1;
|
fmap_link.with_crc = 1;
|
||||||
lret = elf_load_debug_info_from_map(module, &fmap_link, pool,
|
lret = elf_load_debug_info_from_map(module, &fmap_link, pool,
|
||||||
ht_symtab);
|
ht_symtab);
|
||||||
if (!lret)
|
if (lret)
|
||||||
|
strcpy(module->module.LoadedPdbName, dbg_link);
|
||||||
|
else
|
||||||
WARN("Couldn't load debug information from %s\n", dbg_link);
|
WARN("Couldn't load debug information from %s\n", dbg_link);
|
||||||
ret = ret || lret;
|
ret = ret || lret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,20 @@ struct module* module_new(struct process* pcs, const char* name,
|
||||||
module->module.TimeDateStamp = stamp;
|
module->module.TimeDateStamp = stamp;
|
||||||
module->module.CheckSum = checksum;
|
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->type = type;
|
||||||
module->is_virtual = virtual ? TRUE : FALSE;
|
module->is_virtual = virtual ? TRUE : FALSE;
|
||||||
module->sortlist_valid = 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 process* pcs = process_find_by_handle(hProcess);
|
||||||
struct module* module;
|
struct module* module;
|
||||||
|
IMAGEHLP_MODULE mod;
|
||||||
|
|
||||||
if (!pcs) return FALSE;
|
if (!pcs) return FALSE;
|
||||||
if (ModuleInfo->SizeOfStruct < sizeof(*ModuleInfo)) return FALSE;
|
if (ModuleInfo->SizeOfStruct < sizeof(*ModuleInfo)) return FALSE;
|
||||||
module = module_find_by_addr(pcs, dwAddr, DMT_UNKNOWN);
|
module = module_find_by_addr(pcs, dwAddr, DMT_UNKNOWN);
|
||||||
if (!module) return FALSE;
|
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)
|
if (module->module.SymType == SymNone)
|
||||||
{
|
{
|
||||||
module = module_get_container(pcs, module);
|
module = module_get_container(pcs, module);
|
||||||
if (module && module->module.SymType != SymNone)
|
if (module && module->module.SymType != SymNone)
|
||||||
{
|
{
|
||||||
ModuleInfo->SymType = module->module.SymType;
|
mod.SymType = module->module.SymType;
|
||||||
ModuleInfo->NumSyms = module->module.NumSyms;
|
mod.NumSyms = module->module.NumSyms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
memcpy(ModuleInfo, &mod, ModuleInfo->SizeOfStruct);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,8 +727,6 @@ BOOL WINAPI SymGetModuleInfo64(HANDLE hProcess, DWORD64 dwAddr,
|
||||||
{
|
{
|
||||||
struct process* pcs = process_find_by_handle(hProcess);
|
struct process* pcs = process_find_by_handle(hProcess);
|
||||||
struct module* module;
|
struct module* module;
|
||||||
IMAGEHLP_MODULE64 mod;
|
|
||||||
char* ptr;
|
|
||||||
|
|
||||||
TRACE("%p %s %p\n", hProcess, wine_dbgstr_longlong(dwAddr), ModuleInfo);
|
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);
|
module = module_find_by_addr(pcs, dwAddr, DMT_UNKNOWN);
|
||||||
if (!module) return FALSE;
|
if (!module) return FALSE;
|
||||||
|
|
||||||
mod.SizeOfStruct = ModuleInfo->SizeOfStruct;
|
memcpy(ModuleInfo, &module->module, 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;
|
|
||||||
|
|
||||||
if (module->module.SymType == SymNone)
|
if (module->module.SymType == SymNone)
|
||||||
{
|
{
|
||||||
module = module_get_container(pcs, module);
|
module = module_get_container(pcs, module);
|
||||||
if (module && module->module.SymType != SymNone)
|
if (module && module->module.SymType != SymNone)
|
||||||
{
|
{
|
||||||
mod.SymType = module->module.SymType;
|
ModuleInfo->SymType = module->module.SymType;
|
||||||
mod.NumSyms = module->module.NumSyms;
|
ModuleInfo->NumSyms = module->module.NumSyms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy(ModuleInfo, &mod, mod.SizeOfStruct);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,6 +777,8 @@ BOOL WINAPI SymGetModuleInfoW64(HANDLE hProcess, DWORD64 dwAddr,
|
||||||
miw.ImageName, sizeof(miw.ImageName) / sizeof(WCHAR));
|
miw.ImageName, sizeof(miw.ImageName) / sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, mi.LoadedImageName, -1,
|
MultiByteToWideChar(CP_ACP, 0, mi.LoadedImageName, -1,
|
||||||
miw.LoadedImageName, sizeof(miw.LoadedImageName) / sizeof(WCHAR));
|
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;
|
miw.CVSig = mi.CVSig;
|
||||||
MultiByteToWideChar(CP_ACP, 0, mi.CVData, -1,
|
MultiByteToWideChar(CP_ACP, 0, mi.CVData, -1,
|
||||||
|
|
|
@ -2189,7 +2189,6 @@ static BOOL pdb_process_internal(const struct process* pcs,
|
||||||
else
|
else
|
||||||
pdb_process_symbol_imports(pcs, msc_dbg, NULL, NULL, image, pdb_lookup,
|
pdb_process_symbol_imports(pcs, msc_dbg, NULL, NULL, image, pdb_lookup,
|
||||||
module_index);
|
module_index);
|
||||||
msc_dbg->module->module.SymType = SymCv;
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
|
@ -2214,6 +2213,22 @@ static BOOL pdb_process_file(const struct process* pcs,
|
||||||
codeview_init_basic_types(msc_dbg->module);
|
codeview_init_basic_types(msc_dbg->module);
|
||||||
ret = pdb_process_internal(pcs, msc_dbg, pdb_lookup, -1);
|
ret = pdb_process_internal(pcs, msc_dbg, pdb_lookup, -1);
|
||||||
codeview_clear_type_table();
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2336,6 +2351,12 @@ static BOOL codeview_process_info(const struct process* pcs,
|
||||||
}
|
}
|
||||||
|
|
||||||
msc_dbg->module->module.SymType = SymCv;
|
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();
|
codeview_clear_type_table();
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -2362,6 +2383,7 @@ static BOOL codeview_process_info(const struct process* pcs,
|
||||||
pdb_lookup.kind = PDB_DS;
|
pdb_lookup.kind = PDB_DS;
|
||||||
pdb_lookup.u.ds.guid = rsds->guid;
|
pdb_lookup.u.ds.guid = rsds->guid;
|
||||||
pdb_lookup.u.ds.toc = NULL;
|
pdb_lookup.u.ds.toc = NULL;
|
||||||
|
pdb_lookup.age = rsds->unknown;
|
||||||
ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup);
|
ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2370,7 +2392,12 @@ static BOOL codeview_process_info(const struct process* pcs,
|
||||||
cv->dwSignature, msc_dbg->module->module.ModuleName);
|
cv->dwSignature, msc_dbg->module->module.ModuleName);
|
||||||
break;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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));
|
stab_ptr->n_type, stab_ptr->n_value, debugstr_a(strs + stab_ptr->n_un.n_strx));
|
||||||
}
|
}
|
||||||
module->module.SymType = SymDia;
|
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:
|
done:
|
||||||
HeapFree(GetProcessHeap(), 0, stabbuff);
|
HeapFree(GetProcessHeap(), 0, stabbuff);
|
||||||
stabs_free_includes();
|
stabs_free_includes();
|
||||||
|
|
Loading…
Reference in New Issue