Jacek Caban : dbghelp: Use local macho load command declaration.

Alexandre Julliard julliard at winehq.org
Wed Apr 1 15:50:59 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Apr  1 20:28:10 2020 +0200

dbghelp: Use local macho load command declaration.

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

---

 dlls/dbghelp/image_private.h | 19 ++++++++++++++++---
 dlls/dbghelp/macho_module.c  | 22 +++++++++++-----------
 2 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/dlls/dbghelp/image_private.h b/dlls/dbghelp/image_private.h
index 9f015c2707..da977c08f5 100644
--- a/dlls/dbghelp/image_private.h
+++ b/dlls/dbghelp/image_private.h
@@ -63,6 +63,19 @@ struct elf_section_header
     UINT64  sh_entsize;    /* Entry size if section holds table */
 };
 
+struct macho_load_command
+{
+    UINT32  cmd;           /* type of load command */
+    UINT32  cmdsize;       /* total size of command in bytes */
+};
+
+struct macho_uuid_command
+{
+    UINT32  cmd;           /* LC_UUID */
+    UINT32  cmdsize;
+    UINT8   uuid[16];
+};
+
 /* structure holding information while handling an ELF image
  * allows one by one section mapping for memory savings
  */
@@ -98,14 +111,14 @@ struct image_file_map
             size_t                      commands_size;
             size_t                      commands_count;
 
-#ifdef HAVE_MACH_O_LOADER_H
-            const struct load_command*  load_commands;
-            const struct uuid_command*  uuid;
+            const struct macho_load_command*    load_commands;
+            const struct macho_uuid_command*    uuid;
 
             /* The offset in the file which is this architecture.  mach_header was
              * read from arch_offset. */
             unsigned                    arch_offset;
 
+#ifdef HAVE_MACH_O_LOADER_H
             int                         num_sections;
             struct
             {
diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 5d3f8615e8..ac4e8cbb7e 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -443,11 +443,11 @@ static const struct image_file_map_ops macho_file_map_ops =
  *
  * Maps the load commands from a Mach-O file into memory
  */
-static const struct load_command* macho_map_load_commands(struct macho_file_map* fmap)
+static const struct macho_load_command* macho_map_load_commands(struct macho_file_map* fmap)
 {
     if (fmap->load_commands == IMAGE_NO_MAP)
     {
-        fmap->load_commands = (const struct load_command*) macho_map_range(
+        fmap->load_commands = (const struct macho_load_command*) macho_map_range(
                 fmap, fmap->header_size, fmap->commands_size, NULL);
         TRACE("Mapped load commands: %p\n", fmap->load_commands);
     }
@@ -475,9 +475,9 @@ static void macho_unmap_load_commands(struct macho_file_map* fmap)
  *
  * Advance to the next load command
  */
-static const struct load_command* macho_next_load_command(const struct load_command* lc)
+static const struct macho_load_command* macho_next_load_command(const struct macho_load_command* lc)
 {
-    return (const struct load_command*)((const char*)lc + lc->cmdsize);
+    return (const struct macho_load_command*)((const char*)lc + lc->cmdsize);
 }
 
 /******************************************************************
@@ -492,11 +492,11 @@ static const struct load_command* macho_next_load_command(const struct load_comm
  * processed.
  */
 static int macho_enum_load_commands(struct image_file_map *ifm, unsigned cmd,
-                                    int (*cb)(struct image_file_map*, const struct load_command*, void*),
+                                    int (*cb)(struct image_file_map*, const struct macho_load_command*, void*),
                                     void* user)
 {
     struct macho_file_map* fmap = &ifm->u.macho;
-    const struct load_command* lc;
+    const struct macho_load_command* lc;
     int i;
     int count = 0;
 
@@ -528,7 +528,7 @@ static int macho_enum_load_commands(struct image_file_map *ifm, unsigned cmd,
  * significant sections in a Mach-O file.  All commands are
  * expected to be of LC_SEGMENT[_64] type.
  */
-static int macho_count_sections(struct image_file_map* ifm, const struct load_command* lc, void* user)
+static int macho_count_sections(struct image_file_map* ifm, const struct macho_load_command* lc, void* user)
 {
     char segname[16];
     uint32_t nsects;
@@ -560,7 +560,7 @@ static int macho_count_sections(struct image_file_map* ifm, const struct load_co
  * range covered by the segments of a Mach-O file and builds the
  * section map.  All commands are expected to be of LC_SEGMENT[_64] type.
  */
-static int macho_load_section_info(struct image_file_map* ifm, const struct load_command* lc, void* user)
+static int macho_load_section_info(struct image_file_map* ifm, const struct macho_load_command* lc, void* user)
 {
     struct macho_file_map*          fmap = &ifm->u.macho;
     struct section_info*            info = user;
@@ -652,9 +652,9 @@ static int macho_load_section_info(struct image_file_map* ifm, const struct load
  * Callback for macho_enum_load_commands.  Records the UUID load
  * command of a Mach-O file.
  */
-static int find_uuid(struct image_file_map* ifm, const struct load_command* lc, void* user)
+static int find_uuid(struct image_file_map* ifm, const struct macho_load_command* lc, void* user)
 {
-    ifm->u.macho.uuid = (const struct uuid_command*)lc;
+    ifm->u.macho.uuid = (const struct macho_uuid_command*)lc;
     return 1;
 }
 
@@ -927,7 +927,7 @@ static void macho_stabs_def_cb(struct module* module, ULONG_PTR load_offset,
  * load commands from the Mach-O file.
  */
 static int macho_parse_symtab(struct image_file_map* ifm,
-                              const struct load_command* lc, void* user)
+                              const struct macho_load_command* lc, void* user)
 {
     struct macho_file_map* fmap = &ifm->u.macho;
     const struct symtab_command*    sc = (const struct symtab_command*)lc;




More information about the wine-cvs mailing list