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
8740f1dc
Commit
8740f1dc
authored
Dec 27, 2010
by
Eric Pouech
Committed by
Alexandre Julliard
Dec 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Factorize a bit the ELF enumeration callbacks.
parent
12880784
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
62 deletions
+56
-62
elf_module.c
dlls/dbghelp/elf_module.c
+56
-62
No files found.
dlls/dbghelp/elf_module.c
View file @
8740f1dc
...
...
@@ -1279,65 +1279,6 @@ static BOOL elf_enum_modules_internal(const struct process* pcs,
return
TRUE
;
}
struct
elf_sync
{
struct
process
*
pcs
;
struct
elf_info
elf_info
;
};
static
BOOL
elf_enum_sync_cb
(
const
WCHAR
*
name
,
unsigned
long
load_addr
,
unsigned
long
dyn_addr
,
void
*
user
)
{
struct
elf_sync
*
es
=
user
;
elf_search_and_load_file
(
es
->
pcs
,
name
,
load_addr
,
dyn_addr
,
&
es
->
elf_info
);
return
TRUE
;
}
/******************************************************************
* elf_synchronize_module_list
*
* this functions rescans the debuggee module's list and synchronizes it with
* the one from 'pcs', ie:
* - if a module is in debuggee and not in pcs, it's loaded into pcs
* - if a module is in pcs and not in debuggee, it's unloaded from pcs
*/
BOOL
elf_synchronize_module_list
(
struct
process
*
pcs
)
{
struct
module
*
module
;
struct
elf_sync
es
;
for
(
module
=
pcs
->
lmodules
;
module
;
module
=
module
->
next
)
{
if
(
module
->
type
==
DMT_ELF
&&
!
module
->
is_virtual
)
module
->
format_info
[
DFI_ELF
]
->
u
.
elf_info
->
elf_mark
=
0
;
}
es
.
pcs
=
pcs
;
es
.
elf_info
.
flags
=
ELF_INFO_MODULE
;
if
(
!
elf_enum_modules_internal
(
pcs
,
NULL
,
elf_enum_sync_cb
,
&
es
))
return
FALSE
;
module
=
pcs
->
lmodules
;
while
(
module
)
{
if
(
module
->
type
==
DMT_ELF
&&
!
module
->
is_virtual
)
{
struct
elf_module_info
*
elf_info
=
module
->
format_info
[
DFI_ELF
]
->
u
.
elf_info
;
if
(
!
elf_info
->
elf_mark
&&
!
elf_info
->
elf_loader
)
{
module_remove
(
pcs
,
module
);
/* restart all over */
module
=
pcs
->
lmodules
;
continue
;
}
}
module
=
module
->
next
;
}
return
TRUE
;
}
/******************************************************************
* elf_search_loader
*
...
...
@@ -1440,19 +1381,25 @@ static BOOL elf_load_cb(const WCHAR* name, unsigned long load_addr,
unsigned
long
dyn_addr
,
void
*
user
)
{
struct
elf_load
*
el
=
user
;
BOOL
ret
=
TRUE
;
const
WCHAR
*
p
;
if
(
el
->
name
)
{
/* memcmp is needed for matches when bufstr contains also version information
* el->name: libc.so, name: libc.so.6.0
*/
p
=
strrchrW
(
name
,
'/'
);
if
(
!
p
++
)
p
=
name
;
if
(
!
memcmp
(
p
,
el
->
name
,
lstrlenW
(
el
->
name
)
*
sizeof
(
WCHAR
)))
}
if
(
!
el
->
name
||
!
memcmp
(
p
,
el
->
name
,
lstrlenW
(
el
->
name
)
*
sizeof
(
WCHAR
)))
{
el
->
ret
=
elf_search_and_load_file
(
el
->
pcs
,
name
,
load_addr
,
dyn_addr
,
&
el
->
elf_info
);
return
FALSE
;
if
(
el
->
name
)
ret
=
FALSE
;
}
return
TRUE
;
return
ret
;
}
/******************************************************************
...
...
@@ -1494,6 +1441,53 @@ struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned
return
el
.
elf_info
.
module
;
}
/******************************************************************
* elf_synchronize_module_list
*
* this functions rescans the debuggee module's list and synchronizes it with
* the one from 'pcs', ie:
* - if a module is in debuggee and not in pcs, it's loaded into pcs
* - if a module is in pcs and not in debuggee, it's unloaded from pcs
*/
BOOL
elf_synchronize_module_list
(
struct
process
*
pcs
)
{
struct
module
*
module
;
struct
elf_load
el
;
for
(
module
=
pcs
->
lmodules
;
module
;
module
=
module
->
next
)
{
if
(
module
->
type
==
DMT_ELF
&&
!
module
->
is_virtual
)
module
->
format_info
[
DFI_ELF
]
->
u
.
elf_info
->
elf_mark
=
0
;
}
el
.
pcs
=
pcs
;
el
.
elf_info
.
flags
=
ELF_INFO_MODULE
;
el
.
ret
=
FALSE
;
el
.
name
=
NULL
;
/* fetch all modules */
if
(
!
elf_enum_modules_internal
(
pcs
,
NULL
,
elf_load_cb
,
&
el
))
return
FALSE
;
module
=
pcs
->
lmodules
;
while
(
module
)
{
if
(
module
->
type
==
DMT_ELF
&&
!
module
->
is_virtual
)
{
struct
elf_module_info
*
elf_info
=
module
->
format_info
[
DFI_ELF
]
->
u
.
elf_info
;
if
(
!
elf_info
->
elf_mark
&&
!
elf_info
->
elf_loader
)
{
module_remove
(
pcs
,
module
);
/* restart all over */
module
=
pcs
->
lmodules
;
continue
;
}
}
module
=
module
->
next
;
}
return
TRUE
;
}
#else
/* !__ELF__ */
BOOL
elf_find_section
(
struct
image_file_map
*
fmap
,
const
char
*
name
,
...
...
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