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
e2c87ebe
Commit
e2c87ebe
authored
Feb 06, 2023
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedump: Refactor PDB DBI per-module dump in a dedicated function.
Also better taking care of various PDB_SYMBOL_FILE formats. Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
7370e15c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
126 deletions
+108
-126
pdb.c
tools/winedump/pdb.c
+108
-126
No files found.
tools/winedump/pdb.c
View file @
e2c87ebe
...
...
@@ -331,6 +331,85 @@ static void dump_public_symbol(struct pdb_reader* reader, unsigned stream)
free
(
hdr
);
}
static
const
void
*
pdb_dump_dbi_module
(
struct
pdb_reader
*
reader
,
const
PDB_SYMBOL_FILE_EX
*
sym_file
,
const
char
*
file_name
,
PDB_STRING_TABLE
*
filesimage
)
{
const
char
*
lib_name
;
unsigned
char
*
modimage
;
BOOL
new_format
=
!
file_name
;
if
(
new_format
)
file_name
=
sym_file
->
filename
;
printf
(
"
\t
--------symbol file-----------
\n
"
);
printf
(
"
\t
Name: %s
\n
"
,
file_name
);
lib_name
=
file_name
+
strlen
(
file_name
)
+
1
;
if
(
strcmp
(
file_name
,
lib_name
))
printf
(
"
\t
Library: %s
\n
"
,
lib_name
);
printf
(
"
\t\t
unknown1: %08x
\n
"
"
\t\t
range
\n
"
"
\t\t\t
segment: %04x
\n
"
"
\t\t\t
pad1: %04x
\n
"
"
\t\t\t
offset: %08x
\n
"
"
\t\t\t
size: %08x
\n
"
"
\t\t\t
characteristics: %08x"
,
sym_file
->
unknown1
,
sym_file
->
range
.
segment
,
sym_file
->
range
.
pad1
,
sym_file
->
range
.
offset
,
sym_file
->
range
.
size
,
sym_file
->
range
.
characteristics
);
dump_section_characteristics
(
sym_file
->
range
.
characteristics
,
" "
);
printf
(
"
\n
"
"
\t\t\t
index: %04x
\n
"
"
\t\t\t
pad2: %04x
\n
"
,
sym_file
->
range
.
index
,
sym_file
->
range
.
pad2
);
if
(
new_format
)
printf
(
"
\t\t\t
timestamp: %08x
\n
"
"
\t\t\t
unknown: %08x
\n
"
,
sym_file
->
range
.
timestamp
,
sym_file
->
range
.
unknown
);
printf
(
"
\t\t
flag: %04x
\n
"
"
\t\t
stream: %04x
\n
"
"
\t\t
symb size: %08x
\n
"
"
\t\t
line size: %08x
\n
"
"
\t\t
line2 size: %08x
\n
"
"
\t\t
nSrcFiles: %08x
\n
"
"
\t\t
attribute: %08x
\n
"
,
sym_file
->
flag
,
sym_file
->
stream
,
sym_file
->
symbol_size
,
sym_file
->
lineno_size
,
sym_file
->
lineno2_size
,
sym_file
->
nSrcFiles
,
sym_file
->
attribute
);
if
(
new_format
)
printf
(
"
\t\t
reserved/0: %08x
\n
"
"
\t\t
reserved/1: %08x
\n
"
,
sym_file
->
reserved
[
0
],
sym_file
->
reserved
[
1
]);
modimage
=
reader
->
read_stream
(
reader
,
sym_file
->
stream
);
if
(
modimage
)
{
int
total_size
=
pdb_get_stream_size
(
reader
,
sym_file
->
stream
);
if
(
sym_file
->
symbol_size
)
codeview_dump_symbols
((
const
char
*
)
modimage
,
sizeof
(
DWORD
),
sym_file
->
symbol_size
);
/* line number info */
if
(
sym_file
->
lineno_size
)
codeview_dump_linetab
((
const
char
*
)
modimage
+
sym_file
->
symbol_size
,
TRUE
,
" "
);
else
if
(
sym_file
->
lineno2_size
)
/* actually, only one of the 2 lineno should be present */
codeview_dump_linetab2
((
const
char
*
)
modimage
+
sym_file
->
symbol_size
,
sym_file
->
lineno2_size
,
filesimage
,
" "
);
/* what's that part ??? */
if
(
0
)
dump_data
(
modimage
+
sym_file
->
symbol_size
+
sym_file
->
lineno_size
+
sym_file
->
lineno2_size
,
total_size
-
(
sym_file
->
symbol_size
+
sym_file
->
lineno_size
+
sym_file
->
lineno2_size
),
" "
);
free
(
modimage
);
}
return
(
const
void
*
)((
DWORD_PTR
)(
lib_name
+
strlen
(
lib_name
)
+
1
+
3
)
&
~
3
);
}
static
void
pdb_dump_symbols
(
struct
pdb_reader
*
reader
,
PDB_STREAM_INDEXES
*
sidx
)
{
PDB_SYMBOLS
*
symbols
;
...
...
@@ -635,139 +714,42 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
}
/* Read per-module symbol / linenumber tables */
file
=
(
const
char
*
)
symbols
+
sizeof
(
PDB_SYMBOLS
);
while
(
file
-
(
const
char
*
)
symbols
<
sizeof
(
PDB_SYMBOLS
)
+
symbols
->
module_size
)
while
((
file
-
(
const
char
*
)
symbols
+
sizeof
(
symbols
->
version
)
<
sizeof
(
PDB_SYMBOLS
)
+
symbols
->
module_size
)
&&
(
file
-
(
const
char
*
)
symbols
+
symbols
->
version
<
19970000
?
sizeof
(
PDB_SYMBOL_FILE
)
:
sizeof
(
PDB_SYMBOL_FILE_EX
))
<
sizeof
(
PDB_SYMBOLS
)
+
symbols
->
module_size
)
if
(
symbols
->
module_size
)
{
int
stream_nr
,
symbol_size
,
lineno_size
,
lineno2_size
;
const
char
*
file_name
;
const
char
*
lib_name
;
SIZE_T
module_header_size
=
symbols
->
version
<
19970000
?
sizeof
(
PDB_SYMBOL_FILE
)
:
sizeof
(
PDB_SYMBOL_FILE_EX
);
file
=
(
const
char
*
)
symbols
+
sizeof
(
PDB_SYMBOLS
);
while
(
file
+
module_header_size
<=
(
const
char
*
)
symbols
+
sizeof
(
PDB_SYMBOLS
)
+
symbols
->
module_size
)
{
if
(
symbols
->
version
<
19970000
)
{
const
PDB_SYMBOL_FILE
*
sym_file
=
(
const
PDB_SYMBOL_FILE
*
)
file
;
stream_nr
=
sym_file
->
stream
;
file_name
=
sym_file
->
filename
;
lib_name
=
file_name
+
strlen
(
file_name
)
+
1
;
symbol_size
=
sym_file
->
symbol_size
;
lineno_size
=
sym_file
->
lineno_size
;
lineno2_size
=
sym_file
->
lineno2_size
;
printf
(
"
\t
--------symbol file-----------
\n
"
);
printf
(
"
\t
Name: %s
\n
"
,
file_name
);
if
(
strcmp
(
file_name
,
lib_name
))
printf
(
"
\t
Library: %s
\n
"
,
lib_name
);
printf
(
"
\t\t
unknown1: %08x
\n
"
"
\t\t
range
\n
"
"
\t\t\t
segment: %04x
\n
"
"
\t\t\t
pad1: %04x
\n
"
"
\t\t\t
offset: %08x
\n
"
"
\t\t\t
size: %08x
\n
"
"
\t\t\t
characteristics: %08x"
,
sym_file
->
unknown1
,
sym_file
->
range
.
segment
,
sym_file
->
range
.
pad1
,
sym_file
->
range
.
offset
,
sym_file
->
range
.
size
,
sym_file
->
range
.
characteristics
);
dump_section_characteristics
(
sym_file
->
range
.
characteristics
,
" "
);
printf
(
"
\n
"
"
\t\t\t
index: %04x
\n
"
"
\t\t\t
pad2: %04x
\n
"
"
\t\t
flag: %04x
\n
"
"
\t\t
stream: %04x
\n
"
"
\t\t
symb size: %08x
\n
"
"
\t\t
line size: %08x
\n
"
"
\t\t
line2 size: %08x
\n
"
"
\t\t
nSrcFiles: %08x
\n
"
"
\t\t
attribute: %08x
\n
"
,
sym_file
->
range
.
index
,
sym_file
->
range
.
pad2
,
sym_file
->
flag
,
sym_file
->
stream
,
sym_file
->
symbol_size
,
sym_file
->
lineno_size
,
sym_file
->
lineno2_size
,
sym_file
->
nSrcFiles
,
sym_file
->
attribute
);
PDB_SYMBOL_FILE_EX
copy
;
const
PDB_SYMBOL_FILE
*
sym_file
=
(
const
PDB_SYMBOL_FILE
*
)
file
;
copy
.
unknown1
=
sym_file
->
unknown1
;
copy
.
range
.
segment
=
sym_file
->
range
.
segment
;
copy
.
range
.
pad1
=
sym_file
->
range
.
pad1
;
copy
.
range
.
offset
=
sym_file
->
range
.
offset
;
copy
.
range
.
size
=
sym_file
->
range
.
size
;
copy
.
range
.
characteristics
=
sym_file
->
range
.
characteristics
;
copy
.
range
.
index
=
sym_file
->
range
.
index
;
copy
.
range
.
pad2
=
sym_file
->
range
.
pad2
;
copy
.
range
.
timestamp
=
0
;
copy
.
range
.
unknown
=
0
;
copy
.
flag
=
sym_file
->
flag
;
copy
.
stream
=
sym_file
->
stream
;
copy
.
symbol_size
=
sym_file
->
symbol_size
;
copy
.
lineno_size
=
sym_file
->
lineno_size
;
copy
.
lineno2_size
=
sym_file
->
lineno2_size
;
copy
.
nSrcFiles
=
sym_file
->
nSrcFiles
;
copy
.
attribute
=
sym_file
->
attribute
;
copy
.
reserved
[
0
]
=
0
;
copy
.
reserved
[
1
]
=
0
;
file
=
pdb_dump_dbi_module
(
reader
,
&
copy
,
sym_file
->
filename
,
filesimage
);
}
else
{
const
PDB_SYMBOL_FILE_EX
*
sym_file
=
(
const
PDB_SYMBOL_FILE_EX
*
)
file
;
stream_nr
=
sym_file
->
stream
;
file_name
=
sym_file
->
filename
;
lib_name
=
file_name
+
strlen
(
file_name
)
+
1
;
symbol_size
=
sym_file
->
symbol_size
;
lineno_size
=
sym_file
->
lineno_size
;
lineno2_size
=
sym_file
->
lineno2_size
;
printf
(
"
\t
--------symbol file-----------
\n
"
);
printf
(
"
\t
Name: %s
\n
"
,
file_name
);
if
(
strcmp
(
file_name
,
lib_name
))
printf
(
"
\t
Library: %s
\n
"
,
lib_name
);
printf
(
"
\t\t
unknown1: %08x
\n
"
"
\t\t
range
\n
"
"
\t\t\t
segment: %04x
\n
"
"
\t\t\t
pad1: %04x
\n
"
"
\t\t\t
offset: %08x
\n
"
"
\t\t\t
size: %08x
\n
"
"
\t\t\t
characteristics: %08x"
,
sym_file
->
unknown1
,
sym_file
->
range
.
segment
,
sym_file
->
range
.
pad1
,
sym_file
->
range
.
offset
,
sym_file
->
range
.
size
,
sym_file
->
range
.
characteristics
);
dump_section_characteristics
(
sym_file
->
range
.
characteristics
,
" "
);
printf
(
"
\n
"
"
\t\t\t
index: %04x
\n
"
"
\t\t\t
pad2: %04x
\n
"
"
\t\t\t
timestamp: %08x
\n
"
"
\t\t\t
unknown: %08x
\n
"
"
\t\t
flag: %04x
\n
"
"
\t\t
stream: %04x
\n
"
"
\t\t
symb size: %08x
\n
"
"
\t\t
line size: %08x
\n
"
"
\t\t
line2 size: %08x
\n
"
"
\t\t
nSrcFiles: %08x
\n
"
"
\t\t
attribute: %08x
\n
"
"
\t\t
reserved/0: %08x
\n
"
"
\t\t
reserved/1: %08x
\n
"
,
sym_file
->
range
.
index
,
sym_file
->
range
.
pad2
,
sym_file
->
range
.
timestamp
,
sym_file
->
range
.
unknown
,
sym_file
->
flag
,
sym_file
->
stream
,
sym_file
->
symbol_size
,
sym_file
->
lineno_size
,
sym_file
->
lineno2_size
,
sym_file
->
nSrcFiles
,
sym_file
->
attribute
,
sym_file
->
reserved
[
0
],
sym_file
->
reserved
[
1
]);
file
=
pdb_dump_dbi_module
(
reader
,
(
const
PDB_SYMBOL_FILE_EX
*
)
file
,
NULL
,
filesimage
);
}
modimage
=
reader
->
read_stream
(
reader
,
stream_nr
);
if
(
modimage
)
{
int
total_size
=
pdb_get_stream_size
(
reader
,
stream_nr
);
if
(
symbol_size
)
codeview_dump_symbols
((
const
char
*
)
modimage
,
sizeof
(
DWORD
),
symbol_size
);
/* line number info */
if
(
lineno_size
)
codeview_dump_linetab
((
const
char
*
)
modimage
+
symbol_size
,
TRUE
,
" "
);
else
if
(
lineno2_size
)
/* actually, only one of the 2 lineno should be present */
codeview_dump_linetab2
((
const
char
*
)
modimage
+
symbol_size
,
lineno2_size
,
filesimage
,
" "
);
/* what's that part ??? */
if
(
0
)
dump_data
(
modimage
+
symbol_size
+
lineno_size
+
lineno2_size
,
total_size
-
(
symbol_size
+
lineno_size
+
lineno2_size
),
" "
);
free
(
modimage
);
}
file
=
(
char
*
)((
DWORD_PTR
)(
lib_name
+
strlen
(
lib_name
)
+
1
+
3
)
&
~
3
);
}
dump_global_symbol
(
reader
,
symbols
->
global_hash_stream
);
dump_public_symbol
(
reader
,
symbols
->
public_stream
);
...
...
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