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
fc66bb37
Commit
fc66bb37
authored
Feb 24, 2007
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Allow to add an alternate file_map for an ELF file (where to look for…
dbghelp: Allow to add an alternate file_map for an ELF file (where to look for its debug information).
parent
62b57f9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
22 deletions
+38
-22
elf_module.c
dlls/dbghelp/elf_module.c
+38
-22
No files found.
dlls/dbghelp/elf_module.c
View file @
fc66bb37
...
...
@@ -115,6 +115,7 @@ struct elf_file_map
unsigned
with_crc
;
unsigned
long
crc
;
const
char
*
shstrtab
;
struct
elf_file_map
*
alternate
;
/* another ELF file (linked to this one) */
};
struct
elf_section_map
...
...
@@ -167,27 +168,32 @@ static const char* elf_map_section(struct elf_section_map* esm)
* elf_find_section
*
* Finds a section by name (and type) into memory from an ELF file
* or its alternate if any
*/
static
BOOL
elf_find_section
(
struct
elf_file_map
*
fmap
,
const
char
*
name
,
unsigned
sht
,
struct
elf_section_map
*
esm
)
{
unsigned
i
;
if
(
fmap
->
shstrtab
==
ELF_NO_MAP
)
while
(
fmap
)
{
struct
elf_section_map
hdr_esm
=
{
fmap
,
fmap
->
elfhdr
.
e_shstrndx
};
fmap
->
shstrtab
=
elf_map_section
(
&
hdr_esm
);
if
(
fmap
->
shstrtab
==
ELF_NO_MAP
)
return
FALSE
;
}
for
(
i
=
0
;
i
<
fmap
->
elfhdr
.
e_shnum
;
i
++
)
{
if
(
strcmp
(
fmap
->
shstrtab
+
fmap
->
sect
[
i
].
shdr
.
sh_name
,
name
)
==
0
&&
(
sht
==
SHT_NULL
||
sht
==
fmap
->
sect
[
i
].
shdr
.
sh_type
))
if
(
fmap
->
shstrtab
==
ELF_NO_MAP
)
{
struct
elf_section_map
hdr_esm
=
{
fmap
,
fmap
->
elfhdr
.
e_shstrndx
};
fmap
->
shstrtab
=
elf_map_section
(
&
hdr_esm
);
if
(
fmap
->
shstrtab
==
ELF_NO_MAP
)
return
FALSE
;
}
for
(
i
=
0
;
i
<
fmap
->
elfhdr
.
e_shnum
;
i
++
)
{
esm
->
fmap
=
fmap
;
esm
->
sidx
=
i
;
return
TRUE
;
if
(
strcmp
(
fmap
->
shstrtab
+
fmap
->
sect
[
i
].
shdr
.
sh_name
,
name
)
==
0
&&
(
sht
==
SHT_NULL
||
sht
==
fmap
->
sect
[
i
].
shdr
.
sh_type
))
{
esm
->
fmap
=
fmap
;
esm
->
sidx
=
i
;
return
TRUE
;
}
}
fmap
=
fmap
->
alternate
;
}
return
FALSE
;
}
...
...
@@ -217,9 +223,14 @@ static void elf_end_find(struct elf_file_map* fmap)
{
struct
elf_section_map
esm
;
esm
.
fmap
=
fmap
;
esm
.
sidx
=
fmap
->
elfhdr
.
e_shstrndx
;
elf_unmap_section
(
&
esm
);
fmap
->
shstrtab
=
ELF_NO_MAP
;
while
(
fmap
)
{
esm
.
fmap
=
fmap
;
esm
.
sidx
=
fmap
->
elfhdr
.
e_shstrndx
;
elf_unmap_section
(
&
esm
);
fmap
->
shstrtab
=
ELF_NO_MAP
;
fmap
=
fmap
->
alternate
;
}
}
/******************************************************************
...
...
@@ -257,6 +268,7 @@ static BOOL elf_map_file(const WCHAR* filenameW, struct elf_file_map* fmap)
fmap
->
fd
=
-
1
;
fmap
->
with_crc
=
0
;
fmap
->
shstrtab
=
ELF_NO_MAP
;
fmap
->
alternate
=
NULL
;
/* check that the file exists, and that the module hasn't been loaded yet */
if
(
stat
(
filename
,
&
statbuf
)
==
-
1
||
S_ISDIR
(
statbuf
.
st_mode
))
goto
done
;
...
...
@@ -312,16 +324,20 @@ done:
*/
static
void
elf_unmap_file
(
struct
elf_file_map
*
fmap
)
{
if
(
fmap
->
fd
!=
-
1
)
while
(
fmap
)
{
struct
elf_section_map
esm
;
esm
.
fmap
=
fmap
;
for
(
esm
.
sidx
=
0
;
esm
.
sidx
<
fmap
->
elfhdr
.
e_shnum
;
esm
.
sidx
++
)
if
(
fmap
->
fd
!=
-
1
)
{
elf_unmap_section
(
&
esm
);
struct
elf_section_map
esm
;
esm
.
fmap
=
fmap
;
for
(
esm
.
sidx
=
0
;
esm
.
sidx
<
fmap
->
elfhdr
.
e_shnum
;
esm
.
sidx
++
)
{
elf_unmap_section
(
&
esm
);
}
HeapFree
(
GetProcessHeap
(),
0
,
fmap
->
sect
);
close
(
fmap
->
fd
);
}
HeapFree
(
GetProcessHeap
(),
0
,
fmap
->
sect
);
close
(
fmap
->
fd
);
fmap
=
fmap
->
alternate
;
}
}
...
...
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