Jacek Caban : dbghelp: Use loader_ops for enum_modules.
Alexandre Julliard
julliard at winehq.org
Wed Mar 25 17:07:29 CDT 2020
Module: wine
Branch: master
Commit: 16a3481bd22243183281c60ff375d4e61d5c4198
URL: https://source.winehq.org/git/wine.git/?a=commit;h=16a3481bd22243183281c60ff375d4e61d5c4198
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 25 17:40:45 2020 +0100
dbghelp: Use loader_ops for enum_modules.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/dbghelp_private.h | 9 ++++-----
dlls/dbghelp/elf_module.c | 8 ++------
dlls/dbghelp/macho_module.c | 8 ++------
dlls/dbghelp/minidump.c | 6 +-----
dlls/dbghelp/module.c | 6 ++++++
5 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index a9138227ea..3f2596fa10 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -387,9 +387,12 @@ struct module
struct wine_rb_tree sources_offsets_tree;
};
+typedef BOOL (*enum_modules_cb)(const WCHAR*, unsigned long addr, void* user);
+
struct loader_ops
{
BOOL (*synchronize_module_list)(struct process* process);
+ BOOL (*enum_modules)(struct process* process, enum_modules_cb callback, void* user);
BOOL (*fetch_file_info)(struct process* process, const WCHAR* name, ULONG_PTR load_addr, DWORD_PTR* base, DWORD* size, DWORD* checksum);
};
@@ -598,11 +601,7 @@ extern const char* wine_dbgstr_addr(const ADDRESS64* addr) DECLSPEC_HIDDEN;
extern struct cpu* cpu_find(DWORD) DECLSPEC_HIDDEN;
extern DWORD calc_crc32(HANDLE handle) DECLSPEC_HIDDEN;
-typedef BOOL (*enum_modules_cb)(const WCHAR*, unsigned long addr, void* user);
-
/* elf_module.c */
-extern BOOL elf_enum_modules(struct process*, enum_modules_cb, void*) DECLSPEC_HIDDEN;
-struct image_file_map;
extern BOOL elf_load_debug_info(struct module* module) DECLSPEC_HIDDEN;
extern struct module*
elf_load_module(struct process* pcs, const WCHAR* name, unsigned long) DECLSPEC_HIDDEN;
@@ -611,7 +610,6 @@ struct elf_thunk_area;
extern int elf_is_in_thunk_area(unsigned long addr, const struct elf_thunk_area* thunks) DECLSPEC_HIDDEN;
/* macho_module.c */
-extern BOOL macho_enum_modules(struct process*, enum_modules_cb, void*) DECLSPEC_HIDDEN;
extern BOOL macho_load_debug_info(struct process *pcs, struct module* module) DECLSPEC_HIDDEN;
extern struct module*
macho_load_module(struct process* pcs, const WCHAR* name, unsigned long) DECLSPEC_HIDDEN;
@@ -707,6 +705,7 @@ extern BOOL stabs_parse(struct module* module, unsigned long load_offset
stabs_def_cb callback, void* user) DECLSPEC_HIDDEN;
/* dwarf.c */
+struct image_file_map;
extern BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
const struct elf_thunk_area* thunks,
struct image_file_map* fmap) DECLSPEC_HIDDEN;
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index dba4573afe..64c550a67b 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -1502,7 +1502,7 @@ static BOOL elf_enum_modules_translate(const WCHAR* name, unsigned long load_add
* This function doesn't require that someone has called SymInitialize
* on this very process.
*/
-BOOL elf_enum_modules(struct process* process, enum_modules_cb cb, void* user)
+static BOOL elf_enum_modules(struct process* process, enum_modules_cb cb, void* user)
{
struct elf_info elf_info;
BOOL ret;
@@ -1706,6 +1706,7 @@ static BOOL elf_search_loader(struct process* pcs, struct elf_info* elf_info)
static const struct loader_ops elf_loader_ops =
{
elf_synchronize_module_list,
+ elf_enum_modules,
elf_fetch_file_info,
};
@@ -1739,11 +1740,6 @@ BOOL elf_read_wine_loader_dbg_info(struct process* pcs)
return FALSE;
}
-BOOL elf_enum_modules(struct process *process, enum_modules_cb cb, void* user)
-{
- return FALSE;
-}
-
struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned long addr)
{
return NULL;
diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 73d0575a4b..df38129e12 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -1730,7 +1730,7 @@ static BOOL macho_synchronize_module_list(struct process* pcs)
* This function doesn't require that someone has called SymInitialize
* on this very process.
*/
-BOOL macho_enum_modules(struct process* process, enum_modules_cb cb, void* user)
+static BOOL macho_enum_modules(struct process* process, enum_modules_cb cb, void* user)
{
struct macho_info macho_info;
BOOL ret;
@@ -1906,6 +1906,7 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in
static const struct loader_ops macho_loader_ops =
{
macho_synchronize_module_list,
+ macho_enum_modules,
macho_fetch_file_info,
};
@@ -1935,11 +1936,6 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs)
return FALSE;
}
-BOOL macho_enum_modules(struct process *process, enum_modules_cb cb, void* user)
-{
- return FALSE;
-}
-
struct module* macho_load_module(struct process* pcs, const WCHAR* name, unsigned long addr)
{
return NULL;
diff --git a/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c
index 82516bf60c..4a79bb9944 100644
--- a/dlls/dbghelp/minidump.c
+++ b/dlls/dbghelp/minidump.c
@@ -320,11 +320,7 @@ static void fetch_modules_info(struct dump_context* dc)
* And it's always a good idea to have a trace of the loaded ELF modules for
* a given application in a post mortem debugging condition.
*/
- if (dc->process->dbg_hdr_addr)
- {
- elf_enum_modules(dc->process, fetch_host_module_info_cb, dc);
- macho_enum_modules(dc->process, fetch_host_module_info_cb, dc);
- }
+ dc->process->loader->enum_modules(dc->process, fetch_host_module_info_cb, dc);
}
static void fetch_module_versioninfo(LPCWSTR filename, VS_FIXEDFILEINFO* ffi)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index 59c0a3c56c..b8ac41f008 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -1431,6 +1431,11 @@ static BOOL native_synchronize_module_list(struct process* pcs)
return FALSE;
}
+static BOOL native_enum_modules(struct process *process, enum_modules_cb cb, void* user)
+{
+ return FALSE;
+}
+
static BOOL native_fetch_file_info(struct process* process, const WCHAR* name, ULONG_PTR load_addr, DWORD_PTR* base,
DWORD* size, DWORD* checksum)
{
@@ -1440,5 +1445,6 @@ static BOOL native_fetch_file_info(struct process* process, const WCHAR* name, U
const struct loader_ops no_loader_ops =
{
native_synchronize_module_list,
+ native_enum_modules,
native_fetch_file_info,
};
More information about the wine-cvs
mailing list