Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e1064850
Commit
e1064850
authored
Oct 09, 2023
by
Eric Pouech
Committed by
Alexandre Julliard
Oct 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Set the machine type for mach-O modules.
Signed-off-by:
Eric Pouech
<
epouech@codeweavers.com
>
parent
0a1de579
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
macho_module.c
dlls/dbghelp/macho_module.c
+33
-1
No files found.
dlls/dbghelp/macho_module.c
View file @
e1064850
...
@@ -206,6 +206,18 @@ static char* format_uuid(const UINT8 uuid[16], char out[UUID_STRING_LEN])
...
@@ -206,6 +206,18 @@ static char* format_uuid(const UINT8 uuid[16], char out[UUID_STRING_LEN])
return
out
;
return
out
;
}
}
static
USHORT
macho_cpu_to_machine
(
unsigned
cpu
)
{
switch
(
cpu
)
{
case
MACHO_CPU_TYPE_X86
:
return
IMAGE_FILE_MACHINE_I386
;
case
MACHO_CPU_TYPE_X86_64
:
return
IMAGE_FILE_MACHINE_AMD64
;
default:
FIXME
(
"Untranslated Mach-O CPU %x
\n
"
,
cpu
);
return
IMAGE_FILE_MACHINE_UNKNOWN
;
}
}
/******************************************************************
/******************************************************************
* macho_calc_range
* macho_calc_range
*
*
...
@@ -1355,6 +1367,26 @@ static BOOL image_uses_split_segs(struct process* process, ULONG_PTR load_addr)
...
@@ -1355,6 +1367,26 @@ static BOOL image_uses_split_segs(struct process* process, ULONG_PTR load_addr)
}
}
/******************************************************************
/******************************************************************
* image_get_machine
*
* For a module identified by its load address, return the machine field
* of the (loaded) Macho header.
*/
static
USHORT
image_get_machine
(
struct
process
*
process
,
ULONG_PTR
load_addr
)
{
if
(
load_addr
)
{
struct
macho_header
header
;
UINT32
target_magic
=
(
process
->
is_host_64bit
)
?
MACHO_MH_MAGIC_64
:
MACHO_MH_MAGIC_32
;
if
(
read_process_memory
(
process
,
load_addr
,
&
header
,
FIELD_OFFSET
(
struct
macho_header
,
reserved
))
&&
header
.
magic
==
target_magic
)
return
macho_cpu_to_machine
(
header
.
cputype
);
}
return
IMAGE_FILE_MACHINE_UNKNOWN
;
}
/******************************************************************
* macho_load_debug_info
* macho_load_debug_info
*
*
* Loads Mach-O debugging information from the module image file.
* Loads Mach-O debugging information from the module image file.
...
@@ -1479,7 +1511,7 @@ static BOOL macho_load_file(struct process* pcs, const WCHAR* filename,
...
@@ -1479,7 +1511,7 @@ static BOOL macho_load_file(struct process* pcs, const WCHAR* filename,
load_addr
=
fmap
.
u
.
macho
.
segs_start
;
load_addr
=
fmap
.
u
.
macho
.
segs_start
;
macho_info
->
module
=
module_new
(
pcs
,
filename
,
DMT_MACHO
,
FALSE
,
load_addr
,
macho_info
->
module
=
module_new
(
pcs
,
filename
,
DMT_MACHO
,
FALSE
,
load_addr
,
fmap
.
u
.
macho
.
segs_size
,
0
,
calc_crc32
(
fmap
.
u
.
macho
.
handle
),
fmap
.
u
.
macho
.
segs_size
,
0
,
calc_crc32
(
fmap
.
u
.
macho
.
handle
),
IMAGE_FILE_MACHINE_UNKNOWN
);
image_get_machine
(
pcs
,
load_addr
)
);
if
(
!
macho_info
->
module
)
if
(
!
macho_info
->
module
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
modfmt
);
HeapFree
(
GetProcessHeap
(),
0
,
modfmt
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment