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
ba12b5ae
Commit
ba12b5ae
authored
Jun 22, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Jun 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedump: Explore a bit more TPI hash elements.
Rename a couple of fields in PDB structures for clarity. Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
5d0d812d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
22 deletions
+157
-22
msc.c
dlls/dbghelp/msc.c
+1
-1
mscvpdb.h
include/wine/mscvpdb.h
+5
-5
pdb.c
tools/winedump/pdb.c
+151
-16
No files found.
dlls/dbghelp/msc.c
View file @
ba12b5ae
...
@@ -2954,7 +2954,7 @@ static void pdb_convert_types_header(PDB_TYPES* types, const BYTE* image)
...
@@ -2954,7 +2954,7 @@ static void pdb_convert_types_header(PDB_TYPES* types, const BYTE* image)
types
->
type_size
=
old
->
type_size
;
types
->
type_size
=
old
->
type_size
;
types
->
first_index
=
old
->
first_index
;
types
->
first_index
=
old
->
first_index
;
types
->
last_index
=
old
->
last_index
;
types
->
last_index
=
old
->
last_index
;
types
->
file
=
old
->
file
;
types
->
hash_file
=
old
->
hash_
file
;
}
}
else
else
{
{
...
...
include/wine/mscvpdb.h
View file @
ba12b5ae
...
@@ -2403,7 +2403,7 @@ typedef struct _PDB_TYPES_OLD
...
@@ -2403,7 +2403,7 @@ typedef struct _PDB_TYPES_OLD
unsigned
short
first_index
;
unsigned
short
first_index
;
unsigned
short
last_index
;
unsigned
short
last_index
;
unsigned
int
type_size
;
unsigned
int
type_size
;
unsigned
short
file
;
unsigned
short
hash_
file
;
unsigned
short
pad
;
unsigned
short
pad
;
}
PDB_TYPES_OLD
,
*
PPDB_TYPES_OLD
;
}
PDB_TYPES_OLD
,
*
PPDB_TYPES_OLD
;
...
@@ -2414,16 +2414,16 @@ typedef struct _PDB_TYPES
...
@@ -2414,16 +2414,16 @@ typedef struct _PDB_TYPES
unsigned
int
first_index
;
unsigned
int
first_index
;
unsigned
int
last_index
;
unsigned
int
last_index
;
unsigned
int
type_size
;
unsigned
int
type_size
;
unsigned
short
file
;
unsigned
short
hash_
file
;
unsigned
short
pad
;
unsigned
short
pad
;
unsigned
int
hash_size
;
unsigned
int
hash_size
;
unsigned
int
hash_
base
;
unsigned
int
hash_
num_buckets
;
unsigned
int
hash_offset
;
unsigned
int
hash_offset
;
unsigned
int
hash_len
;
unsigned
int
hash_len
;
unsigned
int
search_offset
;
unsigned
int
search_offset
;
unsigned
int
search_len
;
unsigned
int
search_len
;
unsigned
int
unknown
_offset
;
unsigned
int
type_remap
_offset
;
unsigned
int
unknown
_len
;
unsigned
int
type_remap
_len
;
}
PDB_TYPES
,
*
PPDB_TYPES
;
}
PDB_TYPES
,
*
PPDB_TYPES
;
typedef
struct
_PDB_SYMBOL_RANGE
typedef
struct
_PDB_SYMBOL_RANGE
...
...
tools/winedump/pdb.c
View file @
ba12b5ae
...
@@ -608,18 +608,153 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
...
@@ -608,18 +608,153 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
free
(
filesimage
);
free
(
filesimage
);
}
}
static
void
pdb_dump_types_hash
(
struct
pdb_reader
*
reader
,
unsigned
file
,
const
char
*
strmname
)
static
BOOL
is_bit_set
(
const
unsigned
*
dw
,
unsigned
len
,
unsigned
i
)
{
{
void
*
hash
=
NULL
;
if
(
i
>=
len
*
sizeof
(
unsigned
)
*
8
)
return
FALSE
;
DWORD
size
;
return
(
dw
[
i
>>
5
]
&
(
1u
<<
(
i
&
31u
)))
!=
0
;
}
hash
=
reader
->
read_file
(
reader
,
file
);
static
void
pdb_dump_hash_value
(
const
BYTE
*
ptr
,
unsigned
len
)
if
(
!
hash
)
return
;
{
int
i
;
size
=
pdb_get_file_size
(
reader
,
file
);
printf
(
"["
);
for
(
i
=
len
-
1
;
i
>=
0
;
i
--
)
printf
(
"%02x"
,
ptr
[
i
]);
printf
(
"]"
);
}
static
struct
{
const
BYTE
*
hash
;
unsigned
hash_size
;
}
collision_arg
;
static
int
collision_compar
(
const
void
*
p1
,
const
void
*
p2
)
{
unsigned
idx1
=
*
(
unsigned
*
)
p1
;
unsigned
idx2
=
*
(
unsigned
*
)
p2
;
return
memcmp
(
collision_arg
.
hash
+
idx1
*
collision_arg
.
hash_size
,
collision_arg
.
hash
+
idx2
*
collision_arg
.
hash_size
,
collision_arg
.
hash_size
);
}
static
void
pdb_dump_types_hash
(
struct
pdb_reader
*
reader
,
const
PDB_TYPES
*
types
,
const
char
*
strmname
)
{
void
*
hash
=
NULL
;
unsigned
i
,
strmsize
;
const
unsigned
*
table
;
char
*
strbase
;
unsigned
*
collision
;
hash
=
reader
->
read_file
(
reader
,
types
->
hash_file
);
if
(
!
hash
)
return
;
printf
(
"Types (%s) hash:
\n
"
,
strmname
);
printf
(
"Types (%s) hash:
\n
"
,
strmname
);
dump_data
(
hash
,
size
,
" "
);
strmsize
=
pdb_get_file_size
(
reader
,
types
->
hash_file
);
if
(
types
->
hash_offset
+
types
->
hash_len
>
strmsize
||
(
types
->
last_index
-
types
->
first_index
)
*
types
->
hash_size
!=
types
->
hash_len
||
types
->
search_offset
+
types
->
search_len
>
strmsize
||
types
->
type_remap_offset
+
types
->
type_remap_len
>
strmsize
)
{
printf
(
"
\n
Incoherent sizes... skipping
\n
"
);
return
;
}
printf
(
"
\n\t
Indexes => hash value:
\n
"
);
for
(
i
=
types
->
first_index
;
i
<
types
->
last_index
;
i
++
)
{
printf
(
"
\t\t
%08x => "
,
i
);
pdb_dump_hash_value
((
const
BYTE
*
)
hash
+
types
->
hash_offset
+
(
i
-
types
->
first_index
)
*
types
->
hash_size
,
types
->
hash_size
);
printf
(
"
\n
"
);
}
/* print collisions in hash table (if any) */
collision
=
malloc
((
types
->
last_index
-
types
->
first_index
)
*
sizeof
(
unsigned
));
if
(
collision
)
{
unsigned
head_printed
=
0
;
collision_arg
.
hash
=
(
const
BYTE
*
)
hash
+
types
->
hash_offset
;
collision_arg
.
hash_size
=
types
->
hash_size
;
for
(
i
=
0
;
i
<
types
->
last_index
-
types
->
first_index
;
i
++
)
collision
[
i
]
=
i
;
qsort
(
collision
,
types
->
last_index
-
types
->
first_index
,
sizeof
(
unsigned
),
collision_compar
);
for
(
i
=
0
;
i
<
types
->
last_index
-
types
->
first_index
;
i
++
)
{
unsigned
j
;
for
(
j
=
i
+
1
;
j
<
types
->
last_index
-
types
->
first_index
;
j
++
)
if
(
memcmp
((
const
BYTE
*
)
hash
+
types
->
hash_offset
+
collision
[
i
]
*
types
->
hash_size
,
(
const
BYTE
*
)
hash
+
types
->
hash_offset
+
collision
[
j
]
*
types
->
hash_size
,
types
->
hash_size
))
break
;
if
(
j
>
i
+
1
)
{
unsigned
k
;
if
(
!
head_printed
)
{
printf
(
"
\n\t\t
Collisions:
\n
"
);
head_printed
=
1
;
}
printf
(
"
\t\t\t
Hash "
);
pdb_dump_hash_value
((
const
BYTE
*
)
hash
+
types
->
hash_offset
+
collision
[
i
]
*
types
->
hash_size
,
types
->
hash_size
);
printf
(
":"
);
for
(
k
=
i
;
k
<
j
;
k
++
)
printf
(
" %x"
,
types
->
first_index
+
collision
[
k
]);
printf
(
"
\n
"
);
i
=
j
-
1
;
}
}
free
(
collision
);
}
printf
(
"
\n\t
Indexes => offsets:
\n
"
);
table
=
(
const
unsigned
*
)((
const
BYTE
*
)
hash
+
types
->
search_offset
);
for
(
i
=
0
;
i
<
types
->
search_len
/
(
2
*
sizeof
(
unsigned
));
i
+=
2
)
{
printf
(
"
\t\t
%08x => %08x
\n
"
,
table
[
2
*
i
+
0
],
table
[
2
*
i
+
1
]);
}
if
(
types
->
type_remap_len
&&
(
strbase
=
read_string_table
(
reader
)))
{
unsigned
num
,
capa
,
count_present
,
count_deleted
;
const
unsigned
*
present_bitset
;
const
unsigned
*
deleted_bitset
;
printf
(
"
\n\t
Type remap:
\n
"
);
table
=
(
const
unsigned
*
)((
const
BYTE
*
)
hash
+
types
->
type_remap_offset
);
num
=
*
table
++
;
capa
=
*
table
++
;
count_present
=
*
table
++
;
present_bitset
=
table
;
table
+=
count_present
;
count_deleted
=
*
table
++
;
deleted_bitset
=
table
;
table
+=
count_deleted
;
printf
(
"
\t\t
Number of present entries: %u
\n
"
,
num
);
printf
(
"
\t\t
Capacity: %u
\n
"
,
capa
);
printf
(
"
\t\t
Bitset present:
\n
"
);
printf
(
"
\t\t\t
Count: %u
\n
"
,
count_present
);
printf
(
"
\t\t\t
Bitset: "
);
pdb_dump_hash_value
((
const
BYTE
*
)
present_bitset
,
count_present
*
sizeof
(
unsigned
));
printf
(
"
\n
"
);
printf
(
"
\t\t
Bitset deleted:
\n
"
);
printf
(
"
\t\t\t
Count: %u
\n
"
,
count_deleted
);
printf
(
"
\t\t\t
Bitset: "
);
pdb_dump_hash_value
((
const
BYTE
*
)
deleted_bitset
,
count_deleted
*
sizeof
(
unsigned
));
printf
(
"
\n
"
);
for
(
i
=
0
;
i
<
capa
;
++
i
)
{
printf
(
"
\t\t
%2u) %c"
,
i
,
is_bit_set
(
present_bitset
,
count_present
,
i
)
?
'P'
:
is_bit_set
(
deleted_bitset
,
count_deleted
,
i
)
?
'D'
:
'_'
);
if
(
is_bit_set
(
present_bitset
,
count_present
,
i
))
{
printf
(
" %s => "
,
strbase
+
12
+
*
table
++
);
pdb_dump_hash_value
((
const
BYTE
*
)
table
,
types
->
hash_size
);
table
=
(
const
unsigned
*
)((
const
BYTE
*
)
table
+
types
->
hash_size
);
}
printf
(
"
\n
"
);
}
free
(
strbase
);
printf
(
"
\n
"
);
}
free
(
hash
);
free
(
hash
);
}
}
...
@@ -662,34 +797,34 @@ static void pdb_dump_types(struct pdb_reader* reader, unsigned strmidx, const ch
...
@@ -662,34 +797,34 @@ static void pdb_dump_types(struct pdb_reader* reader, unsigned strmidx, const ch
"
\t
first_index: %x
\n
"
"
\t
first_index: %x
\n
"
"
\t
last_index: %x
\n
"
"
\t
last_index: %x
\n
"
"
\t
type_size: %x
\n
"
"
\t
type_size: %x
\n
"
"
\t
file:
%x
\n
"
"
\t
hash_file:
%x
\n
"
"
\t
pad: %x
\n
"
"
\t
pad: %x
\n
"
"
\t
hash_size: %x
\n
"
"
\t
hash_size: %x
\n
"
"
\t
hash_b
ase:
%x
\n
"
"
\t
hash_b
uckets
%x
\n
"
"
\t
hash_offset: %x
\n
"
"
\t
hash_offset: %x
\n
"
"
\t
hash_len: %x
\n
"
"
\t
hash_len: %x
\n
"
"
\t
search_offset: %x
\n
"
"
\t
search_offset: %x
\n
"
"
\t
search_len: %x
\n
"
"
\t
search_len: %x
\n
"
"
\t
unknown
_offset: %x
\n
"
"
\t
type_remap
_offset: %x
\n
"
"
\t
unknown
_len: %x
\n
"
,
"
\t
type_remap
_len: %x
\n
"
,
strmname
,
strmname
,
types
->
version
,
types
->
version
,
types
->
type_offset
,
types
->
type_offset
,
types
->
first_index
,
types
->
first_index
,
types
->
last_index
,
types
->
last_index
,
types
->
type_size
,
types
->
type_size
,
types
->
file
,
types
->
hash_
file
,
types
->
pad
,
types
->
pad
,
types
->
hash_size
,
types
->
hash_size
,
types
->
hash_
base
,
types
->
hash_
num_buckets
,
types
->
hash_offset
,
types
->
hash_offset
,
types
->
hash_len
,
types
->
hash_len
,
types
->
search_offset
,
types
->
search_offset
,
types
->
search_len
,
types
->
search_len
,
types
->
unknown
_offset
,
types
->
type_remap
_offset
,
types
->
unknown
_len
);
types
->
type_remap
_len
);
codeview_dump_types_from_block
((
const
char
*
)
types
+
types
->
type_offset
,
types
->
type_size
);
codeview_dump_types_from_block
((
const
char
*
)
types
+
types
->
type_offset
,
types
->
type_size
);
pdb_dump_types_hash
(
reader
,
types
->
file
,
strmname
);
pdb_dump_types_hash
(
reader
,
types
,
strmname
);
free
(
types
);
free
(
types
);
}
}
...
...
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