mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
remove vestige *open functionality from the MSF and PDB
This commit is contained in:
@@ -1452,275 +1452,6 @@ msf_find_stream(MSF_Context *msf, MSF_StreamNumber sn)
|
||||
return data;
|
||||
}
|
||||
|
||||
internal MSF_Error
|
||||
msf_open_header(Arena *arena, MSF_PageDataList page_data_list, MSF_UInt page_size, MSF_PageList *page_list)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
msf_page_list_push_extant_page(arena, page_list, page_data_list, page_size, 0);
|
||||
ProfEnd();
|
||||
return MSF_Error_OK;
|
||||
}
|
||||
|
||||
internal MSF_Error
|
||||
msf_open_root(Arena *arena, MSF_PageDataList page_data_list, MSF_UInt page_size, MSF_PageNumber root_pn, MSF_UInt stream_table_size, MSF_PageList *page_list)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
MSF_PageNumber st_page_count = msf_count_pages(page_size, stream_table_size);
|
||||
MSF_UInt st_pn_size = sizeof(MSF_PageNumber) * st_page_count;
|
||||
MSF_PageNumber root_pn_count = msf_count_pages(page_size, st_pn_size);
|
||||
MSF_PageNumber *root_pn_arr = push_array(scratch.arena, MSF_PageNumber, root_pn_count);
|
||||
for (MSF_UInt i = 0; i < root_pn_count; i += 1) {
|
||||
root_pn_arr[i] = root_pn + i;
|
||||
}
|
||||
msf_page_list_push_extant_page_arr(arena, page_list, page_data_list, page_size, root_pn_arr, root_pn_count);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return MSF_Error_OK;
|
||||
}
|
||||
|
||||
internal MSF_Error
|
||||
msf_open_stream_table_page_list(Arena *arena, MSF_PageDataList page_data_list, MSF_UInt page_size, MSF_PageList root_page_list, MSF_UInt stream_table_size, MSF_PageList *page_list)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
MSF_Error error = MSF_Error_OK;
|
||||
MSF_UInt st_pn_count = msf_count_pages(page_size, stream_table_size);
|
||||
MSF_UInt st_pn_size = st_pn_count * sizeof(MSF_PageNumber);
|
||||
MSF_PageNumber *st_pn_arr = push_array(scratch.arena, MSF_PageNumber, st_pn_count);
|
||||
MSF_UInt st_pn_read_size = msf_read(page_data_list, page_size, root_page_list, 0, st_pn_arr, st_pn_size);
|
||||
if (st_pn_read_size == st_pn_size) {
|
||||
msf_page_list_push_extant_page_arr(arena, page_list, page_data_list, page_size, st_pn_arr, st_pn_count);
|
||||
} else {
|
||||
error = MSF_OpenError_UNABLE_TO_READ_STREAM_TABLE_PAGE_NUMBERS;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return error;
|
||||
}
|
||||
|
||||
internal MSF_Error
|
||||
msf_open_stream_table(Arena *arena, MSF_PageDataList page_data_list, MSF_UInt page_size, MSF_PageList st_page_list, MSF_UInt stream_table_size, MSF_StreamList *stream_list)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
MSF_Error error = MSF_Error_OK;
|
||||
|
||||
// read out entire stream table
|
||||
U8 *st_buffer = push_array(scratch.arena, U8, stream_table_size);
|
||||
MSF_UInt st_read_size = msf_read(page_data_list, page_size, st_page_list, 0, st_buffer, stream_table_size);
|
||||
if (st_read_size != stream_table_size) {
|
||||
error = MSF_OpenError_INVALID_STREAM_TABLE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// setup buffer reader
|
||||
String8 st_data = str8(st_buffer, st_read_size);
|
||||
U64 st_cursor = 0;
|
||||
|
||||
MSF_UInt stream_count = 0;
|
||||
st_cursor += str8_deserial_read_struct(st_data, st_cursor, &stream_count);
|
||||
|
||||
// stream count is a 32-bit but stream number is 16-bit?!
|
||||
if (stream_count > MSF_STREAM_NUMBER_MAX) {
|
||||
error = MSF_OpenError_STREAM_COUNT_OVERFLOW;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// is there enoguh bytes to read streams sizes?
|
||||
U64 size_arr_end = st_cursor + (U64)stream_count * sizeof(MSF_UInt);
|
||||
if (size_arr_end > st_data.size) {
|
||||
error = MSF_OpenError_UNABLE_TO_READ_STREAM_SIZES;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// make pointer to stream sizes array
|
||||
MSF_UInt *stream_size_arr = (MSF_UInt*)(st_buffer + st_cursor);
|
||||
st_cursor += sizeof(stream_size_arr[0]) * stream_count;
|
||||
|
||||
U64 arena_pos_before_stream_allocations = arena_pos(arena);
|
||||
|
||||
// open streams
|
||||
for (MSF_UInt stream_idx = 0; stream_idx < stream_count; stream_idx += 1) {
|
||||
MSF_UInt stream_size = stream_size_arr[stream_idx];
|
||||
B32 is_present = stream_size != MSF_DELETED_STREAM_STAMP;
|
||||
if (is_present) {
|
||||
MSF_PageNumber pn_count = msf_count_pages(page_size, stream_size);
|
||||
|
||||
// is there enough bytes in buffer to build stream page list?
|
||||
MSF_UInt st_pn_end = st_cursor + pn_count * sizeof(MSF_PageNumber);
|
||||
if (st_pn_end > stream_table_size) {
|
||||
break;
|
||||
}
|
||||
|
||||
// setup page number array
|
||||
MSF_PageNumber *pn_arr = (MSF_PageNumber*)(st_buffer + st_cursor);
|
||||
st_cursor += sizeof(pn_arr[0]) * pn_count;
|
||||
|
||||
// build stream page list
|
||||
MSF_PageList page_list = {0};
|
||||
msf_page_list_push_extant_page_arr(arena, &page_list, page_data_list, page_size, pn_arr, pn_count);
|
||||
|
||||
// alloc stream with opened pages
|
||||
MSF_StreamNode *stream_node = msf_stream_alloc_(arena, stream_list);
|
||||
stream_node->data.size = stream_size;
|
||||
stream_node->data.page_list = page_list;
|
||||
}
|
||||
// stream was deleted but slot was kept to be reused in subsequent allocations
|
||||
else {
|
||||
MSF_StreamNode *stream_node = msf_stream_alloc_(arena, stream_list);
|
||||
stream_node->data.size = stream_size;
|
||||
}
|
||||
}
|
||||
|
||||
if (stream_list->count != stream_count) {
|
||||
arena_pop_to(arena, arena_pos_before_stream_allocations);
|
||||
error = MSF_OpenError_INVALID_STREAM_TABLE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
exit:;
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return error;
|
||||
}
|
||||
|
||||
internal MSF_Error
|
||||
msf_open(String8 data, MSF_Context **msf_out)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
MSF_Error error = MSF_Error_OK;
|
||||
MSF_Context *msf = 0;
|
||||
MSF_PageDataList page_data_list = {0};
|
||||
|
||||
// are there enough bytes for header?
|
||||
if (sizeof(MSF_Header70) > data.size) {
|
||||
error = MSF_OpenError_NOT_ENOUGH_BYTES_TO_READ_HEADER;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// is this MSF 7.0?
|
||||
MSF_Header70 *header = (MSF_Header70*)data.str;
|
||||
if (MemoryCompare(header->magic, msf_msf70_magic, sizeof(msf_msf70_magic)) != 0) {
|
||||
error = MSF_OpenError_INVALID_MAGIC;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// validate page size
|
||||
if (!IsPow2(header->page_size)) {
|
||||
error = MSF_OpenError_PAGE_SIZE_IS_NOT_POW2;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// validate page count
|
||||
MSF_UInt file_page_count = msf_count_pages(header->page_size, data.size);
|
||||
if (file_page_count != header->page_count) {
|
||||
error = MSF_OpenError_PAGE_COUNT_DOESNT_MATCH_DATA_SIZE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// validate FPM
|
||||
if (header->page_size < MSF_MIN_PAGE_SIZE) {
|
||||
error = MSF_OpenError_INVALID_PAGE_SIZE;
|
||||
goto exit;
|
||||
}
|
||||
if (header->page_size > MSF_MAX_PAGE_SIZE) {
|
||||
error = MSF_OpenError_INVALID_PAGE_SIZE;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// is there enough bytes to initialize PDB?
|
||||
MSF_UInt check_size = header->page_size*3 + header->stream_table_size;
|
||||
if (check_size > data.size) {
|
||||
error = MSF_OpenError_NOT_ENOUGH_PAGES_TO_INIT;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// validate FPM
|
||||
if (header->active_fpm != MSF_FPM0 && header->active_fpm != MSF_FPM1) {
|
||||
error = MSF_OpenError_INVALID_ACTIVE_FPM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// is there enough bytes to initialize root stream?
|
||||
MSF_UInt root_pn_offset = OffsetOf(MSF_Header70, root_pn);
|
||||
if (root_pn_offset + header->stream_table_size > data.size) {
|
||||
error = MSF_OpenError_INVALID_ROOT_STREAM_PAGE_NUMBER;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// validate root directory
|
||||
MSF_UInt root_directory_page_count = msf_count_pages(header->page_size, header->stream_table_size);
|
||||
MSF_UInt root_directory_max_page_count = header->page_size / sizeof(MSF_UInt);
|
||||
if (root_directory_page_count > root_directory_max_page_count) {
|
||||
error = MSF_Error_STREAM_TABLE_HAS_TOO_MANY_PAGES;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// allocate MSF context and don't reserve special pages
|
||||
msf = msf_alloc__(arena_alloc(.name = "MSF"), header->page_size, header->active_fpm);
|
||||
|
||||
// divide data into fixed size nodes (with 4KB page each node is 128MB)
|
||||
msf_set_page_data_list(msf->arena, &page_data_list, header->page_size, data);
|
||||
|
||||
do {
|
||||
MSF_PageList header_page_list = {0};
|
||||
error = msf_open_header(msf->arena, page_data_list, header->page_size, &header_page_list);
|
||||
if (error != MSF_Error_OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
MSF_PageList root_page_list = {0};
|
||||
error = msf_open_root(msf->arena, page_data_list, header->page_size, header->root_pn, header->stream_table_size, &root_page_list);
|
||||
if (error != MSF_Error_OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
MSF_PageList st_page_list = {0};
|
||||
error = msf_open_stream_table_page_list(msf->arena, page_data_list, header->page_size, root_page_list, header->stream_table_size, &st_page_list);
|
||||
if (error != MSF_Error_OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
MSF_StreamList stream_list = {0};
|
||||
error = msf_open_stream_table(msf->arena, page_data_list, header->page_size, st_page_list, header->stream_table_size, &stream_list);
|
||||
if (error != MSF_Error_OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
Assert(msf->page_size == header->page_size);
|
||||
Assert(msf->active_fpm == header->active_fpm);
|
||||
msf->page_count = header->page_count;
|
||||
msf->page_data_list = page_data_list;
|
||||
msf->header_page_list = header_page_list;
|
||||
msf->root_page_list = root_page_list;
|
||||
msf->st_page_list = st_page_list;
|
||||
msf->sectab = stream_list;
|
||||
|
||||
*msf_out = msf;
|
||||
|
||||
#if LNK_PARANOID
|
||||
msf_check_fpm_bits_for_page_list(page_data_list, msf->page_size, msf->active_fpm, header_page_list, MSF_PAGE_STATE_ALLOC);
|
||||
msf_check_fpm_bits_for_page_list(page_data_list, msf->page_size, msf->active_fpm, root_page_list, MSF_PAGE_STATE_ALLOC);
|
||||
msf_check_fpm_bits_for_page_list(page_data_list, msf->page_size, msf->active_fpm, st_page_list, MSF_PAGE_STATE_ALLOC);
|
||||
for (MSF_StreamNode *stream_node = stream_list.first; stream_node != 0; stream_node = stream_node->next) {
|
||||
msf_check_fpm_bits_for_page_list(page_data_list, msf->page_size, msf->active_fpm, stream_node->data.page_list, MSF_PAGE_STATE_ALLOC);
|
||||
}
|
||||
#endif
|
||||
} while(0);
|
||||
|
||||
exit:;
|
||||
if (error != MSF_Error_OK) {
|
||||
if (msf) {
|
||||
msf_release(&msf);
|
||||
}
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return error;
|
||||
}
|
||||
|
||||
internal void
|
||||
msf_release(MSF_Context **msf_ptr)
|
||||
{
|
||||
|
||||
@@ -127,7 +127,6 @@ typedef struct
|
||||
////////////////////////////////
|
||||
|
||||
internal MSF_Context * msf_alloc(MSF_UInt page_size, MSF_UInt active_fpm);
|
||||
internal MSF_Error msf_open(String8 data, MSF_Context **msf_out);
|
||||
internal void msf_release(MSF_Context **msf_ptr);
|
||||
internal MSF_Error msf_build(MSF_Context *msf);
|
||||
internal U64 msf_get_save_size(MSF_Context *msf);
|
||||
|
||||
@@ -531,130 +531,6 @@ pdb_strtab_alloc(PDB_StringTable *strtab, U32 max)
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
internal PDB_StringTableOpenError
|
||||
pdb_strtab_open(PDB_StringTable *strtab, MSF_Context *msf, MSF_StreamNumber sn)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
PDB_StringTableOpenError err = PDB_StringTableOpenError_OK;
|
||||
|
||||
Arena *arena = 0;
|
||||
String8 string_buffer;
|
||||
U32 bucket_max;
|
||||
U32 bucket_count;
|
||||
U32 *ibucket_array;
|
||||
PDB_StringTableBucket **bucket_array;
|
||||
|
||||
PDB_StringTableHeader header = {0};
|
||||
msf_stream_read_struct(msf, sn, &header);
|
||||
|
||||
if (header.magic == PDB_StringTableHeader_MAGIC) {
|
||||
if (header.version == PDB_StringTableHeader_CurrentVersion) {
|
||||
Temp scratch = scratch_begin(0,0);
|
||||
|
||||
arena = arena_alloc();
|
||||
|
||||
U32 string_size;
|
||||
String8 offset_buffer;
|
||||
|
||||
// read table data
|
||||
string_size = msf_stream_read_u32(msf, sn);
|
||||
string_buffer = msf_stream_read_block(arena, msf, sn, string_size);
|
||||
bucket_max = msf_stream_read_u32(msf, sn);
|
||||
offset_buffer = msf_stream_read_block(scratch.arena, msf, sn, bucket_max * sizeof(U32));
|
||||
bucket_count = msf_stream_read_u32(msf, sn);
|
||||
|
||||
U64 expected_size = sizeof(PDB_StringTableHeader) +
|
||||
string_buffer.size +
|
||||
sizeof(bucket_max) +
|
||||
offset_buffer.size +
|
||||
sizeof(bucket_count);
|
||||
U64 actual_size = msf_stream_get_size(msf, sn);
|
||||
|
||||
if (expected_size <= actual_size &&
|
||||
string_buffer.size == string_size &&
|
||||
offset_buffer.size == sizeof(U32)*bucket_max &&
|
||||
bucket_count <= bucket_max) {
|
||||
// init string table
|
||||
ibucket_array = push_array_no_zero(arena, U32, bucket_max);
|
||||
bucket_array = push_array_no_zero(arena, PDB_StringTableBucket *, bucket_max);
|
||||
|
||||
// open buckets
|
||||
PDB_StringTableBucket *node_arr = push_array_no_zero(arena, PDB_StringTableBucket, bucket_count);
|
||||
U8 *string_buffer_ptr = string_buffer.str;
|
||||
U8 *string_buffer_opl = string_buffer.str + string_buffer.size;
|
||||
U32 *offset_array = (U32*)offset_buffer.str;
|
||||
U32 bucket_read_idx = 0;
|
||||
|
||||
for (U32 bucket_idx = 0; bucket_idx < bucket_max; bucket_idx += 1) {
|
||||
U32 string_offset = offset_array[bucket_idx];
|
||||
|
||||
// sanity check offset
|
||||
if (string_offset >= string_buffer.size) {
|
||||
err = PDB_StringTableOpenError_STRING_OFFSET_OUT_OF_BOUNDS;
|
||||
break;
|
||||
}
|
||||
|
||||
// empty bucket
|
||||
else if (string_offset == 0) {
|
||||
ibucket_array[bucket_idx] = 0;
|
||||
bucket_array[bucket_idx] = 0;
|
||||
}
|
||||
|
||||
// bucket with string
|
||||
else {
|
||||
if (bucket_read_idx >= bucket_count) {
|
||||
err = PDB_StringTableOpenError_OFFSETS_EXCEED_BUCKET_COUNT;
|
||||
break;
|
||||
}
|
||||
|
||||
// get bucket
|
||||
PDB_StringTableBucket *bucket = &node_arr[bucket_read_idx];
|
||||
|
||||
// init bucket
|
||||
bucket->data = str8_cstring_capped(string_buffer_ptr + string_offset, string_buffer_opl);
|
||||
bucket->offset = string_offset;
|
||||
bucket->istr = bucket_read_idx;
|
||||
|
||||
// assign bucket
|
||||
bucket_array[bucket_idx] = bucket;
|
||||
ibucket_array[bucket_idx] = bucket_read_idx;
|
||||
|
||||
// advance
|
||||
bucket_read_idx += 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = PDB_StringTableOpenError_CORRUPTED;
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
} else {
|
||||
err = PDB_StringTableOpenError_UNKNOWN_VERSION;
|
||||
}
|
||||
} else {
|
||||
err = PDB_StringTableOpenError_BAD_MAGIC;
|
||||
}
|
||||
|
||||
if (err == PDB_StringTableOpenError_OK) {
|
||||
strtab->arena = arena;
|
||||
strtab->version = header.version;
|
||||
strtab->size = string_buffer.size;
|
||||
strtab->bucket_count = bucket_count;
|
||||
strtab->bucket_max = bucket_max;
|
||||
strtab->ibucket_array = ibucket_array;
|
||||
strtab->bucket_array = bucket_array;
|
||||
} else {
|
||||
if (arena) {
|
||||
arena_release(arena);
|
||||
}
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
internal void
|
||||
pdb_strtab_build(PDB_StringTable *strtab, MSF_Context *msf, MSF_StreamNumber sn)
|
||||
{
|
||||
@@ -900,52 +776,8 @@ pdb_strtab_string_to_offset(PDB_StringTable *strtab, PDB_StringIndex stridx)
|
||||
return offset;
|
||||
}
|
||||
|
||||
internal String8
|
||||
pdb_string_from_string_table_open_error(PDB_StringTableOpenError err)
|
||||
{
|
||||
String8 result = str8(0,0);
|
||||
switch (err) {
|
||||
case PDB_StringTableOpenError_OK: break;
|
||||
case PDB_StringTableOpenError_BAD_MAGIC: result = str8_lit("BAD_MAGIC"); break;
|
||||
case PDB_StringTableOpenError_UNKNOWN_VERSION: result = str8_lit("UNKNOWN_VERSION"); break;
|
||||
case PDB_StringTableOpenError_CORRUPTED: result = str8_lit("CORRUPTED"); break;
|
||||
case PDB_StringTableOpenError_OFFSETS_EXCEED_BUCKET_COUNT: result = str8_lit("OFFSETS_EXCEED_BUCKET_COUNT"); break;
|
||||
case PDB_StringTableOpenError_STRING_OFFSET_OUT_OF_BOUNDS: result = str8_lit("STRING_OFFSET_OUT_OF_BOUNDS"); break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal PDB_OpenTypeServerError
|
||||
pdb_type_server_parse_from_data_v80(String8 data, PDB_TypeServerParse *parse)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
PDB_OpenTypeServerError error = PDB_OpenTypeServerError_UNKNOWN;
|
||||
|
||||
PDB_TpiHeader header; MemoryZeroStruct(&header);
|
||||
str8_deserial_read_struct(data, 0, &header);
|
||||
Assert(header.version == PDB_TpiVersion_IMPV80);
|
||||
|
||||
if (header.ti_lo >= CV_MinComplexTypeIndex &&
|
||||
header.ti_lo <= header.ti_hi) {
|
||||
if (header.hash_bucket_count > 0 &&
|
||||
header.hash_bucket_count <= PDB_TYPE_SERVER_HASH_BUCKET_COUNT_MAX) {
|
||||
parse->ti_range = rng_1u64(header.ti_lo, header.ti_hi);
|
||||
parse->leaf_data = str8_substr(data, rng_1u64(sizeof(PDB_TpiHeader), sizeof(PDB_TpiHeader) + header.leaf_data_size ));
|
||||
error = PDB_OpenTypeServerError_OK;
|
||||
} else {
|
||||
error = PDB_OpenTypeServerError_INVALID_BUCKET_COUNT;
|
||||
}
|
||||
} else {
|
||||
error = PDB_OpenTypeServerError_INVALID_TI_RANGE;
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return error;
|
||||
}
|
||||
|
||||
internal B32
|
||||
pdb_extract_type_server_info(String8 raw_msf, MSF_RawStreamTable *st, MSF_StreamNumber sn, Rng1U64 *ti_range_out, Rng1U64 *leaf_range_out)
|
||||
{
|
||||
@@ -979,30 +811,6 @@ pdb_extract_type_server_info(String8 raw_msf, MSF_RawStreamTable *st, MSF_Stream
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
internal PDB_OpenTypeServerError
|
||||
pdb_type_server_parse_from_data(String8 data, PDB_TypeServerParse *parse_out)
|
||||
{
|
||||
PDB_OpenTypeServerError error = PDB_OpenTypeServerError_UNKNOWN;
|
||||
|
||||
PDB_TpiVersion version = 0;
|
||||
str8_deserial_read_struct(data, 0, &version);
|
||||
|
||||
switch (version) {
|
||||
case PDB_TpiVersion_IMPV80:
|
||||
error = pdb_type_server_parse_from_data_v80(data, parse_out);
|
||||
break;
|
||||
case PDB_TpiVersion_INTV_VC2:
|
||||
case PDB_TpiVersion_IMPV40:
|
||||
case PDB_TpiVersion_IMPV50_INTERIM:
|
||||
case PDB_TpiVersion_IMPV70:
|
||||
error = PDB_OpenTypeServerError_UNSUPPORTED_VERSION;
|
||||
break;
|
||||
default: Assert(!"unknown TPI version"); break;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
internal PDB_TypeServer *
|
||||
pdb_type_server_alloc(U64 bucket_cap)
|
||||
{
|
||||
@@ -1142,34 +950,6 @@ exit:
|
||||
return ts;
|
||||
}
|
||||
|
||||
internal PDB_TypeServer *
|
||||
pdb_type_server_open(MSF_Context *msf, MSF_StreamNumber sn, PDB_StringTable *strtab)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
PDB_TypeServer *ts = NULL;
|
||||
|
||||
PDB_TpiVersion version = 0;
|
||||
msf_stream_seek(msf, sn, 0);
|
||||
msf_stream_read_struct(msf, sn, &version);
|
||||
|
||||
switch (version) {
|
||||
case PDB_TpiVersion_IMPV80: {
|
||||
ts = pdb_type_server_open_v80(msf, sn, strtab);
|
||||
} break;
|
||||
case PDB_TpiVersion_INTV_VC2:
|
||||
case PDB_TpiVersion_IMPV40:
|
||||
case PDB_TpiVersion_IMPV50_INTERIM:
|
||||
case PDB_TpiVersion_IMPV70: {
|
||||
NotImplemented;
|
||||
} break;
|
||||
default: Assert(!"unknown TPI version"); break;
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return ts;
|
||||
}
|
||||
|
||||
internal
|
||||
THREAD_POOL_TASK_FUNC(pdb_write_type_to_bucket_map_32_task)
|
||||
{
|
||||
@@ -1770,86 +1550,6 @@ pdb_info_parse_from_data(String8 data, PDB_InfoParse *parse_out)
|
||||
}
|
||||
}
|
||||
|
||||
internal PDB_InfoContext *
|
||||
pdb_info_open(MSF_Context *msf, MSF_StreamNumber sn)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0,0);
|
||||
|
||||
U64 info_size = msf_stream_get_size(msf, sn);
|
||||
String8 info_data = msf_stream_read_block(scratch.arena, msf, sn, info_size);
|
||||
|
||||
PDB_InfoParse parse = {0};
|
||||
pdb_info_parse_from_data(info_data, &parse);
|
||||
|
||||
PDB_FeatureFlags flags = 0;
|
||||
PDB_HashTable named_stream_ht = {0};
|
||||
if (parse.version == PDB_InfoVersion_VC70) {
|
||||
// open named stream hash table
|
||||
U64 cursor = 0;
|
||||
U64 named_stream_ht_size = 0;
|
||||
PDB_HashTableParseError named_stream_ht_error = pdb_named_stream_ht_from_data(&named_stream_ht, parse.extra_info, &named_stream_ht_size);
|
||||
if (named_stream_ht_error == PDB_HashTableParseError_OK) {
|
||||
cursor += named_stream_ht_size;
|
||||
|
||||
// read PDB features
|
||||
while (cursor < info_data.size) {
|
||||
PDB_FeatureSig sig = 0;
|
||||
cursor += str8_deserial_read_struct(parse.extra_info, cursor, &sig);
|
||||
switch (sig) {
|
||||
case PDB_FeatureSig_NULL: break;
|
||||
case PDB_FeatureSig_VC140: {
|
||||
flags |= PDB_FeatureFlag_HAS_ID_STREAM;
|
||||
} break;
|
||||
case PDB_FeatureSig_NO_TYPE_MERGE: {
|
||||
flags |= PDB_FeatureFlag_NO_TYPE_MERGE;
|
||||
} break;
|
||||
case PDB_FeatureSig_MINIMAL_DEBUG_INFO: {
|
||||
flags |= PDB_FeatureFlag_MINIMAL_DBG_INFO;
|
||||
} break;
|
||||
default: Assert(!"unknown feature sig"); break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Assert(!"unable to open named stream hash table");
|
||||
}
|
||||
}
|
||||
|
||||
// open string table
|
||||
PDB_StringTable strtab = {0};
|
||||
MSF_StreamNumber strtab_sn = pdb_find_named_stream(&named_stream_ht, PDB_NAMES_STREAM_NAME);
|
||||
if (strtab_sn != MSF_INVALID_STREAM_NUMBER) {
|
||||
PDB_StringTableOpenError err = pdb_strtab_open(&strtab, msf, strtab_sn);
|
||||
Assert(err == PDB_StringTableOpenError_OK);
|
||||
}
|
||||
|
||||
// open injected source files
|
||||
PDB_HashTable src_header_block_ht = {0};
|
||||
MSF_StreamNumber src_header_block_sn = pdb_find_named_stream(&named_stream_ht, PDB_SRC_HEADER_BLOCK_STREAM_NAME);
|
||||
if (src_header_block_sn != MSF_INVALID_STREAM_NUMBER) {
|
||||
U64 src_header_block_stream_size = msf_stream_get_size(msf, src_header_block_sn);
|
||||
String8 src_header_block_data = msf_stream_read_block(scratch.arena, msf, src_header_block_sn, src_header_block_stream_size);
|
||||
PDB_HashTableParseError err = pdb_src_header_block_ht_from_data(&src_header_block_ht, src_header_block_data, &strtab, 0);
|
||||
Assert(err == PDB_HashTableParseError_OK);
|
||||
}
|
||||
|
||||
// fill out info
|
||||
Arena *arena = arena_alloc();
|
||||
PDB_InfoContext *info = push_array_no_zero(arena, PDB_InfoContext, 1);
|
||||
info->arena = arena;
|
||||
info->time_stamp = parse.time_stamp;
|
||||
info->age = parse.age;
|
||||
info->guid = parse.guid;
|
||||
info->flags = flags;
|
||||
info->named_stream_ht = named_stream_ht;
|
||||
info->src_header_block_ht = src_header_block_ht;
|
||||
info->strtab = strtab;
|
||||
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return info;
|
||||
}
|
||||
|
||||
internal void
|
||||
pdb_info_build_src_header_block(PDB_InfoContext *info, MSF_Context *msf)
|
||||
{
|
||||
@@ -2084,113 +1784,6 @@ gsi_alloc(void)
|
||||
return gsi;
|
||||
}
|
||||
|
||||
internal PDB_GsiContext *
|
||||
gsi_open(MSF_Context *msf, MSF_StreamNumber sn, String8 symbol_data)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
PDB_GsiHeader header = {0};
|
||||
msf_stream_read_struct(msf, sn, &header);
|
||||
|
||||
Arena *arena = arena_alloc();
|
||||
PDB_GsiContext *gsi = push_array(arena, PDB_GsiContext, 1);
|
||||
gsi->arena = arena;
|
||||
gsi->word_size = PDB_GSI_V70_WORD_SIZE;
|
||||
gsi->symbol_align = PDB_GSI_V70_SYMBOL_ALIGN;
|
||||
gsi->bucket_count = PDB_GSI_V70_BUCKET_COUNT;
|
||||
gsi->bucket_arr = push_array(gsi->arena, CV_SymbolList, gsi->bucket_count);
|
||||
|
||||
if (header.signature == PDB_GsiSignature_Basic) {
|
||||
if (header.version == PDB_GsiVersion_V70) {
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
Assert(header.bucket_data_size >= PDB_GSI_V70_BITMAP_SIZE); // TODO: error handle
|
||||
|
||||
U64 hash_record_count = header.hash_record_arr_size / sizeof(PDB_GsiHashRecord);
|
||||
PDB_GsiHashRecord *hash_record_array = push_array(scratch.arena, PDB_GsiHashRecord, hash_record_count);
|
||||
msf_stream_read_array(msf, sn, &hash_record_array[0], hash_record_count);
|
||||
|
||||
U32 *bitmap = push_array(scratch.arena, U32, PDB_GSI_V70_BITMAP_COUNT);
|
||||
msf_stream_read_array(msf, sn, &bitmap[0], PDB_GSI_V70_BITMAP_COUNT);
|
||||
|
||||
U32 compressed_offset_count = (header.bucket_data_size - PDB_GSI_V70_BITMAP_SIZE) / sizeof(U32);
|
||||
U32 *compressed_offset_array = push_array(scratch.arena, U32, compressed_offset_count);
|
||||
msf_stream_read_array(msf, sn, &compressed_offset_array[0], compressed_offset_count);
|
||||
|
||||
U32 *compressed_offset_ptr = &compressed_offset_array[0];
|
||||
U32 *compressed_offset_opl = &compressed_offset_array[0] + compressed_offset_count;
|
||||
|
||||
U32 compressed_offset_max = (header.bucket_data_size / sizeof(PDB_GsiHashRecord)) * sizeof(PDB_GsiHashRecordOffsetCalc);
|
||||
|
||||
for (U32 imask = 0; imask < PDB_GSI_V70_BITMAP_COUNT; imask += 1) {
|
||||
for (U32 ibit = 0; ibit < PDB_GSI_V70_WORD_SIZE; ibit += 1) {
|
||||
B32 is_bucket_compressed = !!(bitmap[imask] & (1 << ibit));
|
||||
if (is_bucket_compressed) {
|
||||
Assert(compressed_offset_ptr < compressed_offset_opl);
|
||||
|
||||
U32 next_compressed_offset = compressed_offset_max;
|
||||
if (compressed_offset_ptr + 1 < compressed_offset_opl) {
|
||||
next_compressed_offset = compressed_offset_ptr[1];
|
||||
}
|
||||
U32 compressed_count = (next_compressed_offset - *compressed_offset_ptr) / sizeof(PDB_GsiHashRecordOffsetCalc);
|
||||
|
||||
U64 hash_record_index = *compressed_offset_ptr / sizeof(PDB_GsiHashRecordOffsetCalc);
|
||||
Assert(hash_record_index < hash_record_count);
|
||||
|
||||
for (PDB_GsiHashRecord *hash_record_ptr = &hash_record_array[hash_record_index], *hash_record_opl = hash_record_ptr + compressed_count;
|
||||
hash_record_ptr < hash_record_opl;
|
||||
hash_record_ptr += 1) {
|
||||
Assert(hash_record_ptr->symbol_off > 0);
|
||||
Assert(hash_record_ptr->cref > 0);
|
||||
|
||||
U32 symbol_off = hash_record_ptr->symbol_off -1;
|
||||
U8 *symbol_ptr = symbol_data.str + symbol_off;
|
||||
U16 *size_ptr = (U16*)symbol_ptr;
|
||||
CV_SymKind *kind_ptr = (CV_SymKind*)(size_ptr + 1);
|
||||
U8 *data_ptr = (U8*)(kind_ptr + 1);
|
||||
|
||||
if (*size_ptr >= sizeof(*kind_ptr)) {
|
||||
CV_Symbol symbol;
|
||||
symbol.kind = *kind_ptr;
|
||||
symbol.data = str8(data_ptr, *size_ptr - sizeof(*kind_ptr));
|
||||
gsi_push(gsi, &symbol);
|
||||
} else {
|
||||
Assert(!"invalid global codeview symbol");
|
||||
}
|
||||
}
|
||||
|
||||
compressed_offset_ptr += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
} else {
|
||||
Assert(!"unknown GSI version");
|
||||
}
|
||||
}
|
||||
|
||||
// check if buckets are sorted
|
||||
#if 0
|
||||
{
|
||||
for (U64 i = 0; i < gsi->bucket_count; ++i) {
|
||||
CV_SymbolList *bucket = &gsi->bucket_arr[i];
|
||||
for (CV_SymbolNode *prev = bucket->first, *curr = bucket->first ? bucket->first->next : NULL;
|
||||
curr != NULL;
|
||||
prev = curr, curr = curr->next) {
|
||||
String8 a = pdb_get_symbol_name(prev->symbol.kind, prev->symbol.data);
|
||||
String8 b = pdb_get_symbol_name(curr->symbol.kind, curr->symbol.data);
|
||||
int compar = string_compar(a, b, false);
|
||||
Assert(compar >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ProfEnd();
|
||||
return gsi;
|
||||
}
|
||||
|
||||
internal void
|
||||
gsi_release(PDB_GsiContext **gsi_ptr)
|
||||
{
|
||||
@@ -2624,26 +2217,6 @@ psi_alloc(void)
|
||||
return psi;
|
||||
}
|
||||
|
||||
internal PDB_PsiContext *
|
||||
psi_open(MSF_Context *msf, MSF_StreamNumber sn, String8 symbol_data)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
Arena *arena = arena_alloc();
|
||||
PDB_PsiContext *psi = push_array(arena, PDB_PsiContext, 1);
|
||||
psi->arena = arena;
|
||||
|
||||
// TODO: read out address table
|
||||
|
||||
PDB_PsiHeader header = {0};
|
||||
msf_stream_read_struct(msf, sn, &header);
|
||||
|
||||
psi->gsi = gsi_open(msf, sn, symbol_data);
|
||||
|
||||
ProfEnd();
|
||||
return psi;
|
||||
}
|
||||
|
||||
internal void
|
||||
psi_build(TP_Context *tp, PDB_PsiContext *psi, MSF_Context *msf, MSF_StreamNumber sn, MSF_StreamNumber symbols_sn)
|
||||
{
|
||||
@@ -2901,102 +2474,6 @@ dbi_open_sec_contrib(Arena *arena, MSF_Context *msf, MSF_StreamNumber sn, PDB_Db
|
||||
return sec_contrib;
|
||||
}
|
||||
|
||||
internal PDB_StringTable
|
||||
dbi_open_ec_names(Arena *arena, MSF_Context *msf, MSF_StreamNumber sn, PDB_DbiHeader *dbi_header)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
PDB_StringTable ec_names = {0};
|
||||
if (dbi_header->ec_info_size >= sizeof(PDB_StringTableHeader)) {
|
||||
MSF_UInt ec_names_pos = sizeof(PDB_DbiHeader)
|
||||
+ dbi_header->module_info_size
|
||||
+ dbi_header->sec_con_size
|
||||
+ dbi_header->sec_map_size
|
||||
+ dbi_header->file_info_size
|
||||
+ dbi_header->tsm_size;
|
||||
msf_stream_seek(msf, sn, ec_names_pos);
|
||||
pdb_strtab_open(&ec_names, msf, sn);
|
||||
}
|
||||
ProfEnd();
|
||||
return ec_names;
|
||||
}
|
||||
|
||||
internal void
|
||||
dbi_open_dbg_streams(MSF_StreamNumber *dbg_streams, MSF_Context *msf, MSF_StreamNumber sn, PDB_DbiHeader *dbi_header)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Assert(dbi_header->dbg_header_size % sizeof(dbg_streams[0]) == 0); // TODO: error handle
|
||||
MSF_UInt dbg_stream_pos = sizeof(PDB_DbiHeader)
|
||||
+ dbi_header->module_info_size
|
||||
+ dbi_header->sec_con_size
|
||||
+ dbi_header->sec_map_size
|
||||
+ dbi_header->file_info_size
|
||||
+ dbi_header->tsm_size
|
||||
+ dbi_header->ec_info_size;
|
||||
msf_stream_seek(msf, sn, dbg_stream_pos);
|
||||
msf_stream_read(msf, sn, &dbg_streams[0], dbi_header->dbg_header_size);
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
internal PDB_DbiSectionList
|
||||
dbi_open_section_headers(Arena *arena, MSF_Context *msf, MSF_StreamNumber sn)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
PDB_DbiSectionList sec_list = {0};
|
||||
U64 sec_count = msf_stream_get_size(msf, sn) / sizeof(PDB_DbiSectionNode);
|
||||
PDB_DbiSectionNode *sec_nodes = push_array(arena, PDB_DbiSectionNode, sec_count);
|
||||
for (U64 isec = 0; isec < sec_count; isec += 1) {
|
||||
PDB_DbiSectionNode *sec = &sec_nodes[isec];
|
||||
msf_stream_read_struct(msf, sn, &sec->data);
|
||||
SLLQueuePush(sec_list.first, sec_list.last, sec);
|
||||
sec_list.count += 1;
|
||||
}
|
||||
ProfEnd();
|
||||
return sec_list;
|
||||
}
|
||||
|
||||
internal PDB_DbiContext *
|
||||
dbi_open(MSF_Context *msf, MSF_StreamNumber sn)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
PDB_DbiHeader header = {0};
|
||||
msf_stream_read_struct(msf, sn, &header);
|
||||
|
||||
Arena *arena = arena_alloc();
|
||||
PDB_DbiContext *dbi = push_array(arena, PDB_DbiContext, 1);
|
||||
dbi->arena = arena;
|
||||
dbi->age = header.age;
|
||||
dbi->machine = header.machine;
|
||||
dbi->globals_sn = header.gsi_sn;
|
||||
dbi->publics_sn = header.psi_sn;
|
||||
dbi->symbols_sn = header.sym_sn;
|
||||
|
||||
if (header.sig == PDB_DbiHeaderSignature_V1) {
|
||||
switch (header.version) {
|
||||
case PDB_DbiVersion_41:
|
||||
case PDB_DbiVersion_50:
|
||||
case PDB_DbiVersion_60:
|
||||
case PDB_DbiVersion_110: {
|
||||
Assert(!"TODO: support for older DBI versions");
|
||||
} break;
|
||||
case PDB_DbiVersion_70: {
|
||||
String8List *file_info = dbi_open_file_info(dbi->arena, msf, sn, &header);
|
||||
dbi->module_list = dbi_open_module_info(dbi->arena, msf, sn, &header, file_info);
|
||||
dbi->sec_contrib_list = dbi_open_sec_contrib(dbi->arena, msf, sn, &header);
|
||||
// TODO: section map
|
||||
//dbi->sec_map = dbi_open_sec_map(dbi->arena, msf, sn, &header);
|
||||
dbi->ec_names = dbi_open_ec_names(dbi->arena, msf, sn, &header);
|
||||
dbi_open_dbg_streams(&dbi->dbg_streams[0], msf, sn, &header);
|
||||
dbi->section_list = dbi_open_section_headers(dbi->arena, msf, dbi->dbg_streams[PDB_DbiStream_SECTION_HEADER]);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return dbi;
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
dbi_build_section_header_stream(PDB_DbiContext *dbi, MSF_Context *msf, MSF_StreamNumber sn)
|
||||
{
|
||||
@@ -3623,42 +3100,6 @@ pdb_alloc(U64 page_size, COFF_MachineType machine, COFF_TimeStamp time_stamp, U3
|
||||
return pdb_alloc_(arena_alloc(.name = "PDB"), page_size, machine, time_stamp, age, guid);
|
||||
}
|
||||
|
||||
internal PDB_Context *
|
||||
pdb_open(String8 data)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
PDB_Context *pdb = 0;
|
||||
|
||||
MSF_Context *msf = 0;
|
||||
MSF_Error msf_err = msf_open(data, &msf);
|
||||
if (msf_err == MSF_Error_OK) {
|
||||
Arena *arena = arena_alloc();
|
||||
pdb = push_array(arena, PDB_Context, 1);
|
||||
pdb->arena = arena;
|
||||
pdb->msf = msf;
|
||||
pdb->info = pdb_info_open(pdb->msf, PDB_FixedStream_Info);
|
||||
pdb->dbi = dbi_open(pdb->msf, PDB_FixedStream_Dbi);
|
||||
if (pdb->dbi) {
|
||||
MSF_UInt sym_data_size = msf_stream_get_size(pdb->msf, pdb->dbi->symbols_sn);
|
||||
String8 symbol_data = msf_stream_read_block(scratch.arena, pdb->msf, pdb->dbi->symbols_sn, sym_data_size);
|
||||
pdb->gsi = gsi_open(pdb->msf, pdb->dbi->globals_sn, symbol_data);
|
||||
pdb->psi = psi_open(pdb->msf, pdb->dbi->publics_sn, symbol_data);
|
||||
}
|
||||
PDB_StringTable *strtab = &pdb->info->strtab;
|
||||
pdb->type_servers[CV_TypeIndexSource_NULL] = push_array(pdb->arena, PDB_TypeServer, 1);
|
||||
pdb->type_servers[CV_TypeIndexSource_TPI] = pdb_type_server_open(pdb->msf, PDB_FixedStream_Tpi, strtab);
|
||||
if (pdb->info->flags & PDB_FeatureFlag_HAS_ID_STREAM) {
|
||||
pdb->type_servers[CV_TypeIndexSource_IPI] = pdb_type_server_open(pdb->msf, PDB_FixedStream_Ipi, strtab);
|
||||
}
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return pdb;
|
||||
}
|
||||
|
||||
internal void
|
||||
pdb_release(PDB_Context **pdb_ptr)
|
||||
{
|
||||
@@ -3776,16 +3217,3 @@ pdb_string_from_src_error(PDB_SrcError error)
|
||||
return str8(0,0);
|
||||
}
|
||||
|
||||
internal String8
|
||||
pdb_string_from_open_type_server_error(PDB_OpenTypeServerError error)
|
||||
{
|
||||
switch (error) {
|
||||
case PDB_OpenTypeServerError_OK: return str8_lit("OK");
|
||||
case PDB_OpenTypeServerError_UNKNOWN: return str8_lit("UNKNOWN");
|
||||
case PDB_OpenTypeServerError_INVALID_BUCKET_COUNT: return str8_lit("INVALID_BUCKET_COUNT");
|
||||
case PDB_OpenTypeServerError_INVALID_TI_RANGE: return str8_lit("INVALID_TI_RANGE");
|
||||
case PDB_OpenTypeServerError_UNSUPPORTED_VERSION: return str8_lit("UNSUPPORTED_VERSION");
|
||||
}
|
||||
return str8(0,0);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,31 +61,12 @@ typedef struct PDB_StringTable
|
||||
PDB_StringTableBucket **bucket_array;
|
||||
} PDB_StringTable;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PDB_StringTableOpenError_OK,
|
||||
PDB_StringTableOpenError_BAD_MAGIC,
|
||||
PDB_StringTableOpenError_UNKNOWN_VERSION,
|
||||
PDB_StringTableOpenError_CORRUPTED,
|
||||
PDB_StringTableOpenError_STRING_OFFSET_OUT_OF_BOUNDS,
|
||||
PDB_StringTableOpenError_OFFSETS_EXCEED_BUCKET_COUNT
|
||||
} PDB_StringTableOpenError;
|
||||
|
||||
////////////////////////////////
|
||||
// Type Server
|
||||
|
||||
#define PDB_TYPE_HINT_STEP 128
|
||||
#define PDB_LEAF_ALIGN PDB_NATURAL_ALIGN
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PDB_OpenTypeServerError_OK,
|
||||
PDB_OpenTypeServerError_UNKNOWN,
|
||||
PDB_OpenTypeServerError_INVALID_BUCKET_COUNT,
|
||||
PDB_OpenTypeServerError_INVALID_TI_RANGE,
|
||||
PDB_OpenTypeServerError_UNSUPPORTED_VERSION,
|
||||
} PDB_OpenTypeServerError;
|
||||
|
||||
typedef struct PDB_TypeBucket
|
||||
{
|
||||
struct PDB_TypeBucket *next;
|
||||
@@ -349,7 +330,6 @@ typedef struct
|
||||
// PDB
|
||||
|
||||
internal PDB_Context * pdb_alloc(U64 page_size, COFF_MachineType machine, COFF_TimeStamp time_stamp, U32 age, Guid guid);
|
||||
internal PDB_Context * pdb_open(String8 data);
|
||||
internal void pdb_release(PDB_Context **pdb_ptr);
|
||||
internal void pdb_build(TP_Context *tp, TP_Arena *pool_temp, PDB_Context *pdb, CV_StringHashTable string_ht, B32 build_gsi);
|
||||
internal void pdb_set_machine(PDB_Context *pdb, COFF_MachineType machine);
|
||||
@@ -366,7 +346,6 @@ internal Guid pdb_get_guid(PDB_Context *pdb);
|
||||
|
||||
internal PDB_InfoContext * pdb_info_alloc(U32 age, COFF_TimeStamp time_stamp, Guid guid);
|
||||
internal void pdb_info_parse_from_data(String8 data, PDB_InfoParse *parse_out);
|
||||
internal PDB_InfoContext * pdb_info_open(MSF_Context *msf, MSF_StreamNumber sn);
|
||||
internal void pdb_info_build(PDB_InfoContext *info, MSF_Context *msf, MSF_StreamNumber sn);
|
||||
internal void pdb_info_release(PDB_InfoContext **info_ptr);
|
||||
internal MSF_StreamNumber pdb_push_named_stream(PDB_HashTable *named_stream_ht, MSF_Context *msf, String8 name);
|
||||
@@ -377,7 +356,6 @@ internal PDB_SrcError pdb_add_src(PDB_InfoContext *info, MSF_Context *msf,
|
||||
// GSI
|
||||
|
||||
internal PDB_GsiContext * gsi_alloc(void);
|
||||
internal PDB_GsiContext * gsi_open(MSF_Context *msf, MSF_StreamNumber sn, String8 symbol_data);
|
||||
internal void gsi_build(TP_Context *tp, PDB_GsiContext *gsi, MSF_Context *msf, MSF_StreamNumber gsi_sn, MSF_StreamNumber symbols_sn);
|
||||
internal void gsi_release(PDB_GsiContext **gsi_ptr);
|
||||
internal void gsi_write_build_result(TP_Context *tp, PDB_GsiBuildResult build, MSF_Context *msf, MSF_StreamNumber sn, MSF_StreamNumber symbols_sn);
|
||||
@@ -392,7 +370,6 @@ internal CV_SymbolNode * gsi_search(PDB_GsiContext *gsi, CV_Symbol *symbol);
|
||||
// PSI
|
||||
|
||||
internal PDB_PsiContext * psi_alloc(void);
|
||||
internal PDB_PsiContext * psi_open(MSF_Context *msf, MSF_StreamNumber sn, String8 symbol_data);
|
||||
internal void psi_build(TP_Context *tp, PDB_PsiContext *psi, MSF_Context *msf, MSF_StreamNumber sn, MSF_StreamNumber symbols_sn);
|
||||
internal void psi_release(PDB_PsiContext **psi_ptr);
|
||||
internal CV_SymbolNode * psi_push(PDB_PsiContext *psi, CV_Pub32Flags flags, U32 offset, U16 isect, String8 name);
|
||||
@@ -405,7 +382,6 @@ internal CV_SymbolNode * psi_push(PDB_PsiContext *psi, CV_Pub32Flags flags, U32
|
||||
// DBI
|
||||
|
||||
internal PDB_DbiContext * dbi_alloc(COFF_MachineType machine, U32 age);
|
||||
internal PDB_DbiContext * dbi_open(MSF_Context *msf, MSF_StreamNumber sn);
|
||||
internal void dbi_build(TP_Context *tp, PDB_DbiContext *dbi, MSF_Context *msf, MSF_StreamNumber dbi_sn, CV_StringHashTable string_ht);
|
||||
internal void dbi_release(PDB_DbiContext **dbi_ptr);
|
||||
internal PDB_DbiModule * dbi_push_module(PDB_DbiContext *dbi, String8 obj_path, String8 lib_path);
|
||||
@@ -452,7 +428,6 @@ internal String8 pdb_data_from_named_stream_ht(Arena *arena, PDB_HashTable *ht);
|
||||
// String Table
|
||||
|
||||
internal void pdb_strtab_alloc(PDB_StringTable *strtab, U32 max);
|
||||
internal PDB_StringTableOpenError pdb_strtab_open(PDB_StringTable *strtab, MSF_Context *msf, MSF_StreamNumber sn);
|
||||
internal void pdb_strtab_build(PDB_StringTable *strtab, MSF_Context *msf, MSF_StreamNumber sn);
|
||||
internal void pdb_strtab_release(PDB_StringTable *strtab);
|
||||
internal PDB_StringIndex pdb_strtab_add(PDB_StringTable *strtab, String8 string);
|
||||
@@ -467,16 +442,12 @@ internal U32 pdb_strtab_hash(PDB_StringTable *strtab, Strin
|
||||
////////////////////////////////
|
||||
// Type Server
|
||||
|
||||
internal PDB_OpenTypeServerError pdb_type_server_parse_from_data_v80(String8 data, PDB_TypeServerParse *parse_out);
|
||||
internal PDB_OpenTypeServerError pdb_type_server_parse_from_data(String8 data, PDB_TypeServerParse *parse_out);
|
||||
internal PDB_TypeServer * pdb_type_server_alloc(U64 bucket_count);
|
||||
internal PDB_TypeServer * pdb_type_server_open_v80(MSF_Context *msf, MSF_StreamNumber sn, PDB_StringTable *strtab);
|
||||
internal PDB_TypeServer * pdb_type_server_open(MSF_Context *msf, MSF_StreamNumber sn, PDB_StringTable *strtab);
|
||||
internal void pdb_type_server_build(TP_Context *tp, PDB_TypeServer *ts, PDB_StringTable *strtab, MSF_Context *msf, MSF_StreamNumber sn);
|
||||
internal void pdb_type_server_release(PDB_TypeServer **serv_ptr);
|
||||
internal void pdb_type_server_push(PDB_TypeServer *ts, String8 raw_leaf);
|
||||
internal void pdb_type_server_push_parallel(TP_Context *tp, PDB_TypeServer *ts, U64 leaf_count, U8 **leaf_arr);
|
||||
//internal CV_LeafNode * pdb_type_server_leaf_from_string(PDB_TypeServer *ts, String8 string);
|
||||
internal String8Node * pdb_type_server_reserve(PDB_TypeServer *ts, U64 count);
|
||||
internal String8Node * pdb_type_server_make_leaf(PDB_TypeServer *ts, CV_LeafKind kind, String8 data);
|
||||
internal void pdb_type_server_push_bucket(PDB_TypeServer *ts, CV_Leaf *leaf);
|
||||
@@ -486,6 +457,5 @@ internal PDB_TypeHashStreamInfo pdb_type_hash_stream_build(TP_Context *tp, PDB_
|
||||
// Enum -> String
|
||||
|
||||
internal String8 pdb_string_from_src_error(PDB_SrcError error);
|
||||
internal String8 pdb_string_from_open_type_server_error(PDB_OpenTypeServerError error);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user