dbghelp: Don't expected a fixed number of substreams in DBI header (PDB).
MSC no longer emits a fixed number of substreams (depending on version of PDB file), but can emit less. Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
dee3be21a3
commit
552bc893e1
3 changed files with 13 additions and 48 deletions
|
@ -3823,7 +3823,8 @@ static BOOL pdb_process_internal(const struct process* pcs,
|
|||
struct codeview_type_parse ipi_ctp;
|
||||
BYTE* file;
|
||||
int header_size = 0;
|
||||
PDB_STREAM_INDEXES* psi;
|
||||
unsigned num_sub_streams;
|
||||
const unsigned short* sub_streams;
|
||||
BOOL ipi_ok;
|
||||
|
||||
pdb_convert_symbols_header(&symbols, &header_size, symbols_image);
|
||||
|
@ -3839,25 +3840,14 @@ static BOOL pdb_process_internal(const struct process* pcs,
|
|||
symbols.version, symbols.version);
|
||||
}
|
||||
|
||||
switch (symbols.stream_index_size)
|
||||
{
|
||||
case 0:
|
||||
case sizeof(PDB_STREAM_INDEXES_OLD):
|
||||
/* no fpo ext stream in this case */
|
||||
break;
|
||||
case sizeof(PDB_STREAM_INDEXES):
|
||||
case sizeof(PDB_STREAM_INDEXES) + 2:
|
||||
psi = (PDB_STREAM_INDEXES*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) +
|
||||
symbols.module_size + symbols.sectcontrib_size +
|
||||
symbols.segmap_size + symbols.srcmodule_size +
|
||||
symbols.pdbimport_size + symbols.unknown2_size);
|
||||
pdb_file->fpoext_stream = psi->FPO_EXT;
|
||||
break;
|
||||
default:
|
||||
FIXME("Unknown PDB_STREAM_INDEXES size (%u)\n", symbols.stream_index_size);
|
||||
pdb_free(symbols_image);
|
||||
return FALSE;
|
||||
}
|
||||
num_sub_streams = symbols.stream_index_size / sizeof(sub_streams[0]);
|
||||
sub_streams = (const unsigned short*)((const char*)symbols_image + sizeof(PDB_SYMBOLS) +
|
||||
symbols.module_size + symbols.sectcontrib_size +
|
||||
symbols.segmap_size + symbols.srcmodule_size +
|
||||
symbols.pdbimport_size + symbols.unknown2_size);
|
||||
if (PDB_SIDX_FPO < num_sub_streams)
|
||||
pdb_file->fpoext_stream = sub_streams[PDB_SIDX_FPO];
|
||||
|
||||
files_image = pdb_read_strings(pdb_file);
|
||||
|
||||
pdb_process_symbol_imports(pcs, msc_dbg, &symbols, symbols_image, image,
|
||||
|
|
|
@ -587,7 +587,7 @@ static BOOL create_test_pdb_ds(const WCHAR* pdb_name, const GUID* guid, DWORD ag
|
|||
.hash_records_size = 0,
|
||||
.unknown = 0
|
||||
};
|
||||
PDB_STREAM_INDEXES pddt = {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, };
|
||||
unsigned short dbi_substream[] = {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, };
|
||||
char unknown[] =
|
||||
{
|
||||
0xfe, 0xef, 0xfe, 0xef, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
|
@ -650,7 +650,7 @@ static BOOL create_test_pdb_ds(const WCHAR* pdb_name, const GUID* guid, DWORD ag
|
|||
DBI.unknown2_size = stream->size - mark;
|
||||
|
||||
mark = stream->size;
|
||||
pdb_append_to_stream(stream, &pddt, sizeof(pddt));
|
||||
pdb_append_to_stream(stream, dbi_substream, sizeof(dbi_substream));
|
||||
DBI.stream_index_size = stream->size - mark;
|
||||
|
||||
stream = pdb_add_stream(&pdb, NULL, &IPI, sizeof(IPI)); /* always stream #4 */
|
||||
|
@ -658,7 +658,7 @@ static BOOL create_test_pdb_ds(const WCHAR* pdb_name, const GUID* guid, DWORD ag
|
|||
stream = pdb_add_stream(&pdb, &DBI.global_hash_stream, &GHASH, sizeof(GHASH));
|
||||
stream = pdb_add_stream(&pdb, &DBI.gsym_stream, NULL, 0);
|
||||
|
||||
stream = pdb_add_stream(&pdb, &pddt.sections_stream, &ro_section, sizeof(ro_section));
|
||||
stream = pdb_add_stream(&pdb, &dbi_substream[PDB_SIDX_SECTIONS], &ro_section, sizeof(ro_section));
|
||||
|
||||
hfile = CreateFileW(pdb_name, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, 0);
|
||||
ok(hfile != INVALID_HANDLE_VALUE, "failed to create %ls err %lu\n", pdb_name, GetLastError());
|
||||
|
|
|
@ -2576,31 +2576,6 @@ enum PDB_STREAM_INDEX
|
|||
PDB_SIDX_FPOEXT = 9
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short FPO;
|
||||
unsigned short unk0;
|
||||
unsigned short unk1;
|
||||
unsigned short unk2;
|
||||
unsigned short unk3;
|
||||
unsigned short sections_stream;
|
||||
} PDB_STREAM_INDEXES_OLD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short FPO;
|
||||
unsigned short unk0;
|
||||
unsigned short unk1;
|
||||
unsigned short unk2;
|
||||
unsigned short unk3;
|
||||
unsigned short sections_stream;
|
||||
unsigned short unk4;
|
||||
unsigned short unk5;
|
||||
unsigned short unk6;
|
||||
unsigned short FPO_EXT;
|
||||
unsigned short unk7;
|
||||
} PDB_STREAM_INDEXES;
|
||||
|
||||
typedef struct _PDB_FPO_DATA
|
||||
{
|
||||
unsigned int start;
|
||||
|
|
Loading…
Add table
Reference in a new issue