winedump: Correct and update a couple of infos in PDB symbol stream header.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-08-24 11:12:45 +02:00 committed by Alexandre Julliard
parent 8a9117ef68
commit 5ddcb94af6
3 changed files with 67 additions and 20 deletions

View File

@ -2392,8 +2392,8 @@ 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->hash1_file = old->hash1_file;
symbols->hash2_file = old->hash2_file;
symbols->global_file = old->global_file;
symbols->public_file = old->public_file;
symbols->gsym_file = old->gsym_file;
*header_size = sizeof(PDB_SYMBOLS_OLD);

View File

@ -2367,8 +2367,8 @@ typedef struct _PDB_SYMBOL_IMPORT
typedef struct _PDB_SYMBOLS_OLD
{
WORD hash1_file;
WORD hash2_file;
WORD global_file;
WORD public_file;
WORD gsym_file;
WORD pad;
DWORD module_size;
@ -2381,11 +2381,13 @@ typedef struct _PDB_SYMBOLS
{
DWORD signature;
DWORD version;
DWORD unknown;
DWORD hash1_file;
DWORD hash2_file;
DWORD age;
WORD global_file;
WORD flags;
WORD public_file;
WORD bldVer;
WORD gsym_file;
WORD unknown1;
WORD rbldVer;
DWORD module_size;
DWORD offset_size;
DWORD hash_size;

View File

@ -222,6 +222,36 @@ static void *read_string_table(struct pdb_reader* reader)
return NULL;
}
static void dump_global_symbol(struct pdb_reader* reader, unsigned file)
{
void* global = NULL;
DWORD size;
global = reader->read_file(reader, file);
if (!global) return;
size = pdb_get_file_size(reader, file);
printf("Global symbols table:\n");
dump_data(global, size, "\t");
free(global);
}
static void dump_public_symbol(struct pdb_reader* reader, unsigned file)
{
void* public = NULL;
DWORD size;
public = reader->read_file(reader, file);
if (!public) return;
size = pdb_get_file_size(reader, file);
printf("Public symbols table:\n");
dump_data(public, size, "\t");
free(public);
}
static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx)
{
PDB_SYMBOLS* symbols;
@ -229,6 +259,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
const char* file;
char* filesimage;
DWORD filessize = 0;
char tcver[32];
sidx->FPO = sidx->unk0 = sidx->unk1 = sidx->unk2 = sidx->unk3 = sidx->segments =
sidx->unk4 = sidx->unk5 = sidx->unk6 = sidx->FPO_EXT = sidx->unk7 = -1;
@ -246,14 +277,20 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
default:
printf("-Unknown symbol info version %d\n", symbols->version);
}
if (symbols->flags & 0x8000) /* new */
snprintf(tcver, sizeof(tcver), "%u.%u", (symbols->flags >> 8) & 0x7f, symbols->flags & 0xff);
else
snprintf(tcver, sizeof(tcver), "old-%x", symbols->flags);
printf("Symbols:\n"
"\tsignature: %08x\n"
"\tversion: %u\n"
"\tunknown: %08x\n"
"\thash1_file: %08x\n"
"\thash2_file: %08x\n"
"\tgsym_file: %04x\n"
"\tunknown1: %04x\n"
"\tage: %08x\n"
"\tglobal_file: %u\n"
"\tbuilder: %s\n"
"\tpublic_file: %u\n"
"\tbldVer: %u\n"
"\tgsym_file: %u\n"
"\trbldVer: %u\n"
"\tmodule_size: %08x\n"
"\toffset_size: %08x\n"
"\thash_size: %08x\n"
@ -264,14 +301,16 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
"\tunknown2_size: %08x\n"
"\tresvd3: %04x\n"
"\tmachine: %s\n"
"\tresvd[4] %08x\n",
"\tresvd4 %08x\n",
symbols->signature,
symbols->version,
symbols->unknown,
symbols->hash1_file,
symbols->hash2_file,
symbols->age,
symbols->global_file,
tcver, /* from symbols->flags */
symbols->public_file,
symbols->bldVer,
symbols->gsym_file,
symbols->unknown1,
symbols->rbldVer,
symbols->module_size,
symbols->offset_size,
symbols->hash_size,
@ -558,6 +597,8 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
file_name += strlen(file_name) + 1;
file = (char*)((DWORD_PTR)(file_name + strlen(file_name) + 1 + 3) & ~3);
}
dump_global_symbol(reader, symbols->global_file);
dump_public_symbol(reader, symbols->public_file);
free(symbols);
free(filesimage);
}
@ -883,18 +924,22 @@ static void pdb_ds_dump(void)
reader.u.ds.header->unknown2,
reader.u.ds.header->toc_page);
/* files:
* 0: JG says old toc pages, I'd say free pages (tbc, low prio)
/* files with static indexes:
* 0: JG says old toc pages
* 1: root structure
* 2: types
* 3: modules
* 4: types (second stream)
* other known streams:
* - string table: its index is in the stream table from ROOT object under "/names"
* - type hash table: its index is in the types header (2 and 4)
* - global and public streams: from symbol stream header
* those streams get their indexes out of the PDB_STREAM_INDEXES object
* - FPO data
* - segments
* - extended FPO data
*/
reader.file_used[0] |= 1; /* mark stream #0 as read */
reader.u.ds.root = reader.read_file(&reader, 1);
if (reader.u.ds.root)
{