dbghelp: Introduce internal type (symt_module) to match SymTagExe.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-08-30 09:24:29 +02:00 committed by Alexandre Julliard
parent 3ed209e0d9
commit 1fa1620086
4 changed files with 34 additions and 0 deletions

View File

@ -161,6 +161,12 @@ struct symt_block
struct vector vchildren; /* sub-blocks & local variables */ struct vector vchildren; /* sub-blocks & local variables */
}; };
struct symt_module /* in fact any of .exe, .dll... */
{
struct symt symt; /* module */
struct module* module;
};
struct symt_compiland struct symt_compiland
{ {
struct symt symt; struct symt symt;
@ -375,6 +381,7 @@ struct module
unsigned sorttab_size; unsigned sorttab_size;
struct symt_ht** addr_sorttab; struct symt_ht** addr_sorttab;
struct hash_table ht_symbols; struct hash_table ht_symbols;
struct symt_module* top;
/* types */ /* types */
struct hash_table ht_types; struct hash_table ht_types;
@ -708,6 +715,8 @@ extern void copy_symbolW(SYMBOL_INFOW* siw, const SYMBOL_INFO* si) DECLS
extern void symbol_setname(SYMBOL_INFO* si, const char* name) DECLSPEC_HIDDEN; extern void symbol_setname(SYMBOL_INFO* si, const char* name) DECLSPEC_HIDDEN;
extern struct symt_ht* extern struct symt_ht*
symt_find_nearest(struct module* module, DWORD_PTR addr) DECLSPEC_HIDDEN; symt_find_nearest(struct module* module, DWORD_PTR addr) DECLSPEC_HIDDEN;
extern struct symt_module*
symt_new_module(struct module* module) DECLSPEC_HIDDEN;
extern struct symt_compiland* extern struct symt_compiland*
symt_new_compiland(struct module* module, ULONG_PTR address, symt_new_compiland(struct module* module, ULONG_PTR address,
unsigned src_idx) DECLSPEC_HIDDEN; unsigned src_idx) DECLSPEC_HIDDEN;

View File

@ -233,6 +233,9 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
module->sources = 0; module->sources = 0;
wine_rb_init(&module->sources_offsets_tree, source_rb_compare); wine_rb_init(&module->sources_offsets_tree, source_rb_compare);
/* add top level symbol */
module->top = symt_new_module(module);
return module; return module;
} }

View File

@ -183,6 +183,19 @@ static WCHAR* file_regex(const char* srcfile)
return mask; return mask;
} }
struct symt_module* symt_new_module(struct module* module)
{
struct symt_module* sym;
TRACE_(dbghelp_symt)("Adding toplevel exe symbol %s\n", debugstr_w(module->module.ModuleName));
if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
{
sym->symt.tag = SymTagExe;
sym->module = module;
}
return sym;
}
struct symt_compiland* symt_new_compiland(struct module* module, struct symt_compiland* symt_new_compiland(struct module* module,
ULONG_PTR address, unsigned src_idx) ULONG_PTR address, unsigned src_idx)
{ {

View File

@ -752,6 +752,15 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
break; break;
case TI_GET_SYMNAME: case TI_GET_SYMNAME:
if (type->tag == SymTagExe)
{
DWORD len = (lstrlenW(module->modulename) + 1) * sizeof(WCHAR);
WCHAR* wname = HeapAlloc(GetProcessHeap(), 0, len);
if (!wname) return FALSE;
memcpy(wname, module->modulename, len);
X(WCHAR*) = wname;
}
else
{ {
const char* name = symt_get_name(type); const char* name = symt_get_name(type);
if (!name) return FALSE; if (!name) return FALSE;