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
1b158dd3
Commit
1b158dd3
authored
Jan 06, 2007
by
Eric Pouech
Committed by
Alexandre Julliard
Jan 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Corrected the map/unmap operations for ELF sections.
Now correctly free the mapped areas when no longer used.
parent
c3bf8b88
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
elf_module.c
dlls/dbghelp/elf_module.c
+11
-4
No files found.
dlls/dbghelp/elf_module.c
View file @
1b158dd3
...
@@ -147,8 +147,8 @@ static const char* elf_map_section(struct elf_file_map* fmap, int sidx)
...
@@ -147,8 +147,8 @@ static const char* elf_map_section(struct elf_file_map* fmap, int sidx)
return
ELF_NO_MAP
;
return
ELF_NO_MAP
;
/* align required information on page size (we assume pagesize is a power of 2) */
/* align required information on page size (we assume pagesize is a power of 2) */
ofst
=
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
&
~
(
pgsz
-
1
);
ofst
=
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
&
~
(
pgsz
-
1
);
size
=
(
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
+
size
=
(
(
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
+
fmap
->
sect
[
sidx
].
shdr
.
sh_size
+
pgsz
-
1
)
&
~
(
pgsz
-
1
)
;
fmap
->
sect
[
sidx
].
shdr
.
sh_size
+
pgsz
-
1
)
&
~
(
pgsz
-
1
))
-
ofst
;
fmap
->
sect
[
sidx
].
mapped
=
mmap
(
NULL
,
size
,
PROT_READ
,
MAP_PRIVATE
,
fmap
->
fd
,
ofst
);
fmap
->
sect
[
sidx
].
mapped
=
mmap
(
NULL
,
size
,
PROT_READ
,
MAP_PRIVATE
,
fmap
->
fd
,
ofst
);
if
(
fmap
->
sect
[
sidx
].
mapped
==
ELF_NO_MAP
)
return
ELF_NO_MAP
;
if
(
fmap
->
sect
[
sidx
].
mapped
==
ELF_NO_MAP
)
return
ELF_NO_MAP
;
return
fmap
->
sect
[
sidx
].
mapped
+
(
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
&
(
pgsz
-
1
));
return
fmap
->
sect
[
sidx
].
mapped
+
(
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
&
(
pgsz
-
1
));
...
@@ -163,7 +163,14 @@ static void elf_unmap_section(struct elf_file_map* fmap, int sidx)
...
@@ -163,7 +163,14 @@ static void elf_unmap_section(struct elf_file_map* fmap, int sidx)
{
{
if
(
sidx
>=
0
&&
sidx
<
fmap
->
elfhdr
.
e_shnum
&&
fmap
->
sect
[
sidx
].
mapped
!=
ELF_NO_MAP
)
if
(
sidx
>=
0
&&
sidx
<
fmap
->
elfhdr
.
e_shnum
&&
fmap
->
sect
[
sidx
].
mapped
!=
ELF_NO_MAP
)
{
{
munmap
((
char
*
)
fmap
->
sect
[
sidx
].
mapped
,
fmap
->
sect
[
sidx
].
shdr
.
sh_size
);
unsigned
pgsz
=
getpagesize
();
unsigned
ofst
,
size
;
ofst
=
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
&
~
(
pgsz
-
1
);
size
=
((
fmap
->
sect
[
sidx
].
shdr
.
sh_offset
+
fmap
->
sect
[
sidx
].
shdr
.
sh_size
+
pgsz
-
1
)
&
~
(
pgsz
-
1
))
-
ofst
;
if
(
munmap
((
char
*
)
fmap
->
sect
[
sidx
].
mapped
,
size
)
<
0
)
WARN
(
"Couldn't unmap the section
\n
"
);
fmap
->
sect
[
sidx
].
mapped
=
ELF_NO_MAP
;
fmap
->
sect
[
sidx
].
mapped
=
ELF_NO_MAP
;
}
}
}
}
...
@@ -957,11 +964,11 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
...
@@ -957,11 +964,11 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
else
else
WARN
(
"Couldn't load debug information from %s
\n
"
,
dbg_link
);
WARN
(
"Couldn't load debug information from %s
\n
"
,
dbg_link
);
ret
=
ret
||
lret
;
ret
=
ret
||
lret
;
elf_unmap_file
(
&
fmap_link
);
}
}
else
else
WARN
(
"Couldn't load linked debug file for %s
\n
"
,
WARN
(
"Couldn't load linked debug file for %s
\n
"
,
module
->
module
.
ModuleName
);
module
->
module
.
ModuleName
);
elf_unmap_file
(
&
fmap_link
);
}
}
}
}
if
(
strstr
(
module
->
module
.
ModuleName
,
"<elf>"
)
||
if
(
strstr
(
module
->
module
.
ModuleName
,
"<elf>"
)
||
...
...
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