Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
72545794
Commit
72545794
authored
Apr 01, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Don't store entire mach header in image_file_map.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9d797464
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
image_private.h
dlls/dbghelp/image_private.h
+3
-2
macho_module.c
dlls/dbghelp/macho_module.c
+11
-9
No files found.
dlls/dbghelp/image_private.h
View file @
72545794
...
...
@@ -94,10 +94,11 @@ struct image_file_map
size_t
segs_start
;
HANDLE
handle
;
struct
image_file_map
*
dsym
;
/* the debug symbols file associated with this one */
size_t
header_size
;
/* size of real header in file */
size_t
commands_size
;
size_t
commands_count
;
#ifdef HAVE_MACH_O_LOADER_H
struct
mach_header
mach_header
;
size_t
header_size
;
/* size of real header in file */
const
struct
load_command
*
load_commands
;
const
struct
uuid_command
*
uuid
;
...
...
dlls/dbghelp/macho_module.c
View file @
72545794
...
...
@@ -448,7 +448,7 @@ static const struct load_command* macho_map_load_commands(struct macho_file_map*
if
(
fmap
->
load_commands
==
IMAGE_NO_MAP
)
{
fmap
->
load_commands
=
(
const
struct
load_command
*
)
macho_map_range
(
fmap
,
fmap
->
header_size
,
fmap
->
mach_header
.
sizeofcmds
,
NULL
);
fmap
,
fmap
->
header_size
,
fmap
->
commands_size
,
NULL
);
TRACE
(
"Mapped load commands: %p
\n
"
,
fmap
->
load_commands
);
}
...
...
@@ -466,7 +466,7 @@ static void macho_unmap_load_commands(struct macho_file_map* fmap)
{
TRACE
(
"Unmapping load commands: %p
\n
"
,
fmap
->
load_commands
);
macho_unmap_range
(
NULL
,
(
const
void
**
)
&
fmap
->
load_commands
,
fmap
,
fmap
->
header_size
,
fmap
->
mach_header
.
sizeofcmds
);
fmap
->
header_size
,
fmap
->
commands_size
);
}
}
...
...
@@ -504,9 +504,9 @@ static int macho_enum_load_commands(struct image_file_map *ifm, unsigned cmd,
if
((
lc
=
macho_map_load_commands
(
fmap
))
==
IMAGE_NO_MAP
)
return
-
1
;
TRACE
(
"%
d total commands
\n
"
,
fmap
->
mach_header
.
ncmds
);
TRACE
(
"%
lu total commands
\n
"
,
fmap
->
commands_count
);
for
(
i
=
0
;
i
<
fmap
->
mach_header
.
ncmds
;
i
++
,
lc
=
macho_next_load_command
(
lc
))
for
(
i
=
0
;
i
<
fmap
->
commands_count
;
i
++
,
lc
=
macho_next_load_command
(
lc
))
{
int
result
;
...
...
@@ -683,6 +683,7 @@ static BOOL macho_map_file(struct process *pcs, const WCHAR *filenameW,
{
struct
macho_file_map
*
fmap
=
&
ifm
->
u
.
macho
;
struct
fat_header
fat_header
;
struct
mach_header
mach_header
;
int
i
;
WCHAR
*
filename
;
struct
section_info
info
;
...
...
@@ -745,15 +746,16 @@ static BOOL macho_map_file(struct process *pcs, const WCHAR *filenameW,
/* Individual architecture (standalone or within a fat file) is in its native byte order. */
SetFilePointer
(
fmap
->
handle
,
fmap
->
arch_offset
,
0
,
FILE_BEGIN
);
if
(
!
ReadFile
(
fmap
->
handle
,
&
fmap
->
mach_header
,
sizeof
(
fmap
->
mach_header
),
&
bytes_read
,
NULL
)
||
bytes_read
!=
sizeof
(
fmap
->
mach_header
))
if
(
!
ReadFile
(
fmap
->
handle
,
&
mach_header
,
sizeof
(
mach_header
),
&
bytes_read
,
NULL
)
||
bytes_read
!=
sizeof
(
mach_header
))
goto
done
;
TRACE
(
"... got possible Mach header
\n
"
);
/* and check for a Mach-O header */
if
(
fmap
->
mach_header
.
magic
!=
target_magic
||
fmap
->
mach_header
.
cputype
!=
target_cpu
)
goto
done
;
if
(
mach_header
.
magic
!=
target_magic
||
mach_header
.
cputype
!=
target_cpu
)
goto
done
;
fmap
->
commands_size
=
mach_header
.
sizeofcmds
;
fmap
->
commands_count
=
mach_header
.
ncmds
;
/* Make sure the file type is one of the ones we expect. */
switch
(
fmap
->
mach_header
.
filetype
)
switch
(
mach_header
.
filetype
)
{
case
MH_EXECUTE
:
case
MH_DYLIB
:
...
...
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