Jacek Caban : dbghelp: Get rid of get_dyld_image_info_address.

Alexandre Julliard julliard at winehq.org
Thu Apr 2 14:27:37 CDT 2020


Module: wine
Branch: master
Commit: f2b8af7e7e159a5259aaab42169c4f8220b121eb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f2b8af7e7e159a5259aaab42169c4f8220b121eb

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Apr  2 19:18:24 2020 +0200

dbghelp: Get rid of get_dyld_image_info_address.

We should get the address from PEB anyway.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/macho_module.c | 45 +--------------------------------------------
 1 file changed, 1 insertion(+), 44 deletions(-)

diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 795b8500d9..8aa232e1ed 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -37,12 +37,6 @@
 #include <assert.h>
 #include <stdarg.h>
 #include <errno.h>
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-# include <sys/mman.h>
-#endif
 
 #include "ntstatus.h"
 #define WIN32_NO_STATUS
@@ -54,8 +48,6 @@
 
 #ifdef HAVE_MACH_O_LOADER_H
 
-#include <mach-o/nlist.h>
-
 struct dyld_image_info32
 {
     UINT32  imageLoadAddress;  /* const struct mach_header* */
@@ -1455,41 +1447,6 @@ static void macho_module_remove(struct process* pcs, struct module_format* modfm
     HeapFree(GetProcessHeap(), 0, modfmt);
 }
 
-/******************************************************************
- *              get_dyld_image_info_address
- */
-static ULONG_PTR get_dyld_image_info_address(struct process* pcs)
-{
-    ULONG_PTR dyld_image_info_address = 0;
-
-#ifndef __LP64__ /* No reading the symtab with nlist(3) in LP64 */
-    if (!dyld_image_info_address)
-    {
-        static void* dyld_all_image_infos_addr;
-
-        /* Our next best guess is that dyld was loaded at its base address
-           and we can find the dyld image infos address by looking up its symbol. */
-        if (!dyld_all_image_infos_addr)
-        {
-            struct nlist nl[2];
-            memset(nl, 0, sizeof(nl));
-            nl[0].n_un.n_name = (char*)"_dyld_all_image_infos";
-            if (!nlist("/usr/lib/dyld", nl))
-                dyld_all_image_infos_addr = (void*)nl[0].n_value;
-        }
-
-        if (dyld_all_image_infos_addr)
-        {
-            TRACE("got dyld_image_info_address %p from /usr/lib/dyld symbol table\n",
-                  dyld_all_image_infos_addr);
-            dyld_image_info_address = (ULONG_PTR)dyld_all_image_infos_addr;
-        }
-    }
-#endif
-
-    return dyld_image_info_address;
-}
-
 /******************************************************************
  *              macho_load_file
  *
@@ -1964,7 +1921,7 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs, ULONG_PTR addr)
     struct macho_info     macho_info;
 
     TRACE("(%p/%p)\n", pcs, pcs->handle);
-    pcs->dbg_hdr_addr = addr ? addr : get_dyld_image_info_address(pcs);
+    pcs->dbg_hdr_addr = addr;
     macho_info.flags = MACHO_INFO_MODULE;
     if (!macho_search_loader(pcs, &macho_info)) return FALSE;
     macho_info.module->format_info[DFI_MACHO]->u.macho_info->is_loader = 1;




More information about the wine-cvs mailing list