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
92b9b094
Commit
92b9b094
authored
Dec 14, 2009
by
Eric Pouech
Committed by
Alexandre Julliard
Dec 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Wrap the symt* <=> index transformations.
parent
07c1a1ca
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
69 deletions
+89
-69
coff.c
dlls/dbghelp/coff.c
+3
-2
dbghelp_private.h
dlls/dbghelp/dbghelp_private.h
+12
-1
dwarf.c
dlls/dbghelp/dwarf.c
+2
-1
elf_module.c
dlls/dbghelp/elf_module.c
+4
-4
msc.c
dlls/dbghelp/msc.c
+1
-1
stabs.c
dlls/dbghelp/stabs.c
+1
-1
symbol.c
dlls/dbghelp/symbol.c
+37
-30
type.c
dlls/dbghelp/type.c
+29
-29
No files found.
dlls/dbghelp/coff.c
View file @
92b9b094
...
...
@@ -395,6 +395,7 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg)
{
if
(
coff_files
.
files
[
j
].
entries
!=
NULL
)
{
symt_cmp_addr_module
=
msc_dbg
->
module
;
qsort
(
coff_files
.
files
[
j
].
entries
,
coff_files
.
files
[
j
].
neps
,
sizeof
(
struct
symt
*
),
symt_cmp_addr
);
}
...
...
@@ -419,7 +420,7 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg)
for
(;;)
{
if
(
l
+
1
>=
coff_files
.
files
[
j
].
neps
)
break
;
symt_get_info
(
coff_files
.
files
[
j
].
entries
[
l
+
1
],
TI_GET_ADDRESS
,
&
addr
);
symt_get_info
(
msc_dbg
->
module
,
coff_files
.
files
[
j
].
entries
[
l
+
1
],
TI_GET_ADDRESS
,
&
addr
);
if
(((
msc_dbg
->
module
->
module
.
BaseOfImage
+
linepnt
->
Type
.
VirtualAddress
)
<
addr
))
break
;
l
++
;
...
...
@@ -432,7 +433,7 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg)
* start of the function, so we need to subtract that offset
* first.
*/
symt_get_info
(
coff_files
.
files
[
j
].
entries
[
l
+
1
],
TI_GET_ADDRESS
,
&
addr
);
symt_get_info
(
msc_dbg
->
module
,
coff_files
.
files
[
j
].
entries
[
l
+
1
],
TI_GET_ADDRESS
,
&
addr
);
symt_add_func_line
(
msc_dbg
->
module
,
(
struct
symt_function
*
)
coff_files
.
files
[
j
].
entries
[
l
+
1
],
coff_files
.
files
[
j
].
compiland
->
source
,
linepnt
->
Linenumber
,
msc_dbg
->
module
->
module
.
BaseOfImage
+
linepnt
->
Type
.
VirtualAddress
-
addr
);
...
...
dlls/dbghelp/dbghelp_private.h
View file @
92b9b094
...
...
@@ -418,6 +418,16 @@ struct pdb_lookup
}
u
;
};
static
inline
DWORD
symt_ptr2index
(
struct
module
*
module
,
const
struct
symt
*
sym
)
{
return
(
DWORD
)
sym
;
}
static
inline
struct
symt
*
symt_index2ptr
(
struct
module
*
module
,
DWORD
id
)
{
return
(
struct
symt
*
)
id
;
}
/* dbghelp.c */
extern
struct
process
*
process_find_by_handle
(
HANDLE
hProcess
);
extern
HANDLE
hMsvcrt
;
...
...
@@ -533,6 +543,7 @@ extern BOOL dwarf2_parse(struct module* module, unsigned long load_offse
/* symbol.c */
extern
const
char
*
symt_get_name
(
const
struct
symt
*
sym
);
extern
struct
module
*
symt_cmp_addr_module
;
extern
int
symt_cmp_addr
(
const
void
*
p1
,
const
void
*
p2
);
extern
void
copy_symbolW
(
SYMBOL_INFOW
*
siw
,
const
SYMBOL_INFO
*
si
);
extern
struct
symt_ht
*
...
...
@@ -606,7 +617,7 @@ extern struct symt_hierarchy_point*
/* type.c */
extern
void
symt_init_basic
(
struct
module
*
module
);
extern
BOOL
symt_get_info
(
const
struct
symt
*
type
,
extern
BOOL
symt_get_info
(
struct
module
*
module
,
const
struct
symt
*
type
,
IMAGEHLP_SYMBOL_TYPE_INFO
req
,
void
*
pInfo
);
extern
struct
symt_basic
*
symt_new_basic
(
struct
module
*
module
,
enum
BasicType
,
...
...
dlls/dbghelp/dwarf.c
View file @
92b9b094
...
...
@@ -1182,7 +1182,8 @@ static void dwarf2_parse_udt_member(dwarf2_parse_context_t* ctx,
if
(
!
dwarf2_find_attribute
(
ctx
,
di
,
DW_AT_byte_size
,
&
nbytes
))
{
DWORD64
size
;
nbytes
.
u
.
uvalue
=
symt_get_info
(
elt_type
,
TI_GET_LENGTH
,
&
size
)
?
(
unsigned
long
)
size
:
0
;
nbytes
.
u
.
uvalue
=
symt_get_info
(
ctx
->
module
,
elt_type
,
TI_GET_LENGTH
,
&
size
)
?
(
unsigned
long
)
size
:
0
;
}
bit_offset
.
u
.
uvalue
=
nbytes
.
u
.
uvalue
*
8
-
bit_offset
.
u
.
uvalue
-
bit_size
.
u
.
uvalue
;
}
...
...
dlls/dbghelp/elf_module.c
View file @
92b9b094
...
...
@@ -669,7 +669,7 @@ static int elf_new_wine_thunks(struct module* module, const struct hash_table* h
ULONG64
ref_addr
;
symt
=
symt_find_nearest
(
module
,
addr
);
if
(
symt
&&
!
symt_get_info
(
&
symt
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
))
if
(
symt
&&
!
symt_get_info
(
module
,
&
symt
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
))
ref_addr
=
addr
;
if
(
!
symt
||
addr
!=
ref_addr
)
{
...
...
@@ -706,9 +706,9 @@ static int elf_new_wine_thunks(struct module* module, const struct hash_table* h
ULONG64
xaddr
=
0
,
xsize
=
0
;
DWORD
kind
=
-
1
;
symt_get_info
(
&
symt
->
symt
,
TI_GET_ADDRESS
,
&
xaddr
);
symt_get_info
(
&
symt
->
symt
,
TI_GET_LENGTH
,
&
xsize
);
symt_get_info
(
&
symt
->
symt
,
TI_GET_DATAKIND
,
&
kind
);
symt_get_info
(
module
,
&
symt
->
symt
,
TI_GET_ADDRESS
,
&
xaddr
);
symt_get_info
(
module
,
&
symt
->
symt
,
TI_GET_LENGTH
,
&
xsize
);
symt_get_info
(
module
,
&
symt
->
symt
,
TI_GET_DATAKIND
,
&
kind
);
/* If none of symbols has a correct size, we consider they are both markers
* Hence, we can silence this warning
...
...
dlls/dbghelp/msc.c
View file @
92b9b094
...
...
@@ -667,7 +667,7 @@ static void codeview_add_udt_element(struct codeview_type_parse* ctp,
if
(
subtype
)
{
DWORD64
elem_size
=
0
;
symt_get_info
(
subtype
,
TI_GET_LENGTH
,
&
elem_size
);
symt_get_info
(
ctp
->
module
,
subtype
,
TI_GET_LENGTH
,
&
elem_size
);
symt_add_udt_element
(
ctp
->
module
,
symt
,
name
,
subtype
,
value
<<
3
,
(
DWORD
)
elem_size
<<
3
);
}
...
...
dlls/dbghelp/stabs.c
View file @
92b9b094
...
...
@@ -666,7 +666,7 @@ static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
* As we don't use much the size of members in structs, this may not
* be much of a problem
*/
symt_get_info
(
adt
,
TI_GET_LENGTH
,
&
size
);
symt_get_info
(
ptd
->
module
,
adt
,
TI_GET_LENGTH
,
&
size
);
symt_add_udt_element
(
ptd
->
module
,
sdt
,
tmp
,
adt
,
ofs
,
(
DWORD
)
size
*
8
);
}
PTS_ABORTIF
(
ptd
,
*
ptd
->
ptr
++
!=
';'
);
...
...
dlls/dbghelp/symbol.c
View file @
92b9b094
...
...
@@ -48,22 +48,24 @@ static inline int cmp_addr(ULONG64 a1, ULONG64 a2)
return
0
;
}
static
inline
int
cmp_sorttab_addr
(
const
struct
module
*
module
,
int
idx
,
ULONG64
addr
)
static
inline
int
cmp_sorttab_addr
(
struct
module
*
module
,
int
idx
,
ULONG64
addr
)
{
ULONG64
ref
;
symt_get_info
(
&
module
->
addr_sorttab
[
idx
]
->
symt
,
TI_GET_ADDRESS
,
&
ref
);
symt_get_info
(
module
,
&
module
->
addr_sorttab
[
idx
]
->
symt
,
TI_GET_ADDRESS
,
&
ref
);
return
cmp_addr
(
ref
,
addr
);
}
struct
module
*
symt_cmp_addr_module
=
NULL
;
int
symt_cmp_addr
(
const
void
*
p1
,
const
void
*
p2
)
{
const
struct
symt
*
sym1
=
*
(
const
struct
symt
*
const
*
)
p1
;
const
struct
symt
*
sym2
=
*
(
const
struct
symt
*
const
*
)
p2
;
ULONG64
a1
,
a2
;
symt_get_info
(
sym1
,
TI_GET_ADDRESS
,
&
a1
);
symt_get_info
(
sym2
,
TI_GET_ADDRESS
,
&
a2
);
symt_get_info
(
sym
t_cmp_addr_module
,
sym
1
,
TI_GET_ADDRESS
,
&
a1
);
symt_get_info
(
sym
t_cmp_addr_module
,
sym
2
,
TI_GET_ADDRESS
,
&
a2
);
return
cmp_addr
(
a1
,
a2
);
}
...
...
@@ -98,7 +100,7 @@ static void symt_add_module_ht(struct module* module, struct symt_ht* ht)
/* Don't store in sorttab a symbol without address, they are of
* no use here (e.g. constant values)
*/
if
(
symt_get_info
(
&
ht
->
symt
,
TI_GET_ADDRESS
,
&
addr
)
&&
if
(
symt_get_info
(
module
,
&
ht
->
symt
,
TI_GET_ADDRESS
,
&
addr
)
&&
symt_grow_sorttab
(
module
,
module
->
num_symbols
+
1
))
{
module
->
addr_sorttab
[
module
->
num_symbols
++
]
=
ht
;
...
...
@@ -321,7 +323,7 @@ struct symt_data* symt_new_global_variable(struct module* module,
sym
->
container
=
compiland
?
&
compiland
->
symt
:
NULL
;
sym
->
type
=
type
;
sym
->
u
.
var
.
offset
=
addr
;
if
(
type
&&
size
&&
symt_get_info
(
type
,
TI_GET_LENGTH
,
&
tsz
))
if
(
type
&&
size
&&
symt_get_info
(
module
,
type
,
TI_GET_LENGTH
,
&
tsz
))
{
if
(
tsz
!=
size
)
FIXME
(
"Size mismatch for %s.%s between type (%s) and src (%lu)
\n
"
,
...
...
@@ -627,20 +629,21 @@ struct symt_hierarchy_point* symt_new_label(struct module* module,
}
/* expect sym_info->MaxNameLen to be set before being called */
static
void
symt_fill_sym_info
(
const
struct
module_pair
*
pair
,
static
void
symt_fill_sym_info
(
struct
module_pair
*
pair
,
const
struct
symt_function
*
func
,
const
struct
symt
*
sym
,
SYMBOL_INFO
*
sym_info
)
{
const
char
*
name
;
DWORD64
size
;
if
(
!
symt_get_info
(
sym
,
TI_GET_TYPE
,
&
sym_info
->
TypeIndex
))
if
(
!
symt_get_info
(
pair
->
effective
,
sym
,
TI_GET_TYPE
,
&
sym_info
->
TypeIndex
))
sym_info
->
TypeIndex
=
0
;
sym_info
->
info
=
(
DWORD
)
sym
;
sym_info
->
info
=
symt_ptr2index
(
pair
->
effective
,
sym
)
;
sym_info
->
Reserved
[
0
]
=
sym_info
->
Reserved
[
1
]
=
0
;
if
(
!
symt_get_info
(
sym
,
TI_GET_LENGTH
,
&
size
)
&&
if
(
!
symt_get_info
(
pair
->
effective
,
sym
,
TI_GET_LENGTH
,
&
size
)
&&
(
!
sym_info
->
TypeIndex
||
!
symt_get_info
((
struct
symt
*
)
sym_info
->
TypeIndex
,
TI_GET_LENGTH
,
&
size
)))
!
symt_get_info
(
pair
->
effective
,
symt_index2ptr
(
pair
->
effective
,
sym_info
->
TypeIndex
),
TI_GET_LENGTH
,
&
size
)))
size
=
0
;
sym_info
->
Size
=
(
DWORD
)
size
;
sym_info
->
ModBase
=
pair
->
requested
->
module
.
BaseOfImage
;
...
...
@@ -689,7 +692,7 @@ static void symt_fill_sym_info(const struct module_pair* pair,
break
;
case
DataIsGlobal
:
case
DataIsFileStatic
:
symt_get_info
(
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
symt_get_info
(
pair
->
effective
,
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
sym_info
->
Register
=
0
;
break
;
case
DataIsConstant
:
...
...
@@ -717,18 +720,18 @@ static void symt_fill_sym_info(const struct module_pair* pair,
break
;
case
SymTagPublicSymbol
:
sym_info
->
Flags
|=
SYMFLAG_EXPORT
;
symt_get_info
(
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
symt_get_info
(
pair
->
effective
,
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
break
;
case
SymTagFunction
:
sym_info
->
Flags
|=
SYMFLAG_FUNCTION
;
symt_get_info
(
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
symt_get_info
(
pair
->
effective
,
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
break
;
case
SymTagThunk
:
sym_info
->
Flags
|=
SYMFLAG_THUNK
;
symt_get_info
(
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
symt_get_info
(
pair
->
effective
,
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
break
;
default:
symt_get_info
(
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
symt_get_info
(
pair
->
effective
,
sym
,
TI_GET_ADDRESS
,
&
sym_info
->
Address
);
sym_info
->
Register
=
0
;
break
;
}
...
...
@@ -762,7 +765,7 @@ struct sym_enum
char
buffer
[
sizeof
(
SYMBOL_INFO
)
+
MAX_SYM_NAME
];
};
static
BOOL
send_symbol
(
const
struct
sym_enum
*
se
,
const
struct
module_pair
*
pair
,
static
BOOL
send_symbol
(
const
struct
sym_enum
*
se
,
struct
module_pair
*
pair
,
const
struct
symt_function
*
func
,
const
struct
symt
*
sym
)
{
symt_fill_sym_info
(
pair
,
func
,
sym
,
se
->
sym_info
);
...
...
@@ -772,7 +775,7 @@ static BOOL send_symbol(const struct sym_enum* se, const struct module_pair* pai
return
!
se
->
cb
(
se
->
sym_info
,
se
->
sym_info
->
Size
,
se
->
user
);
}
static
BOOL
symt_enum_module
(
const
struct
module_pair
*
pair
,
const
regex_t
*
regex
,
static
BOOL
symt_enum_module
(
struct
module_pair
*
pair
,
const
regex_t
*
regex
,
const
struct
sym_enum
*
se
)
{
void
*
ptr
;
...
...
@@ -793,13 +796,13 @@ static BOOL symt_enum_module(const struct module_pair* pair, const regex_t* rege
return
FALSE
;
}
static
inline
unsigned
where_to_insert
(
const
struct
module
*
module
,
unsigned
high
,
const
struct
symt_ht
*
elt
)
static
inline
unsigned
where_to_insert
(
struct
module
*
module
,
unsigned
high
,
const
struct
symt_ht
*
elt
)
{
unsigned
low
=
0
,
mid
=
high
/
2
;
ULONG64
addr
;
if
(
!
high
)
return
0
;
symt_get_info
(
&
elt
->
symt
,
TI_GET_ADDRESS
,
&
addr
);
symt_get_info
(
module
,
&
elt
->
symt
,
TI_GET_ADDRESS
,
&
addr
);
do
{
switch
(
cmp_sorttab_addr
(
module
,
mid
,
addr
))
...
...
@@ -831,6 +834,7 @@ static BOOL resort_symbols(struct module* module)
delta
=
module
->
num_symbols
-
module
->
num_sorttab
;
memcpy
(
tmp
,
&
module
->
addr_sorttab
[
module
->
num_sorttab
],
delta
*
sizeof
(
struct
symt_ht
*
));
symt_cmp_addr_module
=
module
;
qsort
(
tmp
,
delta
,
sizeof
(
struct
symt_ht
*
),
symt_cmp_addr
);
for
(
i
=
delta
-
1
;
i
>=
0
;
i
--
)
...
...
@@ -844,20 +848,23 @@ static BOOL resort_symbols(struct module* module)
}
}
else
{
symt_cmp_addr_module
=
module
;
qsort
(
module
->
addr_sorttab
,
module
->
num_symbols
,
sizeof
(
struct
symt_ht
*
),
symt_cmp_addr
);
}
module
->
num_sorttab
=
module
->
num_symbols
;
return
module
->
sortlist_valid
=
TRUE
;
}
static
void
symt_get_length
(
const
struct
symt
*
symt
,
ULONG64
*
size
)
static
void
symt_get_length
(
struct
module
*
module
,
const
struct
symt
*
symt
,
ULONG64
*
size
)
{
DWORD
type_index
;
if
(
symt_get_info
(
symt
,
TI_GET_LENGTH
,
size
)
&&
*
size
)
if
(
symt_get_info
(
module
,
symt
,
TI_GET_LENGTH
,
size
)
&&
*
size
)
return
;
if
(
symt_get_info
(
symt
,
TI_GET_TYPE
,
&
type_index
)
&&
symt_get_info
(
(
struct
symt
*
)
type_index
,
TI_GET_LENGTH
,
size
))
return
;
if
(
symt_get_info
(
module
,
symt
,
TI_GET_TYPE
,
&
type_index
)
&&
symt_get_info
(
module
,
symt_index2ptr
(
module
,
type_index
)
,
TI_GET_LENGTH
,
size
))
return
;
*
size
=
0x1000
;
/* arbitrary value */
}
...
...
@@ -878,12 +885,12 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD addr)
low
=
0
;
high
=
module
->
num_sorttab
;
symt_get_info
(
&
module
->
addr_sorttab
[
0
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
symt_get_info
(
module
,
&
module
->
addr_sorttab
[
0
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
if
(
addr
<
ref_addr
)
return
NULL
;
if
(
high
)
{
symt_get_info
(
&
module
->
addr_sorttab
[
high
-
1
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
symt_get_length
(
&
module
->
addr_sorttab
[
high
-
1
]
->
symt
,
&
ref_size
);
symt_get_info
(
module
,
&
module
->
addr_sorttab
[
high
-
1
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
symt_get_length
(
module
,
&
module
->
addr_sorttab
[
high
-
1
]
->
symt
,
&
ref_size
);
if
(
addr
>=
ref_addr
+
ref_size
)
return
NULL
;
}
...
...
@@ -904,7 +911,7 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD addr)
*/
if
(
module
->
addr_sorttab
[
low
]
->
symt
.
tag
==
SymTagPublicSymbol
)
{
symt_get_info
(
&
module
->
addr_sorttab
[
low
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
symt_get_info
(
module
,
&
module
->
addr_sorttab
[
low
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
if
(
low
>
0
&&
module
->
addr_sorttab
[
low
-
1
]
->
symt
.
tag
!=
SymTagPublicSymbol
&&
!
cmp_sorttab_addr
(
module
,
low
-
1
,
ref_addr
))
...
...
@@ -915,9 +922,9 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD addr)
low
++
;
}
/* finally check that we fit into the found symbol */
symt_get_info
(
&
module
->
addr_sorttab
[
low
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
symt_get_info
(
module
,
&
module
->
addr_sorttab
[
low
]
->
symt
,
TI_GET_ADDRESS
,
&
ref_addr
);
if
(
addr
<
ref_addr
)
return
NULL
;
symt_get_length
(
&
module
->
addr_sorttab
[
low
]
->
symt
,
&
ref_size
);
symt_get_length
(
module
,
&
module
->
addr_sorttab
[
low
]
->
symt
,
&
ref_size
);
if
(
addr
>=
ref_addr
+
ref_size
)
return
NULL
;
return
module
->
addr_sorttab
[
low
];
...
...
dlls/dbghelp/type.c
View file @
92b9b094
...
...
@@ -304,7 +304,7 @@ struct symt_array* symt_new_array(struct module* module, int min, int max,
return
sym
;
}
static
inline
DWORD
symt_array_count
(
const
struct
symt_array
*
array
)
static
inline
DWORD
symt_array_count
(
struct
module
*
module
,
const
struct
symt_array
*
array
)
{
if
(
array
->
end
<
0
)
{
...
...
@@ -312,7 +312,7 @@ static inline DWORD symt_array_count(const struct symt_array* array)
/* One could want to also set the array->end field in array, but we won't do it
* as long as all the get_type() helpers use const objects
*/
if
(
symt_get_info
(
array
->
base_type
,
TI_GET_LENGTH
,
&
elem_size
)
&&
elem_size
)
if
(
symt_get_info
(
module
,
array
->
base_type
,
TI_GET_LENGTH
,
&
elem_size
)
&&
elem_size
)
return
-
array
->
end
/
(
DWORD
)
elem_size
;
return
0
;
}
...
...
@@ -415,9 +415,9 @@ BOOL WINAPI SymEnumTypes(HANDLE hProcess, ULONG64 BaseOfDll,
for
(
i
=
0
;
i
<
vector_length
(
&
pair
.
effective
->
vtypes
);
i
++
)
{
type
=
*
(
struct
symt
**
)
vector_at
(
&
pair
.
effective
->
vtypes
,
i
);
sym_info
->
TypeIndex
=
(
DWORD
)
type
;
sym_info
->
TypeIndex
=
symt_ptr2index
(
pair
.
effective
,
type
)
;
sym_info
->
info
=
0
;
/* FIXME */
symt_get_info
(
type
,
TI_GET_LENGTH
,
&
size
);
symt_get_info
(
pair
.
effective
,
type
,
TI_GET_LENGTH
,
&
size
);
sym_info
->
Size
=
size
;
sym_info
->
ModBase
=
pair
.
requested
->
module
.
BaseOfImage
;
sym_info
->
Flags
=
0
;
/* FIXME */
...
...
@@ -477,8 +477,8 @@ BOOL WINAPI SymEnumTypesW(HANDLE hProcess, ULONG64 BaseOfDll,
*
* Retrieves information about a symt (either symbol or type)
*/
BOOL
symt_get_info
(
const
struct
symt
*
type
,
IMAGEHLP_SYMBOL_TYPE_INFO
req
,
void
*
pInfo
)
BOOL
symt_get_info
(
struct
module
*
module
,
const
struct
symt
*
type
,
IMAGEHLP_SYMBOL_TYPE_INFO
req
,
void
*
pInfo
)
{
unsigned
len
;
...
...
@@ -510,7 +510,7 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
for
(
i
=
0
;
i
<
tifp
->
Count
;
i
++
)
{
if
(
!
(
pt
=
vector_at
(
v
,
tifp
->
Start
+
i
)))
return
FALSE
;
tifp
->
ChildId
[
i
]
=
(
DWORD
)
*
pt
;
tifp
->
ChildId
[
i
]
=
symt_ptr2index
(
module
,
*
pt
)
;
}
}
break
;
...
...
@@ -537,7 +537,7 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
case
SymTagFuncDebugStart
:
case
SymTagFuncDebugEnd
:
case
SymTagLabel
:
if
(
!
symt_get_info
(((
const
struct
symt_hierarchy_point
*
)
type
)
->
parent
,
if
(
!
symt_get_info
(
module
,
((
const
struct
symt_hierarchy_point
*
)
type
)
->
parent
,
req
,
pInfo
))
return
FALSE
;
X
(
ULONG64
)
+=
((
const
struct
symt_hierarchy_point
*
)
type
)
->
loc
.
offset
;
...
...
@@ -612,7 +612,7 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
switch
(
type
->
tag
)
{
case
SymTagArrayType
:
X
(
DWORD
)
=
symt_array_count
((
const
struct
symt_array
*
)
type
);
X
(
DWORD
)
=
symt_array_count
(
module
,
(
const
struct
symt_array
*
)
type
);
break
;
case
SymTagFunctionType
:
/* this seems to be wrong for (future) C++ methods, where 'this' parameter
...
...
@@ -653,17 +653,17 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
return
FALSE
;
X
(
DWORD64
)
=
((
const
struct
symt_data
*
)
type
)
->
u
.
member
.
length
;
break
;
case
SymTagArrayType
:
if
(
!
symt_get_info
(
((
const
struct
symt_array
*
)
type
)
->
base_type
,
case
SymTagArrayType
:
if
(
!
symt_get_info
(
module
,
((
const
struct
symt_array
*
)
type
)
->
base_type
,
TI_GET_LENGTH
,
pInfo
))
return
FALSE
;
X
(
DWORD64
)
*=
symt_array_count
((
const
struct
symt_array
*
)
type
);
X
(
DWORD64
)
*=
symt_array_count
(
module
,
(
const
struct
symt_array
*
)
type
);
break
;
case
SymTagPublicSymbol
:
X
(
DWORD64
)
=
((
const
struct
symt_public
*
)
type
)
->
size
;
break
;
case
SymTagTypedef
:
return
symt_get_info
(((
const
struct
symt_typedef
*
)
type
)
->
type
,
TI_GET_LENGTH
,
pInfo
);
return
symt_get_info
(
module
,
((
const
struct
symt_typedef
*
)
type
)
->
type
,
TI_GET_LENGTH
,
pInfo
);
case
SymTagThunk
:
X
(
DWORD64
)
=
((
const
struct
symt_thunk
*
)
type
)
->
size
;
break
;
...
...
@@ -683,19 +683,19 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
switch
(
type
->
tag
)
{
case
SymTagBlock
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_block
*
)
type
)
->
container
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_block
*
)
type
)
->
container
)
;
break
;
case
SymTagData
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_data
*
)
type
)
->
container
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_data
*
)
type
)
->
container
)
;
break
;
case
SymTagFunction
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_function
*
)
type
)
->
container
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_function
*
)
type
)
->
container
)
;
break
;
case
SymTagThunk
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_thunk
*
)
type
)
->
container
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_thunk
*
)
type
)
->
container
)
;
break
;
case
SymTagFunctionArgType
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_function_arg_type
*
)
type
)
->
container
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_function_arg_type
*
)
type
)
->
container
)
;
break
;
default:
FIXME
(
"Unsupported sym-tag %s for get-lexical-parent
\n
"
,
...
...
@@ -763,29 +763,29 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
{
/* hierarchical => hierarchical */
case
SymTagArrayType
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_array
*
)
type
)
->
base_type
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_array
*
)
type
)
->
base_type
)
;
break
;
case
SymTagPointerType
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_pointer
*
)
type
)
->
pointsto
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_pointer
*
)
type
)
->
pointsto
)
;
break
;
case
SymTagFunctionType
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_function_signature
*
)
type
)
->
rettype
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_function_signature
*
)
type
)
->
rettype
)
;
break
;
case
SymTagTypedef
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_typedef
*
)
type
)
->
type
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_typedef
*
)
type
)
->
type
)
;
break
;
/* lexical => hierarchical */
case
SymTagData
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_data
*
)
type
)
->
type
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_data
*
)
type
)
->
type
);
break
;
case
SymTagFunction
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_function
*
)
type
)
->
type
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_function
*
)
type
)
->
type
)
;
break
;
case
SymTagEnum
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_enum
*
)
type
)
->
base_type
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_enum
*
)
type
)
->
base_type
)
;
break
;
case
SymTagFunctionArgType
:
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_function_arg_type
*
)
type
)
->
arg_type
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_function_arg_type
*
)
type
)
->
arg_type
)
;
break
;
default:
FIXME
(
"Unsupported sym-tag %s for get-type
\n
"
,
...
...
@@ -819,7 +819,7 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
break
;
case
TI_GET_ARRAYINDEXTYPEID
:
if
(
type
->
tag
!=
SymTagArrayType
)
return
FALSE
;
X
(
DWORD
)
=
(
DWORD
)((
const
struct
symt_array
*
)
type
)
->
index_type
;
X
(
DWORD
)
=
symt_ptr2index
(
module
,
((
const
struct
symt_array
*
)
type
)
->
index_type
)
;
break
;
case
TI_GET_CLASSPARENTID
:
...
...
@@ -867,7 +867,7 @@ BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD64 ModBase,
return
FALSE
;
}
return
symt_get_info
(
(
struct
symt
*
)
TypeId
,
GetType
,
pInfo
);
return
symt_get_info
(
pair
.
effective
,
symt_index2ptr
(
pair
.
effective
,
TypeId
)
,
GetType
,
pInfo
);
}
/******************************************************************
...
...
@@ -886,7 +886,7 @@ BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, ULONG64 BaseOfDll,
if
(
!
module_get_debug
(
&
pair
))
return
FALSE
;
type
=
symt_find_type_by_name
(
pair
.
effective
,
SymTagNull
,
Name
);
if
(
!
type
)
return
FALSE
;
Symbol
->
TypeIndex
=
(
DWORD
)
type
;
Symbol
->
TypeIndex
=
symt_ptr2index
(
pair
.
effective
,
type
)
;
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