[PATCH 0/5] MR2087: More winedump improvement over PDB dumping.
Continueing PDB support in winedump: - stricter size checks (to protect against bogus files) - more bits of PDB files dumped (ranges, sections, OMF details...) - keeping cleaning up some internal fields names -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2087
From: Eric Pouech <eric.pouech(a)gmail.com> This stream actually contains PE's IMAGE_SECTION_HEADER. So reflect the content by renaming segment into section, and use some helpers winedump's pe side. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- include/wine/mscvpdb.h | 4 ++-- tools/winedump/pdb.c | 51 ++++++++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index 7aff95c3e76..9563a70e1ce 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -2575,7 +2575,7 @@ typedef struct unsigned short unk1; unsigned short unk2; unsigned short unk3; - unsigned short segments; + unsigned short sections_stream; } PDB_STREAM_INDEXES_OLD; typedef struct @@ -2585,7 +2585,7 @@ typedef struct unsigned short unk1; unsigned short unk2; unsigned short unk3; - unsigned short segments; + unsigned short sections_stream; unsigned short unk4; unsigned short unk5; unsigned short unk6; diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c index 31f4fd3bc46..e98776c67b9 100644 --- a/tools/winedump/pdb.c +++ b/tools/winedump/pdb.c @@ -336,7 +336,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx PDB_STRING_TABLE* filesimage; char tcver[32]; - sidx->FPO = sidx->unk0 = sidx->unk1 = sidx->unk2 = sidx->unk3 = sidx->segments = + sidx->FPO = sidx->unk0 = sidx->unk1 = sidx->unk2 = sidx->unk3 = sidx->sections_stream = sidx->unk4 = sidx->unk5 = sidx->unk6 = sidx->FPO_EXT = sidx->unk7 = -1; symbols = reader->read_stream(reader, 3); @@ -509,9 +509,9 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\t?: %04x\n" "\t?: %04x\n" "\t?: %04x\n" - "\tSegments: %04x\n", + "\tSections stream: %04x\n", sidx->FPO, sidx->unk0, sidx->unk1, sidx->unk2, sidx->unk3, - sidx->segments); + sidx->sections_stream); break; case sizeof(PDB_STREAM_INDEXES): memcpy(sidx, @@ -524,14 +524,14 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\t?: %04x\n" "\t?: %04x\n" "\t?: %04x\n" - "\tSegments: %04x\n" + "\tSection stream: %04x\n" "\t?: %04x\n" "\t?: %04x\n" "\t?: %04x\n" "\tFPO-ext: %04x\n" "\t?: %04x\n", sidx->FPO, sidx->unk0, sidx->unk1, sidx->unk2, sidx->unk3, - sidx->segments, sidx->unk4, sidx->unk5, sidx->unk6, sidx->FPO_EXT, + sidx->sections_stream, sidx->unk4, sidx->unk5, sidx->unk6, sidx->FPO_EXT, sidx->unk7); break; default: @@ -957,33 +957,36 @@ static void pdb_dump_fpo_ext(struct pdb_reader* reader, unsigned stream_idx) free(strbase); } -static void pdb_dump_segments(struct pdb_reader* reader, unsigned stream_idx) +static void pdb_dump_sections(struct pdb_reader* reader, unsigned stream_idx) { - const char* segs; - DWORD size; - const char* ptr; + const char* segs; + DWORD size; + const IMAGE_SECTION_HEADER* sect_hdr; if (stream_idx == (WORD)-1) return; segs = reader->read_stream(reader, stream_idx); if (segs) { + printf("Sections:\n"); size = pdb_get_stream_size(reader, stream_idx); - for (ptr = segs; ptr < segs + size; ) + for (sect_hdr = (const IMAGE_SECTION_HEADER*)segs; (const char*)sect_hdr < segs + size; sect_hdr++) { - printf("Segment %s\n", ptr); - ptr += (strlen(ptr) + 1 + 3) & ~3; - printf("\tdword[0]: %08x\n", *(UINT *)ptr); ptr += 4; - printf("\tdword[1]: %08x\n", *(UINT *)ptr); ptr += 4; - printf("\tdword[2]: %08x\n", *(UINT *)ptr); ptr += 4; - printf("\tdword[3]: %08x\n", *(UINT *)ptr); ptr += 4; - printf("\tdword[4]: %08x\n", *(UINT *)ptr); ptr += 4; - printf("\tdword[5]: %08x\n", *(UINT *)ptr); ptr += 4; - printf("\tdword[6]: %08x\n", *(UINT *)ptr); ptr += 4; - printf("\tdword[7]: %08x\n", *(UINT *)ptr); ptr += 4; + printf("\tSection: %-8.8s\n", sect_hdr->Name); + printf("\t\tVirtual size: %08x\n", (unsigned)sect_hdr->Misc.VirtualSize); + printf("\t\tVirtualAddress: %08x\n", (unsigned)sect_hdr->VirtualAddress); + printf("\t\tSizeOfRawData: %08x\n", (unsigned)sect_hdr->SizeOfRawData); + printf("\t\tPointerToRawData: %08x\n", (unsigned)sect_hdr->PointerToRawData); + printf("\t\tPointerToRelocations: %08x\n", (unsigned)sect_hdr->PointerToRelocations); + printf("\t\tPointerToLinenumbers: %08x\n", (unsigned)sect_hdr->PointerToLinenumbers); + printf("\t\tNumberOfRelocations: %u\n", (unsigned)sect_hdr->NumberOfRelocations); + printf("\t\tNumberOfLinenumbers: %u\n", (unsigned)sect_hdr->NumberOfLinenumbers); + printf("\t\tCharacteristics: %08x", (unsigned)sect_hdr->Characteristics); + dump_section_characteristics(sect_hdr->Characteristics, " "); + printf("\n"); } free((char*)segs); - } else printf("nosdfsdffd\n"); + } } static const char pdb2[] = "Microsoft C/C++ program database 2.00"; @@ -1071,7 +1074,7 @@ static void pdb_jg_dump(void) pdb_dump_types(&reader, 4, "IPI"); pdb_dump_symbols(&reader, &sidx); pdb_dump_fpo(&reader, sidx.FPO); - pdb_dump_segments(&reader, sidx.segments); + pdb_dump_sections(&reader, sidx.sections_stream); } else printf("-Unable to get root\n"); @@ -1161,7 +1164,7 @@ static void pdb_ds_dump(void) * - global and public streams: from symbol stream header * those streams get their indexes out of the PDB_STREAM_INDEXES object * - FPO data - * - segments + * - sections * - extended FPO data */ mark_stream_been_read(&reader, 0); /* mark stream #0 as read */ @@ -1219,7 +1222,7 @@ static void pdb_ds_dump(void) pdb_dump_symbols(&reader, &sidx); pdb_dump_fpo(&reader, sidx.FPO); pdb_dump_fpo_ext(&reader, sidx.FPO_EXT); - pdb_dump_segments(&reader, sidx.segments); + pdb_dump_sections(&reader, sidx.sections_stream); } else printf("-Unable to get root\n"); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2087
From: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- tools/winedump/pdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c index e98776c67b9..5ab1b515691 100644 --- a/tools/winedump/pdb.c +++ b/tools/winedump/pdb.c @@ -249,7 +249,10 @@ static void dump_dbi_hash_table(const BYTE* root, unsigned size, const char* nam sizeof(DBI_HASH_HEADER) + hdr->hash_records_size + DBI_BITMAP_HASH_SIZE > size || (size - (sizeof(DBI_HASH_HEADER) + hdr->hash_records_size + DBI_BITMAP_HASH_SIZE)) % sizeof(unsigned)) { - printf("%s\t\tIncorrect hash structure\n", pfx); + if (size >= sizeof(DBI_HASH_HEADER) && !hdr->hash_records_size) + printf("%s\t\tEmpty hash structure\n", pfx); + else + printf("%s\t\tIncorrect hash structure\n", pfx); } else { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2087
From: Eric Pouech <eric.pouech(a)gmail.com> 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: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/dbghelp/msc.c | 8 +-- include/wine/mscvpdb.h | 4 +- tools/winedump/pdb.c | 111 ++++++++++++++++++++++++++++++----------- 3 files changed, 89 insertions(+), 34 deletions(-) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 1ecb01024d1..5f149e88b94 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3270,7 +3270,7 @@ static void pdb_convert_symbols_header(PDB_SYMBOLS* symbols, const PDB_SYMBOLS_OLD* old = (const PDB_SYMBOLS_OLD*)image; symbols->version = 0; 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->srcmodule_size = old->srcmodule_size; symbols->pdbimport_size = 0; @@ -3633,8 +3633,8 @@ static void pdb_process_symbol_imports(const struct process* pcs, int i = 0; struct pdb_file_info sf0 = pdb_module_info->pdb_files[0]; - imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) + - symbols->module_size + symbols->offset_size + + imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) + + symbols->module_size + symbols->sectcontrib_size + symbols->hash_size + symbols->srcmodule_size); first = imp; last = (const char*)imp + symbols->pdbimport_size; @@ -3745,7 +3745,7 @@ static BOOL pdb_process_internal(const struct process* pcs, break; case sizeof(PDB_STREAM_INDEXES): 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.pdbimport_size + symbols.unknown2_size); pdb_file->fpoext_stream = psi->FPO_EXT; diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index 9563a70e1ce..efd88608a7f 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -2539,7 +2539,7 @@ typedef struct _PDB_SYMBOLS_OLD unsigned short gsym_stream; unsigned short pad; unsigned int module_size; - unsigned int offset_size; + unsigned int sectcontrib_size; unsigned int hash_size; unsigned int srcmodule_size; } PDB_SYMBOLS_OLD, *PPDB_SYMBOLS_OLD; @@ -2556,7 +2556,7 @@ typedef struct _PDB_SYMBOLS unsigned short gsym_stream; unsigned short rbldVer; unsigned int module_size; - unsigned int offset_size; + unsigned int sectcontrib_size; unsigned int hash_size; unsigned int srcmodule_size; unsigned int pdbimport_size; diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c index 5ab1b515691..5dacb948bdf 100644 --- a/tools/winedump/pdb.c +++ b/tools/winedump/pdb.c @@ -370,7 +370,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\tgsym_stream: %u\n" "\trbldVer: %u\n" "\tmodule_size: %08x\n" - "\toffset_size: %08x\n" + "\tsectcontrib_size: %08x\n" "\thash_size: %08x\n" "\tsrc_module_size: %08x\n" "\tpdbimport_size: %08x\n" @@ -390,7 +390,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx symbols->gsym_stream, symbols->rbldVer, symbols->module_size, - symbols->offset_size, + symbols->sectcontrib_size, symbols->hash_size, symbols->srcmodule_size, symbols->pdbimport_size, @@ -401,13 +401,64 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx get_machine_str( symbols->machine ), symbols->resvd4); - if (symbols->offset_size) + if (symbols->sectcontrib_size) { - const BYTE* src; - - printf("\t----------offsets------------\n"); - src = (const BYTE*)((const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size); - dump_data(src, symbols->offset_size, " "); + const BYTE* src = (const BYTE*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size; + const BYTE* last = src + symbols->sectcontrib_size; + unsigned version, 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"); @@ -422,8 +473,8 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx const char* cstr; printf("\t----------src module------------\n"); - src = (const PDB_SYMBOL_SOURCE*)((const char*)symbols + sizeof(PDB_SYMBOLS) + - symbols->module_size + symbols->offset_size + symbols->hash_size); + src = (const PDB_SYMBOL_SOURCE*)((const char*)symbols + sizeof(PDB_SYMBOLS) + + symbols->module_size + symbols->sectcontrib_size + symbols->hash_size); printf("\tSource Modules\n" "\t\tnModules: %u\n" "\t\tnSrcFiles: %u\n", @@ -468,8 +519,8 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx const char* ptr; printf("\t------------import--------------\n"); - imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols + sizeof(PDB_SYMBOLS) + - symbols->module_size + symbols->offset_size + + imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols + sizeof(PDB_SYMBOLS) + + symbols->module_size + symbols->sectcontrib_size + symbols->hash_size + symbols->srcmodule_size); first = (const char*)imp; last = (const char*)imp + symbols->pdbimport_size; @@ -504,7 +555,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx */ memcpy(sidx, (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, sizeof(PDB_STREAM_INDEXES_OLD)); printf("\tFPO: %04x\n" @@ -519,7 +570,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx case sizeof(PDB_STREAM_INDEXES): memcpy(sidx, (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, sizeof(*sidx)); printf("\tFPO: %04x\n" @@ -578,7 +629,15 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\t\t\tpad1: %04x\n" "\t\t\toffset: %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\tpad2: %04x\n" "\t\tflag: %04x\n" @@ -588,12 +647,6 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\t\tline2 size: %08x\n" "\t\tnSrcFiles: %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.pad2, sym_file->flag, @@ -623,7 +676,15 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\t\t\tpad1: %04x\n" "\t\t\toffset: %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\tpad2: %04x\n" "\t\t\ttimestamp: %08x\n" @@ -637,12 +698,6 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\t\tattribute: %08x\n" "\t\treserved/0: %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.pad2, sym_file->range.timestamp, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2087
From: Eric Pouech <eric.pouech(a)gmail.com> Changing fields' names to match better their content. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/dbghelp/msc.c | 6 +++--- include/wine/mscvpdb.h | 4 ++-- tools/winedump/pdb.c | 43 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 5f149e88b94..d4aef183677 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3271,7 +3271,7 @@ static void pdb_convert_symbols_header(PDB_SYMBOLS* symbols, symbols->version = 0; symbols->module_size = old->module_size; symbols->sectcontrib_size = old->sectcontrib_size; - symbols->hash_size = old->hash_size; + symbols->segmap_size = old->segmap_size; symbols->srcmodule_size = old->srcmodule_size; symbols->pdbimport_size = 0; symbols->global_hash_stream = old->global_hash_stream; @@ -3635,7 +3635,7 @@ static void pdb_process_symbol_imports(const struct process* pcs, imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) + symbols->module_size + symbols->sectcontrib_size + - symbols->hash_size + symbols->srcmodule_size); + symbols->segmap_size + symbols->srcmodule_size); first = imp; last = (const char*)imp + symbols->pdbimport_size; while (imp < (const PDB_SYMBOL_IMPORT*)last) @@ -3746,7 +3746,7 @@ static BOOL pdb_process_internal(const struct process* pcs, case sizeof(PDB_STREAM_INDEXES): psi = (PDB_STREAM_INDEXES*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) + symbols.module_size + symbols.sectcontrib_size + - symbols.hash_size + symbols.srcmodule_size + + symbols.segmap_size + symbols.srcmodule_size + symbols.pdbimport_size + symbols.unknown2_size); pdb_file->fpoext_stream = psi->FPO_EXT; break; diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index efd88608a7f..19fcab33ab9 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -2540,7 +2540,7 @@ typedef struct _PDB_SYMBOLS_OLD unsigned short pad; unsigned int module_size; unsigned int sectcontrib_size; - unsigned int hash_size; + unsigned int segmap_size; unsigned int srcmodule_size; } PDB_SYMBOLS_OLD, *PPDB_SYMBOLS_OLD; @@ -2557,7 +2557,7 @@ typedef struct _PDB_SYMBOLS unsigned short rbldVer; unsigned int module_size; unsigned int sectcontrib_size; - unsigned int hash_size; + unsigned int segmap_size; unsigned int srcmodule_size; unsigned int pdbimport_size; unsigned int resvd0; diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c index 5dacb948bdf..787a62fe624 100644 --- a/tools/winedump/pdb.c +++ b/tools/winedump/pdb.c @@ -371,7 +371,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx "\trbldVer: %u\n" "\tmodule_size: %08x\n" "\tsectcontrib_size: %08x\n" - "\thash_size: %08x\n" + "\tsegmap_size: %08x\n" "\tsrc_module_size: %08x\n" "\tpdbimport_size: %08x\n" "\tresvd0: %08x\n" @@ -391,7 +391,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx symbols->rbldVer, symbols->module_size, symbols->sectcontrib_size, - symbols->hash_size, + symbols->segmap_size, symbols->srcmodule_size, symbols->pdbimport_size, symbols->resvd0, @@ -474,7 +474,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx printf("\t----------src module------------\n"); src = (const PDB_SYMBOL_SOURCE*)((const char*)symbols + sizeof(PDB_SYMBOLS) + - symbols->module_size + symbols->sectcontrib_size + symbols->hash_size); + symbols->module_size + symbols->sectcontrib_size + symbols->segmap_size); printf("\tSource Modules\n" "\t\tnModules: %u\n" "\t\tnSrcFiles: %u\n", @@ -521,7 +521,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx printf("\t------------import--------------\n"); imp = (const PDB_SYMBOL_IMPORT*)((const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + symbols->sectcontrib_size + - symbols->hash_size + symbols->srcmodule_size); + symbols->segmap_size + symbols->srcmodule_size); first = (const char*)imp; last = (const char*)imp + symbols->pdbimport_size; while (imp < (const PDB_SYMBOL_IMPORT*)last) @@ -544,6 +544,37 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx imp = (const PDB_SYMBOL_IMPORT*)(first + ((ptr - first + strlen(ptr) + 1 + 3) & ~3)); } } + if (symbols->segmap_size) + { + const struct OMFSegMap* segmap = (const struct OMFSegMap*)((const BYTE*)symbols + sizeof(PDB_SYMBOLS) + + symbols->module_size + symbols->sectcontrib_size); + const struct OMFSegMapDesc* desc = (const struct OMFSegMapDesc*)(segmap + 1); + + printf("\t--------------segment map----------------\n"); + printf("\tNumber of segments: %x\n", segmap->cSeg); + printf("\tNumber of logical segments: %x\n", segmap->cSegLog); + /* FIXME check mapping old symbols */ + for (; (const BYTE*)(desc + 1) <= ((const BYTE*)(segmap + 1) + symbols->segmap_size); desc++) + { + printf("\t\tSegment descriptor #%tu\n", desc - (const struct OMFSegMapDesc*)(segmap + 1)); + printf("\t\t\tFlags: %04x (%c%c%c%s%s%s%s)\n", + desc->flags, + (desc->flags & 0x01) ? 'R' : '-', + (desc->flags & 0x02) ? 'W' : '-', + (desc->flags & 0x04) ? 'X' : '-', + (desc->flags & 0x08) ? " 32bit-linear" : "", + (desc->flags & 0x100) ? " selector" : "", + (desc->flags & 0x200) ? " absolute" : "", + (desc->flags & 0x400) ? " group" : ""); + printf("\t\t\tOverlay: %04x\n", desc->ovl); + printf("\t\t\tGroup: %04x\n", desc->group); + printf("\t\t\tFrame: %04x\n", desc->frame); + printf("\t\t\tSegment name: %s\n", desc->iSegName == 0xffff ? "none" : pdb_get_string_table_entry(filesimage, desc->iSegName)); + printf("\t\t\tClass name: %s\n", desc->iClassName == 0xffff ? "none" : pdb_get_string_table_entry(filesimage, desc->iClassName)); + printf("\t\t\tOffset: %08x\n", desc->offset); + printf("\t\t\tSize: %04x\n", desc->cbSeg); + } + } if (symbols->stream_index_size) { printf("\t------------stream indexes--------------\n"); @@ -555,7 +586,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx */ memcpy(sidx, (const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + - symbols->sectcontrib_size + symbols->hash_size + symbols->srcmodule_size + + symbols->sectcontrib_size + symbols->segmap_size + symbols->srcmodule_size + symbols->pdbimport_size + symbols->unknown2_size, sizeof(PDB_STREAM_INDEXES_OLD)); printf("\tFPO: %04x\n" @@ -570,7 +601,7 @@ static void pdb_dump_symbols(struct pdb_reader* reader, PDB_STREAM_INDEXES* sidx case sizeof(PDB_STREAM_INDEXES): memcpy(sidx, (const char*)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + - symbols->sectcontrib_size + symbols->hash_size + symbols->srcmodule_size + + symbols->sectcontrib_size + symbols->segmap_size + symbols->srcmodule_size + symbols->pdbimport_size + symbols->unknown2_size, sizeof(*sidx)); printf("\tFPO: %04x\n" -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2087
From: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- tools/winedump/pdb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c index 787a62fe624..b13161c6c7a 100644 --- a/tools/winedump/pdb.c +++ b/tools/winedump/pdb.c @@ -637,6 +637,9 @@ 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) { int stream_nr, symbol_size, lineno_size, lineno2_size; const char* file_name; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2087
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=129003 Your paranoid android. === debian11 (build log) === /home/winetest/tools/testbot/var/wine-win32/../wine/tools/winedump/pdb.c:1077: undefined reference to `dump_section_characteristics' /home/winetest/tools/testbot/var/wine-win32/../wine/tools/winedump/pdb.c:673: undefined reference to `dump_section_characteristics' /usr/bin/ld: /home/winetest/tools/testbot/var/wine-win32/../wine/tools/winedump/pdb.c:720: undefined reference to `dump_section_characteristics' /usr/bin/ld: /home/winetest/tools/testbot/var/wine-win32/../wine/tools/winedump/pdb.c:447: undefined reference to `dump_section_characteristics' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed === debian11b (build log) === /home/winetest/tools/testbot/var/wine-wow64/../wine/tools/winedump/pdb.c:1077: undefined reference to `dump_section_characteristics' /home/winetest/tools/testbot/var/wine-wow64/../wine/tools/winedump/pdb.c:673: undefined reference to `dump_section_characteristics' /usr/bin/ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/tools/winedump/pdb.c:720: undefined reference to `dump_section_characteristics' /usr/bin/ld: /home/winetest/tools/testbot/var/wine-wow64/../wine/tools/winedump/pdb.c:447: undefined reference to `dump_section_characteristics' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed
participants (3)
-
Eric Pouech -
eric pouech (@epo) -
Marvin