Commit cf71edaa authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedump: Dump correctly ranges part of DBI stream.

The ranges describe for a PE image all the contributions of each compilation unit towards the various sections. Renaming offset_size into ranges_size which is closer to its actual content. Signed-off-by: 's avatarEric Pouech <eric.pouech@gmail.com>
parent a0d4a58a
...@@ -3270,7 +3270,7 @@ static void pdb_convert_symbols_header(PDB_SYMBOLS* symbols, ...@@ -3270,7 +3270,7 @@ static void pdb_convert_symbols_header(PDB_SYMBOLS* symbols,
const PDB_SYMBOLS_OLD* old = (const PDB_SYMBOLS_OLD*)image; const PDB_SYMBOLS_OLD* old = (const PDB_SYMBOLS_OLD*)image;
symbols->version = 0; symbols->version = 0;
symbols->module_size = old->module_size; symbols->module_size = old->module_size;
symbols->offset_size = old->offset_size; symbols->sectcontrib_size = old->sectcontrib_size;
symbols->hash_size = old->hash_size; symbols->hash_size = old->hash_size;
symbols->srcmodule_size = old->srcmodule_size; symbols->srcmodule_size = old->srcmodule_size;
symbols->pdbimport_size = 0; symbols->pdbimport_size = 0;
...@@ -3633,8 +3633,8 @@ static void pdb_process_symbol_imports(const struct process* pcs, ...@@ -3633,8 +3633,8 @@ static void pdb_process_symbol_imports(const struct process* pcs,
int i = 0; int i = 0;
struct pdb_file_info sf0 = pdb_module_info->pdb_files[0]; struct pdb_file_info sf0 = pdb_module_info->pdb_files[0];
imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) + imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) +
symbols->module_size + symbols->offset_size + symbols->module_size + symbols->sectcontrib_size +
symbols->hash_size + symbols->srcmodule_size); symbols->hash_size + symbols->srcmodule_size);
first = imp; first = imp;
last = (const char*)imp + symbols->pdbimport_size; last = (const char*)imp + symbols->pdbimport_size;
...@@ -3745,7 +3745,7 @@ static BOOL pdb_process_internal(const struct process* pcs, ...@@ -3745,7 +3745,7 @@ static BOOL pdb_process_internal(const struct process* pcs,
break; break;
case sizeof(PDB_STREAM_INDEXES): case sizeof(PDB_STREAM_INDEXES):
psi = (PDB_STREAM_INDEXES*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) + psi = (PDB_STREAM_INDEXES*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) +
symbols.module_size + symbols.offset_size + symbols.module_size + symbols.sectcontrib_size +
symbols.hash_size + symbols.srcmodule_size + symbols.hash_size + symbols.srcmodule_size +
symbols.pdbimport_size + symbols.unknown2_size); symbols.pdbimport_size + symbols.unknown2_size);
pdb_file->fpoext_stream = psi->FPO_EXT; pdb_file->fpoext_stream = psi->FPO_EXT;
......
...@@ -2539,7 +2539,7 @@ typedef struct _PDB_SYMBOLS_OLD ...@@ -2539,7 +2539,7 @@ typedef struct _PDB_SYMBOLS_OLD
unsigned short gsym_stream; unsigned short gsym_stream;
unsigned short pad; unsigned short pad;
unsigned int module_size; unsigned int module_size;
unsigned int offset_size; unsigned int sectcontrib_size;
unsigned int hash_size; unsigned int hash_size;
unsigned int srcmodule_size; unsigned int srcmodule_size;
} PDB_SYMBOLS_OLD, *PPDB_SYMBOLS_OLD; } PDB_SYMBOLS_OLD, *PPDB_SYMBOLS_OLD;
...@@ -2556,7 +2556,7 @@ typedef struct _PDB_SYMBOLS ...@@ -2556,7 +2556,7 @@ typedef struct _PDB_SYMBOLS
unsigned short gsym_stream; unsigned short gsym_stream;
unsigned short rbldVer; unsigned short rbldVer;
unsigned int module_size; unsigned int module_size;
unsigned int offset_size; unsigned int sectcontrib_size;
unsigned int hash_size; unsigned int hash_size;
unsigned int srcmodule_size; unsigned int srcmodule_size;
unsigned int pdbimport_size; unsigned int pdbimport_size;
......
...@@ -370,7 +370,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -370,7 +370,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
"\tgsym_stream: %u\n" "\tgsym_stream: %u\n"
"\trbldVer: %u\n" "\trbldVer: %u\n"
"\tmodule_size: %08x\n" "\tmodule_size: %08x\n"
"\toffset_size: %08x\n" "\tsectcontrib_size: %08x\n"
"\thash_size: %08x\n" "\thash_size: %08x\n"
"\tsrc_module_size: %08x\n" "\tsrc_module_size: %08x\n"
"\tpdbimport_size: %08x\n" "\tpdbimport_size: %08x\n"
...@@ -390,7 +390,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -390,7 +390,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
symbols->gsym_stream, symbols->gsym_stream,
symbols->rbldVer, symbols->rbldVer,
symbols->module_size, symbols->module_size,
symbols->offset_size, symbols->sectcontrib_size,
symbols->hash_size, symbols->hash_size,
symbols->srcmodule_size, symbols->srcmodule_size,
symbols->pdbimport_size, symbols->pdbimport_size,
...@@ -401,13 +401,64 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -401,13 +401,64 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
get_machine_str( symbols->machine ), get_machine_str( symbols->machine ),
symbols->resvd4); symbols->resvd4);
if (symbols->offset_size) if (symbols->sectcontrib_size)
{ {
const BYTE* src; const BYTE* src = (const BYTE*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size;
const BYTE* last = src + symbols->sectcontrib_size;
printf("\t----------offsets------------\n"); unsigned version, size;
src = (const BYTE*)((const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size);
dump_data(src, symbols->offset_size, " "); printf("\t----------section contrib------------\n");
version = *(unsigned*)src;
printf("\tVersion: %#x (%d)\n", version, version - 0xeffe0000);
switch (version)
{
case 0xeffe0000 + 19970605: size = sizeof(PDB_SYMBOL_RANGE_EX); break;
case 0xeffe0000 + 20140516: size = sizeof(PDB_SYMBOL_RANGE_EX) + sizeof(unsigned); break;
default: printf("\t\tUnsupported version number\n"); size = 0;
}
if (size)
{
const PDB_SYMBOL_RANGE_EX* range;
if ((symbols->sectcontrib_size - sizeof(unsigned)) % size)
printf("Incoherent size: %zu = %zu * %u + %zu\n",
symbols->sectcontrib_size - sizeof(unsigned),
(symbols->sectcontrib_size - sizeof(unsigned)) / size,
size,
(symbols->sectcontrib_size - sizeof(unsigned)) % size);
if ((symbols->sectcontrib_size - sizeof(unsigned)) % size)
if ((symbols->sectcontrib_size - sizeof(unsigned)) % size)
src += sizeof(unsigned);
while (src + size <= last)
{
range = (const PDB_SYMBOL_RANGE_EX*)(src + sizeof(unsigned));
printf("\tRange #%tu\n",
((const BYTE*)range - ((const BYTE*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size)) / size);
printf("\t\tsegment: %04x\n"
"\t\tpad1: %04x\n"
"\t\toffset: %08x\n"
"\t\tsize: %08x\n"
"\t\tcharacteristics: %08x",
range->segment,
range->pad1,
range->offset,
range->size,
range->characteristics);
dump_section_characteristics(range->characteristics, " ");
printf("\n"
"\t\tindex: %04x\n"
"\t\tpad2: %04x\n"
"\t\ttimestamp: %08x\n"
"\t\tunknown: %08x\n",
range->index,
range->pad2,
range->timestamp,
range->unknown);
if (version == 0xeffe0000 + 20140516)
printf("\t\tcoff_section: %08x\n", *(unsigned*)(range + 1));
src += size;
}
}
} }
if (!(filesimage = read_string_table(reader))) printf("string table not found\n"); if (!(filesimage = read_string_table(reader))) printf("string table not found\n");
...@@ -422,8 +473,8 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -422,8 +473,8 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
const char* cstr; const char* cstr;
printf("\t----------src module------------\n"); printf("\t----------src module------------\n");
src = (const PDB_SYMBOL_SOURCE*)((const char*)symbols + sizeof(PDB_SYMBOLS) + src = (const PDB_SYMBOL_SOURCE*)((const char*)symbols + sizeof(PDB_SYMBOLS) +
symbols->module_size + symbols->offset_size + symbols->hash_size); symbols->module_size + symbols->sectcontrib_size + symbols->hash_size);
printf("\tSource Modules\n" printf("\tSource Modules\n"
"\t\tnModules: %u\n" "\t\tnModules: %u\n"
"\t\tnSrcFiles: %u\n", "\t\tnSrcFiles: %u\n",
...@@ -468,8 +519,8 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -468,8 +519,8 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
const char* ptr; const char* ptr;
printf("\t------------import--------------\n"); printf("\t------------import--------------\n");
imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols + sizeof(PDB_SYMBOLS) + imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols + sizeof(PDB_SYMBOLS) +
symbols->module_size + symbols->offset_size + symbols->module_size + symbols->sectcontrib_size +
symbols->hash_size + symbols->srcmodule_size); symbols->hash_size + symbols->srcmodule_size);
first = (const char*)imp; first = (const char*)imp;
last = (const char*)imp + symbols->pdbimport_size; last = (const char*)imp + symbols->pdbimport_size;
...@@ -504,7 +555,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -504,7 +555,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
*/ */
memcpy(sidx, memcpy(sidx,
(const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + (const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size +
symbols->offset_size + symbols->hash_size + symbols->srcmodule_size + symbols->sectcontrib_size + symbols->hash_size + symbols->srcmodule_size +
symbols->pdbimport_size + symbols->unknown2_size, symbols->pdbimport_size + symbols->unknown2_size,
sizeof(PDB_STREAM_INDEXES_OLD)); sizeof(PDB_STREAM_INDEXES_OLD));
printf("\tFPO: %04x\n" printf("\tFPO: %04x\n"
...@@ -519,7 +570,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -519,7 +570,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
case sizeof(PDB_STREAM_INDEXES): case sizeof(PDB_STREAM_INDEXES):
memcpy(sidx, memcpy(sidx,
(const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + (const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size +
symbols->offset_size + symbols->hash_size + symbols->srcmodule_size + symbols->sectcontrib_size + symbols->hash_size + symbols->srcmodule_size +
symbols->pdbimport_size + symbols->unknown2_size, symbols->pdbimport_size + symbols->unknown2_size,
sizeof(*sidx)); sizeof(*sidx));
printf("\tFPO: %04x\n" printf("\tFPO: %04x\n"
...@@ -578,7 +629,15 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -578,7 +629,15 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
"\t\t\tpad1: %04x\n" "\t\t\tpad1: %04x\n"
"\t\t\toffset: %08x\n" "\t\t\toffset: %08x\n"
"\t\t\tsize: %08x\n" "\t\t\tsize: %08x\n"
"\t\t\tcharacteristics: %08x\n" "\t\t\tcharacteristics: %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\tindex: %04x\n" "\t\t\tindex: %04x\n"
"\t\t\tpad2: %04x\n" "\t\t\tpad2: %04x\n"
"\t\tflag: %04x\n" "\t\tflag: %04x\n"
...@@ -588,12 +647,6 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -588,12 +647,6 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
"\t\tline2 size: %08x\n" "\t\tline2 size: %08x\n"
"\t\tnSrcFiles: %08x\n" "\t\tnSrcFiles: %08x\n"
"\t\tattribute: %08x\n", "\t\tattribute: %08x\n",
sym_file->unknown1,
sym_file->range.segment,
sym_file->range.pad1,
sym_file->range.offset,
sym_file->range.size,
sym_file->range.characteristics,
sym_file->range.index, sym_file->range.index,
sym_file->range.pad2, sym_file->range.pad2,
sym_file->flag, sym_file->flag,
...@@ -623,7 +676,15 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -623,7 +676,15 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
"\t\t\tpad1: %04x\n" "\t\t\tpad1: %04x\n"
"\t\t\toffset: %08x\n" "\t\t\toffset: %08x\n"
"\t\t\tsize: %08x\n" "\t\t\tsize: %08x\n"
"\t\t\tcharacteristics: %08x\n" "\t\t\tcharacteristics: %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\tindex: %04x\n" "\t\t\tindex: %04x\n"
"\t\t\tpad2: %04x\n" "\t\t\tpad2: %04x\n"
"\t\t\ttimestamp: %08x\n" "\t\t\ttimestamp: %08x\n"
...@@ -637,12 +698,6 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx ...@@ -637,12 +698,6 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx
"\t\tattribute: %08x\n" "\t\tattribute: %08x\n"
"\t\treserved/0: %08x\n" "\t\treserved/0: %08x\n"
"\t\treserved/1: %08x\n", "\t\treserved/1: %08x\n",
sym_file->unknown1,
sym_file->range.segment,
sym_file->range.pad1,
sym_file->range.offset,
sym_file->range.size,
sym_file->range.characteristics,
sym_file->range.index, sym_file->range.index,
sym_file->range.pad2, sym_file->range.pad2,
sym_file->range.timestamp, sym_file->range.timestamp,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment