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
d614ac46
Commit
d614ac46
authored
Nov 25, 2018
by
Andreas Maier
Committed by
Alexandre Julliard
Nov 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: SymFromAddr: Handle 2 or more symbols at the same address correct.
Signed-off-by:
Andreas Maier
<
staubim@quantentunnel.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6c341891
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
19 deletions
+35
-19
symbol.c
dlls/dbghelp/symbol.c
+35
-19
No files found.
dlls/dbghelp/symbol.c
View file @
d614ac46
...
@@ -850,6 +850,33 @@ static void symt_get_length(struct module* module, const struct symt* symt, ULON
...
@@ -850,6 +850,33 @@ static void symt_get_length(struct module* module, const struct symt* symt, ULON
*
size
=
0x1000
;
/* arbitrary value */
*
size
=
0x1000
;
/* arbitrary value */
}
}
/* neede by symt_find_nearest */
int
symt_get_best_at
(
struct
module
*
module
,
int
idx_sorttab
)
{
ULONG64
ref_addr
;
int
idx_sorttab_orig
=
idx_sorttab
;
if
(
module
->
addr_sorttab
[
idx_sorttab
]
->
symt
.
tag
==
SymTagPublicSymbol
)
{
symt_get_address
(
&
module
->
addr_sorttab
[
idx_sorttab
]
->
symt
,
&
ref_addr
);
while
(
idx_sorttab
>
0
&&
module
->
addr_sorttab
[
idx_sorttab
]
->
symt
.
tag
==
SymTagPublicSymbol
&&
!
cmp_sorttab_addr
(
module
,
idx_sorttab
-
1
,
ref_addr
))
idx_sorttab
--
;
if
(
module
->
addr_sorttab
[
idx_sorttab
]
->
symt
.
tag
==
SymTagPublicSymbol
)
{
idx_sorttab
=
idx_sorttab_orig
;
while
(
idx_sorttab
<
module
->
num_sorttab
-
1
&&
module
->
addr_sorttab
[
idx_sorttab
]
->
symt
.
tag
==
SymTagPublicSymbol
&&
!
cmp_sorttab_addr
(
module
,
idx_sorttab
+
1
,
ref_addr
))
idx_sorttab
++
;
}
/* if no better symbol fond restore original */
if
(
module
->
addr_sorttab
[
idx_sorttab
]
->
symt
.
tag
==
SymTagPublicSymbol
)
idx_sorttab
=
idx_sorttab_orig
;
}
return
idx_sorttab
;
}
/* assume addr is in module */
/* assume addr is in module */
struct
symt_ht
*
symt_find_nearest
(
struct
module
*
module
,
DWORD_PTR
addr
)
struct
symt_ht
*
symt_find_nearest
(
struct
module
*
module
,
DWORD_PTR
addr
)
{
{
...
@@ -868,7 +895,12 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD_PTR addr)
...
@@ -868,7 +895,12 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD_PTR addr)
high
=
module
->
num_sorttab
;
high
=
module
->
num_sorttab
;
symt_get_address
(
&
module
->
addr_sorttab
[
0
]
->
symt
,
&
ref_addr
);
symt_get_address
(
&
module
->
addr_sorttab
[
0
]
->
symt
,
&
ref_addr
);
if
(
addr
<
ref_addr
)
return
NULL
;
if
(
addr
<=
ref_addr
)
{
low
=
symt_get_best_at
(
module
,
0
);
return
module
->
addr_sorttab
[
low
];
}
if
(
high
)
if
(
high
)
{
{
symt_get_address
(
&
module
->
addr_sorttab
[
high
-
1
]
->
symt
,
&
ref_addr
);
symt_get_address
(
&
module
->
addr_sorttab
[
high
-
1
]
->
symt
,
&
ref_addr
);
...
@@ -891,23 +923,7 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD_PTR addr)
...
@@ -891,23 +923,7 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD_PTR addr)
/* If found symbol is a public symbol, check if there are any other entries that
/* If found symbol is a public symbol, check if there are any other entries that
* might also have the same address, but would get better information
* might also have the same address, but would get better information
*/
*/
if
(
module
->
addr_sorttab
[
low
]
->
symt
.
tag
==
SymTagPublicSymbol
)
low
=
symt_get_best_at
(
module
,
low
);
{
symt_get_address
(
&
module
->
addr_sorttab
[
low
]
->
symt
,
&
ref_addr
);
if
(
low
>
0
&&
module
->
addr_sorttab
[
low
-
1
]
->
symt
.
tag
!=
SymTagPublicSymbol
&&
!
cmp_sorttab_addr
(
module
,
low
-
1
,
ref_addr
))
low
--
;
else
if
(
low
<
module
->
num_sorttab
-
1
&&
module
->
addr_sorttab
[
low
+
1
]
->
symt
.
tag
!=
SymTagPublicSymbol
&&
!
cmp_sorttab_addr
(
module
,
low
+
1
,
ref_addr
))
low
++
;
}
/* finally check that we fit into the found symbol */
symt_get_address
(
&
module
->
addr_sorttab
[
low
]
->
symt
,
&
ref_addr
);
if
(
addr
<
ref_addr
)
return
NULL
;
symt_get_length
(
module
,
&
module
->
addr_sorttab
[
low
]
->
symt
,
&
ref_size
);
if
(
addr
>=
ref_addr
+
ref_size
)
return
NULL
;
return
module
->
addr_sorttab
[
low
];
return
module
->
addr_sorttab
[
low
];
}
}
...
@@ -1236,7 +1252,7 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
...
@@ -1236,7 +1252,7 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
symt_fill_sym_info
(
&
pair
,
NULL
,
&
sym
->
symt
,
Symbol
);
symt_fill_sym_info
(
&
pair
,
NULL
,
&
sym
->
symt
,
Symbol
);
if
(
Displacement
)
if
(
Displacement
)
*
Displacement
=
Address
-
Symbol
->
Address
;
*
Displacement
=
(
Address
>=
Symbol
->
Address
)
?
(
Address
-
Symbol
->
Address
)
:
(
DWORD64
)
-
1
;
return
TRUE
;
return
TRUE
;
}
}
...
...
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