dbghelp: Use WINELOADER environment variable from debuggee process in get_wine_loader_name.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49838 Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ea5249feae
commit
310019789f
|
@ -651,7 +651,7 @@ extern void module_reset_debug_info(struct module* module) DECLSPEC_HIDD
|
|||
extern BOOL module_remove(struct process* pcs,
|
||||
struct module* module) DECLSPEC_HIDDEN;
|
||||
extern void module_set_module(struct module* module, const WCHAR* name) DECLSPEC_HIDDEN;
|
||||
extern WCHAR * get_wine_loader_name(struct process *pcs) DECLSPEC_HIDDEN;
|
||||
extern const WCHAR *get_wine_loader_name(struct process *pcs) DECLSPEC_HIDDEN;
|
||||
|
||||
/* msc.c */
|
||||
extern BOOL pe_load_debug_directory(const struct process* pcs,
|
||||
|
|
|
@ -1752,13 +1752,10 @@ static const struct loader_ops elf_loader_ops =
|
|||
BOOL elf_read_wine_loader_dbg_info(struct process* pcs, ULONG_PTR addr)
|
||||
{
|
||||
struct elf_info elf_info;
|
||||
WCHAR *loader;
|
||||
BOOL ret;
|
||||
|
||||
elf_info.flags = ELF_INFO_DEBUG_HEADER | ELF_INFO_MODULE;
|
||||
loader = get_wine_loader_name(pcs);
|
||||
ret = elf_search_and_load_file(pcs, loader, addr, 0, &elf_info);
|
||||
heap_free(loader);
|
||||
ret = elf_search_and_load_file(pcs, get_wine_loader_name(pcs), addr, 0, &elf_info);
|
||||
if (!ret || !elf_info.dbg_hdr_addr) return FALSE;
|
||||
|
||||
TRACE("Found ELF debug header %#lx\n", elf_info.dbg_hdr_addr);
|
||||
|
|
|
@ -1885,12 +1885,7 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in
|
|||
}
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
WCHAR *loader = get_wine_loader_name(pcs);
|
||||
ret = loader && macho_search_and_load_file(pcs, loader, 0, macho_info);
|
||||
heap_free(loader);
|
||||
}
|
||||
if (!ret) ret = macho_search_and_load_file(pcs, get_wine_loader_name(pcs), 0, macho_info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,37 +138,12 @@ void module_set_module(struct module* module, const WCHAR* name)
|
|||
}
|
||||
|
||||
/* Returned string must be freed by caller */
|
||||
WCHAR *get_wine_loader_name(struct process *pcs)
|
||||
const WCHAR *get_wine_loader_name(struct process *pcs)
|
||||
{
|
||||
static const WCHAR wineW[] = {'w','i','n','e',0};
|
||||
static const WCHAR suffixW[] = {'6','4',0};
|
||||
WCHAR *buffer, *p;
|
||||
const char *env;
|
||||
|
||||
/* All binaries are loaded with WINELOADER (if run from tree) or by the
|
||||
* main executable
|
||||
*/
|
||||
if ((env = getenv("WINELOADER")))
|
||||
{
|
||||
DWORD len = 2 + MultiByteToWideChar( CP_UNIXCP, 0, env, -1, NULL, 0 );
|
||||
buffer = heap_alloc( len * sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_UNIXCP, 0, env, -1, buffer, len );
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = heap_alloc( sizeof(wineW) + 2 * sizeof(WCHAR) );
|
||||
lstrcpyW( buffer, wineW );
|
||||
}
|
||||
|
||||
p = buffer + lstrlenW( buffer ) - lstrlenW( suffixW );
|
||||
if (p > buffer && !wcscmp( p, suffixW ))
|
||||
*p = 0;
|
||||
|
||||
if (pcs->is_64bit)
|
||||
lstrcatW(buffer, suffixW);
|
||||
|
||||
TRACE( "returning %s\n", debugstr_w(buffer) );
|
||||
return buffer;
|
||||
const WCHAR *name = process_getenv(pcs, L"WINELOADER");
|
||||
if (!name) name = pcs->is_64bit ? L"wine64" : L"wine";
|
||||
TRACE("returning %s\n", debugstr_w(name));
|
||||
return name;
|
||||
}
|
||||
|
||||
static const char* get_module_type(enum module_type type, BOOL virtual)
|
||||
|
|
Loading…
Reference in New Issue