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
805ffc8a
Commit
805ffc8a
authored
Sep 27, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Sep 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedump: Dump global hash table out of PDB symbols' stream.
Introduce relevant structures in include/wine/msvcpdb.h. Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
26dce248
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
27 deletions
+113
-27
msc.c
dlls/dbghelp/msc.c
+1
-1
mscvpdb.h
include/wine/mscvpdb.h
+29
-2
pdb.c
tools/winedump/pdb.c
+83
-24
No files found.
dlls/dbghelp/msc.c
View file @
805ffc8a
...
...
@@ -3182,7 +3182,7 @@ static void pdb_convert_symbols_header(PDB_SYMBOLS* symbols,
symbols
->
hash_size
=
old
->
hash_size
;
symbols
->
srcmodule_size
=
old
->
srcmodule_size
;
symbols
->
pdbimport_size
=
0
;
symbols
->
global_
file
=
old
->
global
_file
;
symbols
->
global_
hash_file
=
old
->
global_hash
_file
;
symbols
->
public_file
=
old
->
public_file
;
symbols
->
gsym_file
=
old
->
gsym_file
;
...
...
include/wine/mscvpdb.h
View file @
805ffc8a
...
...
@@ -2535,7 +2535,7 @@ typedef struct _PDB_SYMBOL_IMPORT
typedef
struct
_PDB_SYMBOLS_OLD
{
unsigned
short
global_file
;
unsigned
short
global_
hash_
file
;
unsigned
short
public_file
;
unsigned
short
gsym_file
;
unsigned
short
pad
;
...
...
@@ -2550,7 +2550,7 @@ typedef struct _PDB_SYMBOLS
unsigned
int
signature
;
unsigned
int
version
;
unsigned
int
age
;
unsigned
short
global_file
;
unsigned
short
global_
hash_
file
;
unsigned
short
flags
;
unsigned
short
public_file
;
unsigned
short
bldVer
;
...
...
@@ -2622,6 +2622,33 @@ PDB_STRING_TABLE;
* - a serialized hash table
*/
/* Header for hash tables inside DBI (aka symbols) stream.
* - The global hash stream contains only the hash table.
* - The public stream contains the same layout for its hash table
* (but other information as well).
*/
typedef
struct
{
unsigned
signature
;
unsigned
version
;
unsigned
size_hash_records
;
unsigned
unknown
;
}
DBI_HASH_HEADER
;
/* This header is followed by:
* - DBI_HASH_RECORDS (on hdr:size_hash_records bytes)
* - a bitmap of DBI_MAX_HASH + 1 entries (on DBI_BITMAP_HASH_SIZE bytes)
* - a table (one entry per present bit in bitmap) as index into hdr:num_records
*/
typedef
struct
{
unsigned
offset
;
unsigned
unknown
;
}
DBI_HASH_RECORD
;
#define DBI_MAX_HASH 4096
#define DBI_BITMAP_HASH_SIZE ((DBI_MAX_HASH / (8 * sizeof(unsigned)) + 1) * sizeof(unsigned))
#include "poppack.h"
/* ===================================================
...
...
tools/winedump/pdb.c
View file @
805ffc8a
...
...
@@ -231,6 +231,65 @@ const char* pdb_get_string_table_entry(const PDB_STRING_TABLE* table, unsigned o
return
(
char
*
)(
table
+
1
)
+
ofs
;
}
static
void
dump_dbi_hash_table
(
const
BYTE
*
root
,
unsigned
size
,
const
char
*
name
,
const
char
*
pfx
)
{
if
(
size
>=
sizeof
(
DBI_HASH_HEADER
))
{
const
DBI_HASH_HEADER
*
hdr
=
(
const
DBI_HASH_HEADER
*
)
root
;
printf
(
"%s%s symbols hash:
\n
"
,
pfx
,
name
);
printf
(
"%s
\t
Signature: 0x%x
\n
"
,
pfx
,
hdr
->
signature
);
printf
(
"%s
\t
Version: 0x%x (%u)
\n
"
,
pfx
,
hdr
->
version
,
hdr
->
version
-
0xeffe0000
);
printf
(
"%s
\t
Size of hash records: %u
\n
"
,
pfx
,
hdr
->
size_hash_records
);
printf
(
"%s
\t
Unknown: %u
\n
"
,
pfx
,
hdr
->
unknown
);
if
(
hdr
->
signature
!=
0xFFFFFFFF
||
hdr
->
version
!=
0xeffe0000
+
19990810
||
(
hdr
->
size_hash_records
%
sizeof
(
DBI_HASH_RECORD
))
!=
0
||
sizeof
(
DBI_HASH_HEADER
)
+
hdr
->
size_hash_records
+
DBI_BITMAP_HASH_SIZE
>
size
||
(
size
-
(
sizeof
(
DBI_HASH_HEADER
)
+
hdr
->
size_hash_records
+
DBI_BITMAP_HASH_SIZE
))
%
sizeof
(
unsigned
))
{
printf
(
"%s
\t\t
Incorrect hash structure
\n
"
,
pfx
);
}
else
{
unsigned
i
;
unsigned
num_hash_records
=
hdr
->
size_hash_records
/
sizeof
(
DBI_HASH_RECORD
);
const
DBI_HASH_RECORD
*
hr
=
(
const
DBI_HASH_RECORD
*
)(
hdr
+
1
);
unsigned
*
bitmap
=
(
unsigned
*
)((
char
*
)(
hdr
+
1
)
+
hdr
->
size_hash_records
);
unsigned
*
buckets
=
(
unsigned
*
)((
char
*
)(
hdr
+
1
)
+
hdr
->
size_hash_records
+
DBI_BITMAP_HASH_SIZE
);
unsigned
index
,
last_index
=
(
size
-
(
sizeof
(
DBI_HASH_HEADER
)
+
hdr
->
size_hash_records
+
DBI_BITMAP_HASH_SIZE
))
/
sizeof
(
unsigned
);
/* Yes, offsets for accessiong hr[] are stored as multiple of 12; and not
* as multiple of sizeof(*hr) = 8 as one might expect.
* Perhaps, native implementation likes to keep the same offsets between
* in memory representation vs on file representations.
*/
for
(
index
=
0
,
i
=
0
;
i
<=
DBI_MAX_HASH
;
i
++
)
{
if
(
bitmap
[
i
/
32
]
&
(
1u
<<
(
i
%
32
)))
{
unsigned
j
;
printf
(
"%s
\t
[%u]
\n
"
,
pfx
,
i
);
for
(
j
=
buckets
[
index
]
/
12
;
j
<
(
index
+
1
<
last_index
?
buckets
[
index
+
1
]
/
12
:
num_hash_records
);
j
++
)
printf
(
"%s
\t\t
[%u] offset=%08x unk=%x
\n
"
,
pfx
,
j
,
hr
[
j
].
offset
-
1
,
hr
[
j
].
unknown
);
index
++
;
}
else
printf
(
"%s
\t
[%u] <<empty>>
\n
"
,
pfx
,
i
);
}
/* shouldn't happen */
if
(
sizeof
(
DBI_HASH_HEADER
)
+
hdr
->
size_hash_records
+
DBI_BITMAP_HASH_SIZE
+
index
*
sizeof
(
unsigned
)
>
size
)
{
printf
(
"%s-- left over %u bytes
\n
"
,
pfx
,
size
-
(
unsigned
)(
sizeof
(
DBI_HASH_HEADER
)
+
hdr
->
size_hash_records
+
DBI_BITMAP_HASH_SIZE
+
index
*
sizeof
(
unsigned
)));
}
}
}
else
printf
(
"%sNo header in symbols hash
\n
"
,
pfx
);
}
static
void
dump_global_symbol
(
struct
pdb_reader
*
reader
,
unsigned
file
)
{
void
*
global
=
NULL
;
...
...
@@ -241,8 +300,7 @@ static void dump_global_symbol(struct pdb_reader* reader, unsigned file)
size
=
pdb_get_file_size
(
reader
,
file
);
printf
(
"Global symbols table:
\n
"
);
dump_data
(
global
,
size
,
"
\t
"
);
dump_dbi_hash_table
(
global
,
size
,
"Global"
,
""
);
free
(
global
);
}
...
...
@@ -290,30 +348,30 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
else
sprintf
(
tcver
,
"old-%x"
,
symbols
->
flags
);
printf
(
"Symbols:
\n
"
"
\t
signature: %08x
\n
"
"
\t
version: %u
\n
"
"
\t
age: %08x
\n
"
"
\t
global_
file:
%u
\n
"
"
\t
builder: %s
\n
"
"
\t
public_file: %u
\n
"
"
\t
bldVer: %u
\n
"
"
\t
gsym_file: %u
\n
"
"
\t
rbldVer: %u
\n
"
"
\t
module_size: %08x
\n
"
"
\t
offset_size: %08x
\n
"
"
\t
hash_size: %08x
\n
"
"
\t
src_module_size: %08x
\n
"
"
\t
pdbimport_size: %08x
\n
"
"
\t
resvd0: %08x
\n
"
"
\t
stream_idx_size: %08x
\n
"
"
\t
unknown2_size: %08x
\n
"
"
\t
resvd3: %04x
\n
"
"
\t
machine: %s
\n
"
"
\t
resvd4 %08x
\n
"
,
"
\t
signature:
%08x
\n
"
"
\t
version:
%u
\n
"
"
\t
age:
%08x
\n
"
"
\t
global_
hash_file:
%u
\n
"
"
\t
builder:
%s
\n
"
"
\t
public_file:
%u
\n
"
"
\t
bldVer:
%u
\n
"
"
\t
gsym_file:
%u
\n
"
"
\t
rbldVer:
%u
\n
"
"
\t
module_size:
%08x
\n
"
"
\t
offset_size:
%08x
\n
"
"
\t
hash_size:
%08x
\n
"
"
\t
src_module_size:
%08x
\n
"
"
\t
pdbimport_size:
%08x
\n
"
"
\t
resvd0:
%08x
\n
"
"
\t
stream_idx_size:
%08x
\n
"
"
\t
unknown2_size:
%08x
\n
"
"
\t
resvd3:
%04x
\n
"
"
\t
machine:
%s
\n
"
"
\t
resvd4
%08x
\n
"
,
symbols
->
signature
,
symbols
->
version
,
symbols
->
age
,
symbols
->
global_file
,
symbols
->
global_
hash_
file
,
tcver
,
/* from symbols->flags */
symbols
->
public_file
,
symbols
->
bldVer
,
...
...
@@ -610,8 +668,9 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
file
=
(
char
*
)((
DWORD_PTR
)(
lib_name
+
strlen
(
lib_name
)
+
1
+
3
)
&
~
3
);
}
dump_global_symbol
(
reader
,
symbols
->
global_file
);
dump_global_symbol
(
reader
,
symbols
->
global_
hash_
file
);
dump_public_symbol
(
reader
,
symbols
->
public_file
);
free
(
symbols
);
free
(
filesimage
);
}
...
...
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