mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 06:11:34 +00:00
dbghelp: No longer decorate ELF/Mach-O module names.
Rely solely on extended module information. Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
c50e02ec9c
commit
8d75739b6a
|
@ -716,7 +716,6 @@ extern BOOL macho_read_wine_loader_dbg_info(struct process* pcs, ULONG_P
|
||||||
void minidump_add_memory_block(struct dump_context* dc, ULONG64 base, ULONG size, ULONG rva);
|
void minidump_add_memory_block(struct dump_context* dc, ULONG64 base, ULONG size, ULONG rva);
|
||||||
|
|
||||||
/* module.c */
|
/* module.c */
|
||||||
extern const WCHAR S_ElfW[];
|
|
||||||
extern const WCHAR S_WineLoaderW[];
|
extern const WCHAR S_WineLoaderW[];
|
||||||
extern const struct loader_ops no_loader_ops;
|
extern const struct loader_ops no_loader_ops;
|
||||||
extern const struct loader_ops empty_loader_ops;
|
extern const struct loader_ops empty_loader_ops;
|
||||||
|
@ -748,6 +747,7 @@ extern BOOL module_remove(struct process* pcs,
|
||||||
struct module* module);
|
struct module* module);
|
||||||
extern void module_set_module(struct module* module, const WCHAR* name);
|
extern void module_set_module(struct module* module, const WCHAR* name);
|
||||||
extern WCHAR* get_wine_loader_name(struct process *pcs) __WINE_DEALLOC(HeapFree, 3) __WINE_MALLOC;
|
extern WCHAR* get_wine_loader_name(struct process *pcs) __WINE_DEALLOC(HeapFree, 3) __WINE_MALLOC;
|
||||||
|
extern BOOL module_is_wine_host(const WCHAR* module_name, const WCHAR* ext);
|
||||||
|
|
||||||
/* msc.c */
|
/* msc.c */
|
||||||
extern BOOL pe_load_debug_directory(const struct process* pcs,
|
extern BOOL pe_load_debug_directory(const struct process* pcs,
|
||||||
|
|
|
@ -1082,11 +1082,8 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
|
||||||
}
|
}
|
||||||
lret = dwarf2_parse(module, module->reloc_delta, thunks, fmap);
|
lret = dwarf2_parse(module, module->reloc_delta, thunks, fmap);
|
||||||
ret = ret || lret;
|
ret = ret || lret;
|
||||||
}
|
|
||||||
if (wcsstr(module->modulename, S_ElfW) || !wcscmp(module->modulename, S_WineLoaderW))
|
|
||||||
{
|
|
||||||
/* add the thunks for native libraries */
|
/* add the thunks for native libraries */
|
||||||
if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY))
|
if (module_is_wine_host(module->modulename, L".so"))
|
||||||
elf_new_wine_thunks(module, ht_symtab, thunks);
|
elf_new_wine_thunks(module, ht_symtab, thunks);
|
||||||
}
|
}
|
||||||
/* add all the public symbols from symtab */
|
/* add all the public symbols from symtab */
|
||||||
|
|
|
@ -35,7 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
|
||||||
|
|
||||||
#define NOTE_GNU_BUILD_ID 3
|
#define NOTE_GNU_BUILD_ID 3
|
||||||
|
|
||||||
const WCHAR S_ElfW[] = L"<elf>";
|
|
||||||
const WCHAR S_WineLoaderW[] = L"<wine-loader>";
|
const WCHAR S_WineLoaderW[] = L"<wine-loader>";
|
||||||
static const WCHAR * const ext[] = {L".acm", L".dll", L".drv", L".exe", L".ocx", L".vxd", NULL};
|
static const WCHAR * const ext[] = {L".acm", L".dll", L".drv", L".exe", L".ocx", L".vxd", NULL};
|
||||||
|
|
||||||
|
@ -54,6 +53,20 @@ static int match_ext(const WCHAR* ptr, size_t len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: implemented from checking on modulename (ie foo.dll.so)
|
||||||
|
* and Wine loader, but fails to identify unixlib.
|
||||||
|
* Would require a stronger tagging of ELF modules.
|
||||||
|
*/
|
||||||
|
BOOL module_is_wine_host(const WCHAR* module_name, const WCHAR* ext)
|
||||||
|
{
|
||||||
|
size_t len, extlen;
|
||||||
|
if (!wcscmp(module_name, S_WineLoaderW)) return TRUE;
|
||||||
|
len = wcslen(module_name);
|
||||||
|
extlen = wcslen(ext);
|
||||||
|
return len > extlen && !wcsicmp(&module_name[len - extlen], ext) &&
|
||||||
|
match_ext(module_name, len - extlen);
|
||||||
|
}
|
||||||
|
|
||||||
static const WCHAR* get_filename(const WCHAR* name, const WCHAR* endptr)
|
static const WCHAR* get_filename(const WCHAR* name, const WCHAR* endptr)
|
||||||
{
|
{
|
||||||
const WCHAR* ptr;
|
const WCHAR* ptr;
|
||||||
|
@ -101,7 +114,7 @@ static BOOL is_wine_loader(const WCHAR *module)
|
||||||
static void module_fill_module(const WCHAR* in, WCHAR* out, size_t size)
|
static void module_fill_module(const WCHAR* in, WCHAR* out, size_t size)
|
||||||
{
|
{
|
||||||
const WCHAR *ptr, *endptr;
|
const WCHAR *ptr, *endptr;
|
||||||
size_t len, l;
|
size_t len;
|
||||||
|
|
||||||
endptr = in + lstrlenW(in);
|
endptr = in + lstrlenW(in);
|
||||||
endptr -= match_ext(in, endptr - in);
|
endptr -= match_ext(in, endptr - in);
|
||||||
|
@ -111,12 +124,6 @@ static void module_fill_module(const WCHAR* in, WCHAR* out, size_t size)
|
||||||
out[len] = '\0';
|
out[len] = '\0';
|
||||||
if (is_wine_loader(out))
|
if (is_wine_loader(out))
|
||||||
lstrcpynW(out, S_WineLoaderW, size);
|
lstrcpynW(out, S_WineLoaderW, size);
|
||||||
else
|
|
||||||
{
|
|
||||||
if (len > 3 && !wcsicmp(&out[len - 3], L".so") &&
|
|
||||||
(l = match_ext(out, len - 3)))
|
|
||||||
lstrcpyW(&out[len - l - 3], L"<elf>");
|
|
||||||
}
|
|
||||||
while ((*out = towlower(*out))) out++;
|
while ((*out = towlower(*out))) out++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,17 @@ struct info_modules
|
||||||
unsigned num_used;
|
unsigned num_used;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char* get_module_type(const struct info_module* im)
|
||||||
|
{
|
||||||
|
switch (im->ext_module_info.type)
|
||||||
|
{
|
||||||
|
case DMT_ELF: return "ELF";
|
||||||
|
case DMT_MACHO: return "Mach-O";
|
||||||
|
case DMT_PE: return "PE";
|
||||||
|
default: return "----";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const char* get_symtype_str(const struct info_module* im)
|
static const char* get_symtype_str(const struct info_module* im)
|
||||||
{
|
{
|
||||||
switch (im->mi.SymType)
|
switch (im->mi.SymType)
|
||||||
|
@ -180,13 +191,15 @@ static const char* get_machine_str(DWORD machine)
|
||||||
static void module_print_info(const struct info_module *module, BOOL is_embedded, BOOL multi_machine)
|
static void module_print_info(const struct info_module *module, BOOL is_embedded, BOOL multi_machine)
|
||||||
{
|
{
|
||||||
if (multi_machine)
|
if (multi_machine)
|
||||||
dbg_printf("%16I64x-%16I64x\t%s\t%-16s%s\n",
|
dbg_printf("%s%s\t%16I64x-%16I64x\t%s\t%-16s%s\n",
|
||||||
|
is_embedded ? " \\-" : "", get_module_type(module),
|
||||||
module->mi.BaseOfImage,
|
module->mi.BaseOfImage,
|
||||||
module->mi.BaseOfImage + module->mi.ImageSize,
|
module->mi.BaseOfImage + module->mi.ImageSize,
|
||||||
get_machine_str(module->mi.MachineType),
|
get_machine_str(module->mi.MachineType),
|
||||||
is_embedded ? "\\" : get_symtype_str(module), module->name);
|
is_embedded ? "\\" : get_symtype_str(module), module->name);
|
||||||
else
|
else
|
||||||
dbg_printf("%*.*I64x-%*.*I64x\t%-16s%s\n",
|
dbg_printf("%s%s\t%*.*I64x-%*.*I64x\t%-16s%s\n",
|
||||||
|
is_embedded ? " \\-" : "", get_module_type(module),
|
||||||
ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage,
|
ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage,
|
||||||
ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage + module->mi.ImageSize,
|
ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage + module->mi.ImageSize,
|
||||||
is_embedded ? "\\" : get_symtype_str(module), module->name);
|
is_embedded ? "\\" : get_symtype_str(module), module->name);
|
||||||
|
@ -206,7 +219,9 @@ static int __cdecl module_compare(const void* p1, const void* p2)
|
||||||
static inline BOOL module_is_container(const struct info_module *wmod_cntnr,
|
static inline BOOL module_is_container(const struct info_module *wmod_cntnr,
|
||||||
const struct info_module *wmod_child)
|
const struct info_module *wmod_child)
|
||||||
{
|
{
|
||||||
return wmod_cntnr->mi.BaseOfImage <= wmod_child->mi.BaseOfImage &&
|
return (wmod_cntnr->ext_module_info.type == DMT_ELF || wmod_cntnr->ext_module_info.type == DMT_MACHO) &&
|
||||||
|
(wmod_child->ext_module_info.type == DMT_PE) &&
|
||||||
|
wmod_cntnr->mi.BaseOfImage <= wmod_child->mi.BaseOfImage &&
|
||||||
wmod_cntnr->mi.BaseOfImage + wmod_cntnr->mi.ImageSize >=
|
wmod_cntnr->mi.BaseOfImage + wmod_cntnr->mi.ImageSize >=
|
||||||
wmod_child->mi.BaseOfImage + wmod_child->mi.ImageSize;
|
wmod_child->mi.BaseOfImage + wmod_child->mi.ImageSize;
|
||||||
}
|
}
|
||||||
|
@ -288,33 +303,25 @@ void info_win32_module(DWORD64 base, BOOL multi_machine)
|
||||||
(base < im.modules[i].mi.BaseOfImage || base >= im.modules[i].mi.BaseOfImage + im.modules[i].mi.ImageSize))
|
(base < im.modules[i].mi.BaseOfImage || base >= im.modules[i].mi.BaseOfImage + im.modules[i].mi.ImageSize))
|
||||||
continue;
|
continue;
|
||||||
if (!multi_machine && machine != im.modules[i].mi.MachineType) continue;
|
if (!multi_machine && machine != im.modules[i].mi.MachineType) continue;
|
||||||
if (strstr(im.modules[i].name, "<elf>"))
|
if (im.modules[i].ext_module_info.type == DMT_ELF || im.modules[i].ext_module_info.type == DMT_MACHO)
|
||||||
{
|
{
|
||||||
dbg_printf("ELF\t");
|
|
||||||
module_print_info(&im.modules[i], FALSE, multi_machine);
|
module_print_info(&im.modules[i], FALSE, multi_machine);
|
||||||
/* print all modules embedded in this one */
|
/* print all modules embedded in this one */
|
||||||
for (j = 0; j < im.num_used; j++)
|
for (j = 0; j < im.num_used; j++)
|
||||||
{
|
{
|
||||||
if (!strstr(im.modules[j].name, "<elf>") && module_is_container(&im.modules[i], &im.modules[j]))
|
if (module_is_container(&im.modules[i], &im.modules[j]))
|
||||||
{
|
|
||||||
dbg_printf(" \\-PE\t");
|
|
||||||
module_print_info(&im.modules[j], TRUE, multi_machine);
|
module_print_info(&im.modules[j], TRUE, multi_machine);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* check module is not embedded in another module */
|
/* check module is not embedded in another module */
|
||||||
for (j = 0; j < im.num_used; j++)
|
for (j = 0; j < im.num_used; j++)
|
||||||
{
|
{
|
||||||
if (strstr(im.modules[j].name, "<elf>") && module_is_container(&im.modules[j], &im.modules[i]))
|
if (module_is_container(&im.modules[j], &im.modules[i]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j < im.num_used) continue;
|
if (j < im.num_used) continue;
|
||||||
if (strstr(im.modules[i].name, ".so") || strchr(im.modules[i].name, '<'))
|
|
||||||
dbg_printf("ELF\t");
|
|
||||||
else
|
|
||||||
dbg_printf("PE\t");
|
|
||||||
module_print_info(&im.modules[i], FALSE, multi_machine);
|
module_print_info(&im.modules[i], FALSE, multi_machine);
|
||||||
}
|
}
|
||||||
num_printed++;
|
num_printed++;
|
||||||
|
|
Loading…
Reference in a new issue