mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
[WINESYNC] dbghelp: Read the Elf_Dyn struct corresponding to the target's architecture.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id bb53152faab705d972de3763ddd9bb3351e92460 by Zebediah Figura <zfigura@codeweavers.com>
This commit is contained in:
parent
48c551a237
commit
dd5baf8750
3 changed files with 44 additions and 19 deletions
|
@ -1270,29 +1270,56 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, const WCHAR* filename,
|
||||||
|
|
||||||
if (elf_find_section(fmap, ".dynamic", SHT_DYNAMIC, &ism))
|
if (elf_find_section(fmap, ".dynamic", SHT_DYNAMIC, &ism))
|
||||||
{
|
{
|
||||||
Elf_Dyn dyn;
|
|
||||||
char* ptr = (char*)(ULONG_PTR)fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
|
char* ptr = (char*)(ULONG_PTR)fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
|
|
||||||
if (load_offset) ptr += load_offset - fmap->u.elf.elf_start;
|
if (load_offset) ptr += load_offset - fmap->u.elf.elf_start;
|
||||||
|
|
||||||
do
|
if (fmap->addr_size == 32)
|
||||||
{
|
{
|
||||||
if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
|
Elf32_Dyn dyn;
|
||||||
len != sizeof(dyn))
|
|
||||||
return ret;
|
do
|
||||||
if (dyn.d_tag == DT_DEBUG)
|
|
||||||
{
|
{
|
||||||
elf_info->dbg_hdr_addr = dyn.d_un.d_ptr;
|
if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
|
||||||
if (load_offset == 0 && dyn_addr == 0) /* likely the case */
|
len != sizeof(dyn))
|
||||||
/* Assume this module (the Wine loader) has been loaded at its preferred address */
|
return ret;
|
||||||
dyn_addr = ism.fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
|
if (dyn.d_tag == DT_DEBUG)
|
||||||
break;
|
{
|
||||||
}
|
elf_info->dbg_hdr_addr = dyn.d_un.d_ptr;
|
||||||
ptr += sizeof(dyn);
|
if (load_offset == 0 && dyn_addr == 0) /* likely the case */
|
||||||
} while (dyn.d_tag != DT_NULL);
|
/* Assume this module (the Wine loader) has been
|
||||||
if (dyn.d_tag == DT_NULL) return ret;
|
* loaded at its preferred address */
|
||||||
}
|
dyn_addr = ism.fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ptr += sizeof(dyn);
|
||||||
|
} while (dyn.d_tag != DT_NULL);
|
||||||
|
if (dyn.d_tag == DT_NULL) return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Elf64_Dyn dyn;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
|
||||||
|
len != sizeof(dyn))
|
||||||
|
return ret;
|
||||||
|
if (dyn.d_tag == DT_DEBUG)
|
||||||
|
{
|
||||||
|
elf_info->dbg_hdr_addr = dyn.d_un.d_ptr;
|
||||||
|
if (load_offset == 0 && dyn_addr == 0) /* likely the case */
|
||||||
|
/* Assume this module (the Wine loader) has been
|
||||||
|
* loaded at its preferred address */
|
||||||
|
dyn_addr = ism.fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ptr += sizeof(dyn);
|
||||||
|
} while (dyn.d_tag != DT_NULL);
|
||||||
|
if (dyn.d_tag == DT_NULL) return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
elf_end_find(fmap);
|
elf_end_find(fmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,11 +61,9 @@ typedef struct section macho_section;
|
||||||
#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
|
#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#define Elf_Dyn Elf64_Dyn
|
|
||||||
#define Elf_Sym Elf64_Sym
|
#define Elf_Sym Elf64_Sym
|
||||||
#define Elf_auxv_t Elf64_auxv_t
|
#define Elf_auxv_t Elf64_auxv_t
|
||||||
#else
|
#else
|
||||||
#define Elf_Dyn Elf32_Dyn
|
|
||||||
#define Elf_Sym Elf32_Sym
|
#define Elf_Sym Elf32_Sym
|
||||||
#define Elf_auxv_t Elf32_auxv_t
|
#define Elf_auxv_t Elf32_auxv_t
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,4 +3,4 @@ directories:
|
||||||
files:
|
files:
|
||||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||||
tags:
|
tags:
|
||||||
wine: bd620ffb443eaa2dba997dc5597cb37c44d757b7
|
wine: bb53152faab705d972de3763ddd9bb3351e92460
|
||||||
|
|
Loading…
Reference in a new issue