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
d4104e85
Commit
d4104e85
authored
Oct 09, 2023
by
Eric Pouech
Committed by
Alexandre Julliard
Oct 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Simplified module_find_by_addr().
Signed-off-by:
Eric Pouech
<
epouech@codeweavers.com
>
parent
e1064850
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
29 deletions
+23
-29
cpu_x86_64.c
dlls/dbghelp/cpu_x86_64.c
+1
-1
dbghelp_private.h
dlls/dbghelp/dbghelp_private.h
+1
-3
module.c
dlls/dbghelp/module.c
+17
-21
source.c
dlls/dbghelp/source.c
+1
-1
symbol.c
dlls/dbghelp/symbol.c
+3
-3
No files found.
dlls/dbghelp/cpu_x86_64.c
View file @
d4104e85
...
@@ -962,7 +962,7 @@ static BOOL x86_64_fetch_minidump_module(struct dump_context* dc, unsigned index
...
@@ -962,7 +962,7 @@ static BOOL x86_64_fetch_minidump_module(struct dump_context* dc, unsigned index
ULONG
size
;
ULONG
size
;
if
(
!
(
pcs
=
process_find_by_handle
(
dc
->
process
->
handle
))
||
if
(
!
(
pcs
=
process_find_by_handle
(
dc
->
process
->
handle
))
||
!
(
module
=
module_find_by_addr
(
pcs
,
dc
->
modules
[
index
].
base
,
DMT_UNKNOWN
)))
!
(
module
=
module_find_by_addr
(
pcs
,
dc
->
modules
[
index
].
base
)))
return
FALSE
;
return
FALSE
;
rtf
=
(
const
RUNTIME_FUNCTION
*
)
pe_map_directory
(
module
,
IMAGE_DIRECTORY_ENTRY_EXCEPTION
,
&
size
);
rtf
=
(
const
RUNTIME_FUNCTION
*
)
pe_map_directory
(
module
,
IMAGE_DIRECTORY_ENTRY_EXCEPTION
,
&
size
);
if
(
rtf
)
if
(
rtf
)
...
...
dlls/dbghelp/dbghelp_private.h
View file @
d4104e85
...
@@ -398,7 +398,6 @@ struct symt_udt
...
@@ -398,7 +398,6 @@ struct symt_udt
enum
module_type
enum
module_type
{
{
DMT_UNKNOWN
,
/* for lookup, not actually used for a module */
DMT_ELF
,
/* a real ELF shared module */
DMT_ELF
,
/* a real ELF shared module */
DMT_PE
,
/* a native or builtin PE module */
DMT_PE
,
/* a native or builtin PE module */
DMT_MACHO
,
/* a real Mach-O shared module */
DMT_MACHO
,
/* a real Mach-O shared module */
...
@@ -732,8 +731,7 @@ extern const struct loader_ops empty_loader_ops DECLSPEC_HIDDEN;
...
@@ -732,8 +731,7 @@ extern const struct loader_ops empty_loader_ops DECLSPEC_HIDDEN;
extern
BOOL
module_init_pair
(
struct
module_pair
*
pair
,
HANDLE
hProcess
,
extern
BOOL
module_init_pair
(
struct
module_pair
*
pair
,
HANDLE
hProcess
,
DWORD64
addr
)
DECLSPEC_HIDDEN
;
DWORD64
addr
)
DECLSPEC_HIDDEN
;
extern
struct
module
*
extern
struct
module
*
module_find_by_addr
(
const
struct
process
*
pcs
,
DWORD64
addr
,
module_find_by_addr
(
const
struct
process
*
pcs
,
DWORD64
addr
)
DECLSPEC_HIDDEN
;
enum
module_type
type
)
DECLSPEC_HIDDEN
;
extern
struct
module
*
extern
struct
module
*
module_find_by_nameW
(
const
struct
process
*
pcs
,
module_find_by_nameW
(
const
struct
process
*
pcs
,
const
WCHAR
*
name
)
DECLSPEC_HIDDEN
;
const
WCHAR
*
name
)
DECLSPEC_HIDDEN
;
...
...
dlls/dbghelp/module.c
View file @
d4104e85
...
@@ -262,7 +262,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
...
@@ -262,7 +262,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
BOOL
module_init_pair
(
struct
module_pair
*
pair
,
HANDLE
hProcess
,
DWORD64
addr
)
BOOL
module_init_pair
(
struct
module_pair
*
pair
,
HANDLE
hProcess
,
DWORD64
addr
)
{
{
if
(
!
(
pair
->
pcs
=
process_find_by_handle
(
hProcess
)))
return
FALSE
;
if
(
!
(
pair
->
pcs
=
process_find_by_handle
(
hProcess
)))
return
FALSE
;
pair
->
requested
=
module_find_by_addr
(
pair
->
pcs
,
addr
,
DMT_UNKNOWN
);
pair
->
requested
=
module_find_by_addr
(
pair
->
pcs
,
addr
);
return
module_get_debug
(
pair
);
return
module_get_debug
(
pair
);
}
}
...
@@ -413,29 +413,25 @@ BOOL module_get_debug(struct module_pair* pair)
...
@@ -413,29 +413,25 @@ BOOL module_get_debug(struct module_pair* pair)
/***********************************************************************
/***********************************************************************
* module_find_by_addr
* module_find_by_addr
*
*
* either the addr where module is loaded, or any address inside the
* either the addr where module is loaded, or any address inside the
* module
* module
*/
*/
struct
module
*
module_find_by_addr
(
const
struct
process
*
pcs
,
DWORD64
addr
,
struct
module
*
module_find_by_addr
(
const
struct
process
*
pcs
,
DWORD64
addr
)
enum
module_type
type
)
{
{
struct
module
*
module
;
struct
module
*
module
;
if
(
type
==
DMT_UNKNOWN
)
for
(
module
=
pcs
->
lmodules
;
module
;
module
=
module
->
next
)
{
{
if
((
module
=
module_find_by_addr
(
pcs
,
addr
,
DMT_PE
))
||
if
(
module
->
type
==
DMT_PE
&&
addr
>=
module
->
module
.
BaseOfImage
&&
(
module
=
module_find_by_addr
(
pcs
,
addr
,
DMT_ELF
))
||
addr
<
module
->
module
.
BaseOfImage
+
module
->
module
.
ImageSize
)
(
module
=
module_find_by_addr
(
pcs
,
addr
,
DMT_MACHO
)))
return
module
;
return
module
;
}
}
else
for
(
module
=
pcs
->
lmodules
;
module
;
module
=
module
->
next
)
{
{
for
(
module
=
pcs
->
lmodules
;
module
;
module
=
module
->
next
)
if
((
module
->
type
==
DMT_ELF
||
module
->
type
==
DMT_MACHO
)
&&
{
addr
>=
module
->
module
.
BaseOfImage
&&
if
(
type
==
module
->
type
&&
addr
>=
module
->
module
.
BaseOfImage
&&
addr
<
module
->
module
.
BaseOfImage
+
module
->
module
.
ImageSize
)
addr
<
module
->
module
.
BaseOfImage
+
module
->
module
.
ImageSize
)
return
module
;
return
module
;
}
}
}
SetLastError
(
ERROR_MOD_NOT_FOUND
);
SetLastError
(
ERROR_MOD_NOT_FOUND
);
return
module
;
return
module
;
...
@@ -1094,7 +1090,7 @@ BOOL WINAPI SymUnloadModule64(HANDLE hProcess, DWORD64 BaseOfDll)
...
@@ -1094,7 +1090,7 @@ BOOL WINAPI SymUnloadModule64(HANDLE hProcess, DWORD64 BaseOfDll)
pcs
=
process_find_by_handle
(
hProcess
);
pcs
=
process_find_by_handle
(
hProcess
);
if
(
!
pcs
)
return
FALSE
;
if
(
!
pcs
)
return
FALSE
;
module
=
module_find_by_addr
(
pcs
,
BaseOfDll
,
DMT_UNKNOWN
);
module
=
module_find_by_addr
(
pcs
,
BaseOfDll
);
if
(
!
module
)
return
FALSE
;
if
(
!
module
)
return
FALSE
;
module_remove
(
pcs
,
module
);
module_remove
(
pcs
,
module
);
return
TRUE
;
return
TRUE
;
...
@@ -1498,7 +1494,7 @@ BOOL WINAPI SymGetModuleInfoW64(HANDLE hProcess, DWORD64 dwAddr,
...
@@ -1498,7 +1494,7 @@ BOOL WINAPI SymGetModuleInfoW64(HANDLE hProcess, DWORD64 dwAddr,
if
(
!
pcs
)
return
FALSE
;
if
(
!
pcs
)
return
FALSE
;
if
(
ModuleInfo
->
SizeOfStruct
>
sizeof
(
*
ModuleInfo
))
return
FALSE
;
if
(
ModuleInfo
->
SizeOfStruct
>
sizeof
(
*
ModuleInfo
))
return
FALSE
;
module
=
module_find_by_addr
(
pcs
,
dwAddr
,
DMT_UNKNOWN
);
module
=
module_find_by_addr
(
pcs
,
dwAddr
);
if
(
!
module
)
return
FALSE
;
if
(
!
module
)
return
FALSE
;
miw64
=
module
->
module
;
miw64
=
module
->
module
;
...
@@ -1537,7 +1533,7 @@ DWORD64 WINAPI SymGetModuleBase64(HANDLE hProcess, DWORD64 dwAddr)
...
@@ -1537,7 +1533,7 @@ DWORD64 WINAPI SymGetModuleBase64(HANDLE hProcess, DWORD64 dwAddr)
struct
module
*
module
;
struct
module
*
module
;
if
(
!
pcs
)
return
0
;
if
(
!
pcs
)
return
0
;
module
=
module_find_by_addr
(
pcs
,
dwAddr
,
DMT_UNKNOWN
);
module
=
module_find_by_addr
(
pcs
,
dwAddr
);
if
(
!
module
)
return
0
;
if
(
!
module
)
return
0
;
return
module
->
module
.
BaseOfImage
;
return
module
->
module
.
BaseOfImage
;
}
}
...
@@ -1595,7 +1591,7 @@ PVOID WINAPI SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase)
...
@@ -1595,7 +1591,7 @@ PVOID WINAPI SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase)
struct
module
*
module
;
struct
module
*
module
;
if
(
!
pcs
)
return
NULL
;
if
(
!
pcs
)
return
NULL
;
module
=
module_find_by_addr
(
pcs
,
AddrBase
,
DMT_UNKNOWN
);
module
=
module_find_by_addr
(
pcs
,
AddrBase
);
if
(
!
module
||
!
module
->
cpu
->
find_runtime_function
)
return
NULL
;
if
(
!
module
||
!
module
->
cpu
->
find_runtime_function
)
return
NULL
;
return
module
->
cpu
->
find_runtime_function
(
module
,
AddrBase
);
return
module
->
cpu
->
find_runtime_function
(
module
,
AddrBase
);
...
...
dlls/dbghelp/source.c
View file @
d4104e85
...
@@ -152,7 +152,7 @@ BOOL WINAPI SymEnumSourceFilesW(HANDLE hProcess, ULONG64 ModBase, PCWSTR Mask,
...
@@ -152,7 +152,7 @@ BOOL WINAPI SymEnumSourceFilesW(HANDLE hProcess, ULONG64 ModBase, PCWSTR Mask,
if
(
ModBase
)
if
(
ModBase
)
{
{
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
ModBase
,
DMT_UNKNOWN
);
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
ModBase
);
if
(
!
module_get_debug
(
&
pair
))
return
FALSE
;
if
(
!
module_get_debug
(
&
pair
))
return
FALSE
;
}
}
else
else
...
...
dlls/dbghelp/symbol.c
View file @
d4104e85
...
@@ -1148,7 +1148,7 @@ static BOOL symt_enum_locals(struct process* pcs, const WCHAR* mask,
...
@@ -1148,7 +1148,7 @@ static BOOL symt_enum_locals(struct process* pcs, const WCHAR* mask,
se
->
sym_info
->
MaxNameLen
=
sizeof
(
se
->
buffer
)
-
sizeof
(
SYMBOL_INFO
);
se
->
sym_info
->
MaxNameLen
=
sizeof
(
se
->
buffer
)
-
sizeof
(
SYMBOL_INFO
);
pair
.
pcs
=
pcs
;
pair
.
pcs
=
pcs
;
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
pcs
->
localscope_pc
,
DMT_UNKNOWN
);
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
pcs
->
localscope_pc
);
if
(
!
module_get_debug
(
&
pair
))
return
FALSE
;
if
(
!
module_get_debug
(
&
pair
))
return
FALSE
;
if
(
symt_check_tag
(
pcs
->
localscope_symt
,
SymTagFunction
)
||
if
(
symt_check_tag
(
pcs
->
localscope_symt
,
SymTagFunction
)
||
...
@@ -1318,7 +1318,7 @@ static BOOL sym_enum(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask,
...
@@ -1318,7 +1318,7 @@ static BOOL sym_enum(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask,
HeapFree
(
GetProcessHeap
(),
0
,
mod
);
HeapFree
(
GetProcessHeap
(),
0
,
mod
);
return
TRUE
;
return
TRUE
;
}
}
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
BaseOfDll
,
DMT_UNKNOWN
);
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
BaseOfDll
);
if
(
!
module_get_debug
(
&
pair
))
if
(
!
module_get_debug
(
&
pair
))
return
FALSE
;
return
FALSE
;
...
@@ -1624,7 +1624,7 @@ BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
...
@@ -1624,7 +1624,7 @@ BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
/* search first in local context */
/* search first in local context */
pair
.
pcs
=
pcs
;
pair
.
pcs
=
pcs
;
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
pcs
->
localscope_pc
,
DMT_UNKNOWN
);
pair
.
requested
=
module_find_by_addr
(
pair
.
pcs
,
pcs
->
localscope_pc
);
if
(
module_get_debug
(
&
pair
)
&&
if
(
module_get_debug
(
&
pair
)
&&
(
symt_check_tag
(
pcs
->
localscope_symt
,
SymTagFunction
)
||
(
symt_check_tag
(
pcs
->
localscope_symt
,
SymTagFunction
)
||
symt_check_tag
(
pcs
->
localscope_symt
,
SymTagInlineSite
)))
symt_check_tag
(
pcs
->
localscope_symt
,
SymTagInlineSite
)))
...
...
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