dbghelp: Move the mach-o information into the modfmt structure.
This commit is contained in:
parent
fe2ae803ee
commit
cecb80a4e8
|
@ -322,6 +322,7 @@ enum format_info
|
||||||
{
|
{
|
||||||
DFI_ELF,
|
DFI_ELF,
|
||||||
DFI_PE,
|
DFI_PE,
|
||||||
|
DFI_MACHO,
|
||||||
DFI_DWARF,
|
DFI_DWARF,
|
||||||
DFI_LAST
|
DFI_LAST
|
||||||
};
|
};
|
||||||
|
@ -339,6 +340,7 @@ struct module_format
|
||||||
struct elf_module_info* elf_info;
|
struct elf_module_info* elf_info;
|
||||||
struct dwarf2_module_info_s* dwarf2_info;
|
struct dwarf2_module_info_s* dwarf2_info;
|
||||||
struct pe_module_info* pe_info;
|
struct pe_module_info* pe_info;
|
||||||
|
struct macho_module_info* macho_info;
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -354,8 +356,6 @@ struct module
|
||||||
/* specific information for debug types */
|
/* specific information for debug types */
|
||||||
struct module_format* format_info[DFI_LAST];
|
struct module_format* format_info[DFI_LAST];
|
||||||
|
|
||||||
struct macho_module_info* macho_info;
|
|
||||||
|
|
||||||
/* memory allocation pool */
|
/* memory allocation pool */
|
||||||
struct pool pool;
|
struct pool pool;
|
||||||
|
|
||||||
|
|
|
@ -655,7 +655,8 @@ static int macho_parse_symtab(struct macho_file_map* fmap,
|
||||||
sc->stroff, sc->strsize, (const void**)&stab, (const void**)&stabstr))
|
sc->stroff, sc->strsize, (const void**)&stab, (const void**)&stabstr))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!stabs_parse(mdi->module, mdi->module->macho_info->load_addr - fmap->segs_start,
|
if (!stabs_parse(mdi->module,
|
||||||
|
mdi->module->format_info[DFI_MACHO]->u.macho_info->load_addr - fmap->segs_start,
|
||||||
stab, sc->nsyms * sizeof(struct nlist),
|
stab, sc->nsyms * sizeof(struct nlist),
|
||||||
stabstr, sc->strsize, macho_stabs_def_cb, mdi))
|
stabstr, sc->strsize, macho_stabs_def_cb, mdi))
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
@ -703,7 +704,7 @@ static void macho_finish_stabs(struct module* module, struct hash_table* ht_symt
|
||||||
{
|
{
|
||||||
case SymTagFunction:
|
case SymTagFunction:
|
||||||
func = (struct symt_function*)sym;
|
func = (struct symt_function*)sym;
|
||||||
if (func->address == module->macho_info->load_addr)
|
if (func->address == module->format_info[DFI_MACHO]->u.macho_info->load_addr)
|
||||||
{
|
{
|
||||||
TRACE("Adjusting function %p/%s!%s from 0x%08lx to 0x%08lx\n", func,
|
TRACE("Adjusting function %p/%s!%s from 0x%08lx to 0x%08lx\n", func,
|
||||||
debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
||||||
|
@ -720,7 +721,7 @@ static void macho_finish_stabs(struct module* module, struct hash_table* ht_symt
|
||||||
{
|
{
|
||||||
case DataIsGlobal:
|
case DataIsGlobal:
|
||||||
case DataIsFileStatic:
|
case DataIsFileStatic:
|
||||||
if (data->u.var.offset == module->macho_info->load_addr)
|
if (data->u.var.offset == module->format_info[DFI_MACHO]->u.macho_info->load_addr)
|
||||||
{
|
{
|
||||||
TRACE("Adjusting data symbol %p/%s!%s from 0x%08lx to 0x%08lx\n",
|
TRACE("Adjusting data symbol %p/%s!%s from 0x%08lx to 0x%08lx\n",
|
||||||
data, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
data, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
|
||||||
|
@ -879,7 +880,7 @@ BOOL macho_load_debug_info(struct module* module, struct macho_file_map* fmap)
|
||||||
|
|
||||||
TRACE("(%p, %p/%d)\n", module, fmap, fmap ? fmap->fd : -1);
|
TRACE("(%p, %p/%d)\n", module, fmap, fmap ? fmap->fd : -1);
|
||||||
|
|
||||||
if (module->type != DMT_MACHO || !module->macho_info)
|
if (module->type != DMT_MACHO || !module->format_info[DFI_MACHO]->u.macho_info)
|
||||||
{
|
{
|
||||||
ERR("Bad Mach-O module '%s'\n", debugstr_w(module->module.LoadedImageName));
|
ERR("Bad Mach-O module '%s'\n", debugstr_w(module->module.LoadedImageName));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -963,26 +964,34 @@ static BOOL macho_load_file(struct process* pcs, const WCHAR* filename,
|
||||||
|
|
||||||
if (macho_info->flags & MACHO_INFO_MODULE)
|
if (macho_info->flags & MACHO_INFO_MODULE)
|
||||||
{
|
{
|
||||||
struct macho_module_info *macho_module_info =
|
struct macho_module_info *macho_module_info;
|
||||||
HeapAlloc(GetProcessHeap(), 0, sizeof(struct macho_module_info));
|
struct module_format* modfmt =
|
||||||
if (!macho_module_info) goto leave;
|
HeapAlloc(GetProcessHeap(), 0, sizeof(struct module_format) + sizeof(struct macho_module_info));
|
||||||
|
if (!modfmt) goto leave;
|
||||||
macho_info->module = module_new(pcs, filename, DMT_MACHO, FALSE, load_addr,
|
macho_info->module = module_new(pcs, filename, DMT_MACHO, FALSE, load_addr,
|
||||||
fmap.segs_size, 0, calc_crc32(fmap.fd));
|
fmap.segs_size, 0, calc_crc32(fmap.fd));
|
||||||
if (!macho_info->module)
|
if (!macho_info->module)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, macho_module_info);
|
HeapFree(GetProcessHeap(), 0, modfmt);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
macho_info->module->macho_info = macho_module_info;
|
macho_module_info = (void*)(modfmt + 1);
|
||||||
macho_info->module->macho_info->load_addr = load_addr;
|
macho_info->module->format_info[DFI_MACHO] = modfmt;
|
||||||
|
|
||||||
|
modfmt->module = macho_info->module;
|
||||||
|
modfmt->remove = NULL;
|
||||||
|
modfmt->loc_compute = NULL;
|
||||||
|
modfmt->u.macho_info = macho_module_info;
|
||||||
|
|
||||||
|
macho_module_info->load_addr = load_addr;
|
||||||
|
|
||||||
if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
|
if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
|
||||||
macho_info->module->module.SymType = SymDeferred;
|
macho_info->module->module.SymType = SymDeferred;
|
||||||
else if (!macho_load_debug_info(macho_info->module, &fmap))
|
else if (!macho_load_debug_info(macho_info->module, &fmap))
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
|
|
||||||
macho_info->module->macho_info->in_use = 1;
|
macho_info->module->format_info[DFI_MACHO]->u.macho_info->in_use = 1;
|
||||||
macho_info->module->macho_info->is_loader = 0;
|
macho_info->module->format_info[DFI_MACHO]->u.macho_info->is_loader = 0;
|
||||||
TRACE("module = %p\n", macho_info->module);
|
TRACE("module = %p\n", macho_info->module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1109,7 +1118,7 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam
|
||||||
if ((module = module_is_already_loaded(pcs, filename)))
|
if ((module = module_is_already_loaded(pcs, filename)))
|
||||||
{
|
{
|
||||||
macho_info->module = module;
|
macho_info->module = module;
|
||||||
module->macho_info->in_use = 1;
|
module->format_info[DFI_MACHO]->u.macho_info->in_use = 1;
|
||||||
return module->module.SymType;
|
return module->module.SymType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1231,7 +1240,7 @@ BOOL macho_synchronize_module_list(struct process* pcs)
|
||||||
for (module = pcs->lmodules; module; module = module->next)
|
for (module = pcs->lmodules; module; module = module->next)
|
||||||
{
|
{
|
||||||
if (module->type == DMT_MACHO && !module->is_virtual)
|
if (module->type == DMT_MACHO && !module->is_virtual)
|
||||||
module->macho_info->in_use = 0;
|
module->format_info[DFI_MACHO]->u.macho_info->in_use = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ms.pcs = pcs;
|
ms.pcs = pcs;
|
||||||
|
@ -1243,7 +1252,8 @@ BOOL macho_synchronize_module_list(struct process* pcs)
|
||||||
while (module)
|
while (module)
|
||||||
{
|
{
|
||||||
if (module->type == DMT_MACHO && !module->is_virtual &&
|
if (module->type == DMT_MACHO && !module->is_virtual &&
|
||||||
!module->macho_info->in_use && !module->macho_info->is_loader)
|
!module->format_info[DFI_MACHO]->u.macho_info->in_use &&
|
||||||
|
!module->format_info[DFI_MACHO]->u.macho_info->is_loader)
|
||||||
{
|
{
|
||||||
module_remove(pcs, module);
|
module_remove(pcs, module);
|
||||||
/* restart all over */
|
/* restart all over */
|
||||||
|
@ -1297,7 +1307,7 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs)
|
||||||
TRACE("(%p/%p)\n", pcs, pcs->handle);
|
TRACE("(%p/%p)\n", pcs, pcs->handle);
|
||||||
macho_info.flags = MACHO_INFO_DEBUG_HEADER | MACHO_INFO_MODULE;
|
macho_info.flags = MACHO_INFO_DEBUG_HEADER | MACHO_INFO_MODULE;
|
||||||
if (!macho_search_loader(pcs, &macho_info)) return FALSE;
|
if (!macho_search_loader(pcs, &macho_info)) return FALSE;
|
||||||
macho_info.module->macho_info->is_loader = 1;
|
macho_info.module->format_info[DFI_MACHO]->u.macho_info->is_loader = 1;
|
||||||
module_set_module(macho_info.module, S_WineLoaderW);
|
module_set_module(macho_info.module, S_WineLoaderW);
|
||||||
return (pcs->dbg_hdr_addr = macho_info.dbg_hdr_addr) != 0;
|
return (pcs->dbg_hdr_addr = macho_info.dbg_hdr_addr) != 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue