Commit 0a1de579 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Use is_host_64bit for handling bitness of mach-o libs.

parent d6096057
...@@ -744,9 +744,9 @@ static BOOL macho_map_file(struct process *pcs, const WCHAR *filenameW, ...@@ -744,9 +744,9 @@ static BOOL macho_map_file(struct process *pcs, const WCHAR *filenameW,
WCHAR* filename; WCHAR* filename;
struct section_info info; struct section_info info;
BOOL ret = FALSE; BOOL ret = FALSE;
UINT32 target_cpu = (pcs->is_64bit) ? MACHO_CPU_TYPE_X86_64 : MACHO_CPU_TYPE_X86; UINT32 target_cpu = (pcs->is_host_64bit) ? MACHO_CPU_TYPE_X86_64 : MACHO_CPU_TYPE_X86;
UINT32 target_magic = (pcs->is_64bit) ? MACHO_MH_MAGIC_64 : MACHO_MH_MAGIC_32; UINT32 target_magic = (pcs->is_host_64bit) ? MACHO_MH_MAGIC_64 : MACHO_MH_MAGIC_32;
UINT32 target_cmd = (pcs->is_64bit) ? MACHO_LC_SEGMENT_64 : MACHO_LC_SEGMENT; UINT32 target_cmd = (pcs->is_host_64bit) ? MACHO_LC_SEGMENT_64 : MACHO_LC_SEGMENT;
DWORD bytes_read; DWORD bytes_read;
struct struct
...@@ -762,8 +762,8 @@ static BOOL macho_map_file(struct process *pcs, const WCHAR *filenameW, ...@@ -762,8 +762,8 @@ static BOOL macho_map_file(struct process *pcs, const WCHAR *filenameW,
ifm->modtype = DMT_MACHO; ifm->modtype = DMT_MACHO;
ifm->ops = &macho_file_map_ops; ifm->ops = &macho_file_map_ops;
ifm->alternate = NULL; ifm->alternate = NULL;
ifm->addr_size = (pcs->is_64bit) ? 64 : 32; ifm->addr_size = (pcs->is_host_64bit) ? 64 : 32;
fmap->header_size = (pcs->is_64bit) ? sizeof(struct macho_header) : FIELD_OFFSET(struct macho_header, reserved); fmap->header_size = (pcs->is_host_64bit) ? sizeof(struct macho_header) : FIELD_OFFSET(struct macho_header, reserved);
if (!(filename = get_dos_file_name(filenameW))) return FALSE; if (!(filename = get_dos_file_name(filenameW))) return FALSE;
...@@ -1339,8 +1339,8 @@ static BOOL image_uses_split_segs(struct process* process, ULONG_PTR load_addr) ...@@ -1339,8 +1339,8 @@ static BOOL image_uses_split_segs(struct process* process, ULONG_PTR load_addr)
if (load_addr) if (load_addr)
{ {
UINT32 target_cpu = (process->is_64bit) ? MACHO_CPU_TYPE_X86_64 : MACHO_CPU_TYPE_X86; UINT32 target_cpu = (process->is_host_64bit) ? MACHO_CPU_TYPE_X86_64 : MACHO_CPU_TYPE_X86;
UINT32 target_magic = (process->is_64bit) ? MACHO_MH_MAGIC_64 : MACHO_MH_MAGIC_32; UINT32 target_magic = (process->is_host_64bit) ? MACHO_MH_MAGIC_64 : MACHO_MH_MAGIC_32;
struct macho_header header; struct macho_header header;
if (read_process_memory(process, load_addr, &header, FIELD_OFFSET(struct macho_header, reserved)) && if (read_process_memory(process, load_addr, &header, FIELD_OFFSET(struct macho_header, reserved)) &&
...@@ -1608,14 +1608,14 @@ static BOOL macho_enum_modules_internal(const struct process* pcs, ...@@ -1608,14 +1608,14 @@ static BOOL macho_enum_modules_internal(const struct process* pcs,
TRACE("(%p/%p, %s, %p, %p)\n", pcs, pcs->handle, debugstr_w(main_name), cb, TRACE("(%p/%p, %s, %p, %p)\n", pcs, pcs->handle, debugstr_w(main_name), cb,
user); user);
if (pcs->is_64bit) if (pcs->is_host_64bit)
len = sizeof(image_infos.infos64); len = sizeof(image_infos.infos64);
else else
len = sizeof(image_infos.infos32); len = sizeof(image_infos.infos32);
if (!pcs->dbg_hdr_addr || if (!pcs->dbg_hdr_addr ||
!read_process_memory(pcs, pcs->dbg_hdr_addr, &image_infos, len)) !read_process_memory(pcs, pcs->dbg_hdr_addr, &image_infos, len))
goto done; goto done;
if (!pcs->is_64bit) if (!pcs->is_host_64bit)
{ {
struct dyld_all_image_infos32 temp = image_infos.infos32; struct dyld_all_image_infos32 temp = image_infos.infos32;
image_infos.infos64.infoArrayCount = temp.infoArrayCount; image_infos.infos64.infoArrayCount = temp.infoArrayCount;
...@@ -1625,7 +1625,7 @@ static BOOL macho_enum_modules_internal(const struct process* pcs, ...@@ -1625,7 +1625,7 @@ static BOOL macho_enum_modules_internal(const struct process* pcs,
goto done; goto done;
TRACE("Process has %u image infos at %I64x\n", image_infos.infos64.infoArrayCount, image_infos.infos64.infoArray); TRACE("Process has %u image infos at %I64x\n", image_infos.infos64.infoArrayCount, image_infos.infos64.infoArray);
if (pcs->is_64bit) if (pcs->is_host_64bit)
len = sizeof(info_array->info64); len = sizeof(info_array->info64);
else else
len = sizeof(info_array->info32); len = sizeof(info_array->info32);
...@@ -1639,7 +1639,7 @@ static BOOL macho_enum_modules_internal(const struct process* pcs, ...@@ -1639,7 +1639,7 @@ static BOOL macho_enum_modules_internal(const struct process* pcs,
for (i = 0; i < image_infos.infos64.infoArrayCount; i++) for (i = 0; i < image_infos.infos64.infoArrayCount; i++)
{ {
struct dyld_image_info64 info; struct dyld_image_info64 info;
if (pcs->is_64bit) if (pcs->is_host_64bit)
info = info_array[i].info64; info = info_array[i].info64;
else else
{ {
...@@ -1829,13 +1829,13 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in ...@@ -1829,13 +1829,13 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in
char path[1024]; char path[1024];
BOOL got_path = FALSE; BOOL got_path = FALSE;
if (pcs->is_64bit) if (pcs->is_host_64bit)
len = sizeof(image_infos.infos64); len = sizeof(image_infos.infos64);
else else
len = sizeof(image_infos.infos32); len = sizeof(image_infos.infos32);
if (read_process_memory(pcs, pcs->dbg_hdr_addr, &image_infos, len)) if (read_process_memory(pcs, pcs->dbg_hdr_addr, &image_infos, len))
{ {
if (pcs->is_64bit) if (pcs->is_host_64bit)
len = sizeof(image_info.info64); len = sizeof(image_info.info64);
else else
{ {
...@@ -1847,7 +1847,7 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in ...@@ -1847,7 +1847,7 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in
if (image_infos.infos64.infoArray && image_infos.infos64.infoArrayCount && if (image_infos.infos64.infoArray && image_infos.infos64.infoArrayCount &&
read_process_memory(pcs, image_infos.infos64.infoArray, &image_info, len)) read_process_memory(pcs, image_infos.infos64.infoArray, &image_info, len))
{ {
if (!pcs->is_64bit) if (!pcs->is_host_64bit)
{ {
struct dyld_image_info32 temp = image_info.info32; struct dyld_image_info32 temp = image_info.info32;
image_info.info64.imageLoadAddress = temp.imageLoadAddress; image_info.info64.imageLoadAddress = temp.imageLoadAddress;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment