mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-20 21:10:16 -08:00
fix DBI SC image-section range mapping
Log and skip section contributions that fail to map into the linked image. Keep a file-range-to-section-number map so compact file ranges produce the correct DBI section numbers.
This commit is contained in:
1 parent
541727b819
commit
afd454b41f
6 files changed
+145
-150
No files matched your search
+12
-12
@@ -223,11 +223,11 @@ typedef struct PDB_DbiHeader
|
||||
|
||||
// "ModuleInfo" DBI range
|
||||
|
||||
typedef U32 PDB_DbiSectionContribVersion;
|
||||
#define PDB_DbiSectionContribVersion_1 (0xeffe0000u + 19970605u)
|
||||
#define PDB_DbiSectionContribVersion_2 (0xeffe0000u + 20140516u)
|
||||
typedef U32 PDB_DbiSCVersion;
|
||||
#define PDB_DbiSCVersion_1 (0xeffe0000u + 19970605u)
|
||||
#define PDB_DbiSCVersion_2 (0xeffe0000u + 20140516u)
|
||||
|
||||
typedef struct PDB_DbiSectionContrib40
|
||||
typedef struct PDB_DbiSC40
|
||||
{
|
||||
CV_SectionIndex sec;
|
||||
U16 pad0;
|
||||
@@ -236,27 +236,27 @@ typedef struct PDB_DbiSectionContrib40
|
||||
U32 flags;
|
||||
CV_ModIndex mod;
|
||||
U16 pad1;
|
||||
} PDB_DbiSectionContrib40;
|
||||
} PDB_DbiSC40;
|
||||
|
||||
typedef struct PDB_DbiSectionContrib
|
||||
typedef struct PDB_DbiSC
|
||||
{
|
||||
PDB_DbiSectionContrib40 base;
|
||||
PDB_DbiSC40 base;
|
||||
U32 data_crc;
|
||||
U32 reloc_crc;
|
||||
} PDB_DbiSectionContrib;
|
||||
} PDB_DbiSC;
|
||||
|
||||
typedef struct PDB_DbiSectionContrib2
|
||||
typedef struct PDB_DbiSC2
|
||||
{
|
||||
PDB_DbiSectionContrib40 base;
|
||||
PDB_DbiSC40 base;
|
||||
U32 data_crc;
|
||||
U32 reloc_crc;
|
||||
U32 sec_coff;
|
||||
} PDB_DbiSectionContrib2;
|
||||
} PDB_DbiSC2;
|
||||
|
||||
typedef struct PDB_DbiCompUnitHeader
|
||||
{
|
||||
U32 unused;
|
||||
PDB_DbiSectionContrib contribution;
|
||||
PDB_DbiSC contribution;
|
||||
U16 flags; // unknown
|
||||
|
||||
MSF_StreamNumber sn;
|
||||
|
||||
+8
-8
@@ -700,9 +700,9 @@ pdb_comp_unit_contribution_array_from_data(Arena *arena, String8 data, COFF_Sect
|
||||
{
|
||||
PDB_CompUnitContribution *contributions = 0;
|
||||
U64 count = 0;
|
||||
if(data.size >= sizeof(PDB_DbiSectionContribVersion))
|
||||
if(data.size >= sizeof(PDB_DbiSCVersion))
|
||||
{
|
||||
PDB_DbiSectionContribVersion *version = (PDB_DbiSectionContribVersion*)data.str;
|
||||
PDB_DbiSCVersion *version = (PDB_DbiSCVersion*)data.str;
|
||||
|
||||
// determine array layout from version
|
||||
U32 item_size = 0;
|
||||
@@ -712,16 +712,16 @@ pdb_comp_unit_contribution_array_from_data(Arena *arena, String8 data, COFF_Sect
|
||||
default:
|
||||
{
|
||||
// TODO(allen): do we have a test case for this?
|
||||
item_size = sizeof(PDB_DbiSectionContrib40);
|
||||
item_size = sizeof(PDB_DbiSC40);
|
||||
}break;
|
||||
case PDB_DbiSectionContribVersion_1:
|
||||
case PDB_DbiSCVersion_1:
|
||||
{
|
||||
item_size = sizeof(PDB_DbiSectionContrib);
|
||||
item_size = sizeof(PDB_DbiSC);
|
||||
array_off = sizeof(*version);
|
||||
}break;
|
||||
case PDB_DbiSectionContribVersion_2:
|
||||
case PDB_DbiSCVersion_2:
|
||||
{
|
||||
item_size = sizeof(PDB_DbiSectionContrib2);
|
||||
item_size = sizeof(PDB_DbiSC2);
|
||||
array_off = sizeof(*version);
|
||||
}break;
|
||||
}
|
||||
@@ -739,7 +739,7 @@ pdb_comp_unit_contribution_array_from_data(Arena *arena, String8 data, COFF_Sect
|
||||
U64 cursor = array_off;
|
||||
for(; cursor + item_size <= data.size; cursor += item_size)
|
||||
{
|
||||
PDB_DbiSectionContrib40 *sc = (PDB_DbiSectionContrib40*)(data.str + cursor);
|
||||
PDB_DbiSC40 *sc = (PDB_DbiSC40*)(data.str + cursor);
|
||||
if(sc->size > 0 && 1 <= sc->sec && sc->sec <= section_count)
|
||||
{
|
||||
U64 voff = section_headers[sc->sec - 1].voff + sc->sec_off;
|
||||
|
||||
Reference in new issue
Block a user