Commit c695e7e9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

dbghelp: Use local macho load command declaration.

parent 72545794
...@@ -63,6 +63,19 @@ struct elf_section_header ...@@ -63,6 +63,19 @@ struct elf_section_header
UINT64 sh_entsize; /* Entry size if section holds table */ 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 /* structure holding information while handling an ELF image
* allows one by one section mapping for memory savings * allows one by one section mapping for memory savings
*/ */
...@@ -98,14 +111,14 @@ struct image_file_map ...@@ -98,14 +111,14 @@ struct image_file_map
size_t commands_size; size_t commands_size;
size_t commands_count; size_t commands_count;
#ifdef HAVE_MACH_O_LOADER_H const struct macho_load_command* load_commands;
const struct load_command* load_commands; const struct macho_uuid_command* uuid;
const struct uuid_command* uuid;
/* The offset in the file which is this architecture. mach_header was /* The offset in the file which is this architecture. mach_header was
* read from arch_offset. */ * read from arch_offset. */
unsigned arch_offset; unsigned arch_offset;
#ifdef HAVE_MACH_O_LOADER_H
int num_sections; int num_sections;
struct struct
{ {
......
...@@ -443,11 +443,11 @@ static const struct image_file_map_ops macho_file_map_ops = ...@@ -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 * 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) 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); fmap, fmap->header_size, fmap->commands_size, NULL);
TRACE("Mapped load commands: %p\n", fmap->load_commands); TRACE("Mapped load commands: %p\n", fmap->load_commands);
} }
...@@ -475,9 +475,9 @@ static void macho_unmap_load_commands(struct macho_file_map* fmap) ...@@ -475,9 +475,9 @@ static void macho_unmap_load_commands(struct macho_file_map* fmap)
* *
* Advance to the next load command * 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 ...@@ -492,11 +492,11 @@ static const struct load_command* macho_next_load_command(const struct load_comm
* processed. * processed.
*/ */
static int macho_enum_load_commands(struct image_file_map *ifm, unsigned cmd, 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) void* user)
{ {
struct macho_file_map* fmap = &ifm->u.macho; struct macho_file_map* fmap = &ifm->u.macho;
const struct load_command* lc; const struct macho_load_command* lc;
int i; int i;
int count = 0; int count = 0;
...@@ -528,7 +528,7 @@ static int macho_enum_load_commands(struct image_file_map *ifm, unsigned cmd, ...@@ -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 * significant sections in a Mach-O file. All commands are
* expected to be of LC_SEGMENT[_64] type. * 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]; char segname[16];
uint32_t nsects; uint32_t nsects;
...@@ -560,7 +560,7 @@ static int macho_count_sections(struct image_file_map* ifm, const struct load_co ...@@ -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 * 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. * 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 macho_file_map* fmap = &ifm->u.macho;
struct section_info* info = user; struct section_info* info = user;
...@@ -652,9 +652,9 @@ static int macho_load_section_info(struct image_file_map* ifm, const struct load ...@@ -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 * Callback for macho_enum_load_commands. Records the UUID load
* command of a Mach-O file. * 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; return 1;
} }
...@@ -927,7 +927,7 @@ static void macho_stabs_def_cb(struct module* module, ULONG_PTR load_offset, ...@@ -927,7 +927,7 @@ static void macho_stabs_def_cb(struct module* module, ULONG_PTR load_offset,
* load commands from the Mach-O file. * load commands from the Mach-O file.
*/ */
static int macho_parse_symtab(struct image_file_map* ifm, 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; struct macho_file_map* fmap = &ifm->u.macho;
const struct symtab_command* sc = (const struct symtab_command*)lc; const struct symtab_command* sc = (const struct symtab_command*)lc;
......
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