mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
raddbgi_from_pdb: idx run baking; raddbg: catch up to new converter interface
This commit is contained in:
@@ -1818,7 +1818,7 @@ rdim_bake_name_map_from_kind_params(RDIM_Arena *arena, RDI_NameMapKind kind, RDI
|
||||
//- rjf: idx run map building
|
||||
|
||||
RDI_PROC RDIM_BakeIdxRunMap *
|
||||
rdim_bake_idx_run_map_from_params(RDIM_Arena *arena, RDIM_BakeParams *params)
|
||||
rdim_bake_idx_run_map_from_params(RDIM_Arena *arena, RDIM_BakeNameMap *name_maps[RDI_NameMapKind_COUNT], RDIM_BakeParams *params)
|
||||
{
|
||||
//- rjf: set up map
|
||||
RDIM_BakeIdxRunMap *idx_runs = rdim_push_array(arena, RDIM_BakeIdxRunMap, 1);
|
||||
@@ -1826,6 +1826,60 @@ rdim_bake_idx_run_map_from_params(RDIM_Arena *arena, RDIM_BakeParams *params)
|
||||
idx_runs->slots = rdim_push_array(arena, RDIM_BakeIdxRunNode *, idx_runs->slots_count);
|
||||
rdim_bake_idx_run_map_insert(arena, idx_runs, 0, 0);
|
||||
|
||||
//- rjf: bake runs of function-type parameter lists
|
||||
for(RDIM_TypeChunkNode *n = params->types.first; n != 0; n = n->next)
|
||||
{
|
||||
for(RDI_U64 chunk_idx = 0; chunk_idx < n->count; chunk_idx += 1)
|
||||
{
|
||||
RDIM_Type *type = &n->v[chunk_idx];
|
||||
if(type->kind == RDI_TypeKind_Function || type->kind == RDI_TypeKind_Method)
|
||||
{
|
||||
RDI_U32 param_idx_run_count = type->count;
|
||||
RDI_U32 *param_idx_run = rdim_push_array_no_zero(arena, RDI_U32, param_idx_run_count);
|
||||
for(RDI_U32 idx = 0; idx < param_idx_run_count; idx += 1)
|
||||
{
|
||||
param_idx_run[idx] = (RDI_U32)rdim_idx_from_type(type->param_types[idx]); // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
rdim_bake_idx_run_map_insert(arena, idx_runs, param_idx_run, param_idx_run_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: bake runs of name map match lists
|
||||
for(RDI_NameMapKind k = (RDI_NameMapKind)(RDI_NameMapKind_NULL+1);
|
||||
k < RDI_NameMapKind_COUNT;
|
||||
k = (RDI_NameMapKind)(k+1))
|
||||
{
|
||||
RDIM_BakeNameMap *name_map = name_maps[k];
|
||||
if(name_map != 0 && name_map->name_count != 0)
|
||||
{
|
||||
for(RDIM_BakeNameMapNode *n = name_map->first; n != 0; n = n->order_next)
|
||||
{
|
||||
if(n->val_count > 1)
|
||||
{
|
||||
RDI_U32 *idx_run = rdim_push_array(arena, RDI_U32, n->val_count);
|
||||
RDI_U64 val_idx = 0;
|
||||
for(RDIM_BakeNameMapValNode *idxnode = n->val_first;
|
||||
idxnode != 0;
|
||||
idxnode = idxnode->next)
|
||||
{
|
||||
for(RDI_U32 i = 0; i < sizeof(idxnode->val)/sizeof(idxnode->val[0]); i += 1)
|
||||
{
|
||||
if(idxnode->val[i] == 0)
|
||||
{
|
||||
goto dblbreak;
|
||||
}
|
||||
idx_run[val_idx] = idxnode->val[i];
|
||||
val_idx += 1;
|
||||
}
|
||||
}
|
||||
dblbreak:;
|
||||
rdim_bake_idx_run_map_insert(arena, idx_runs, idx_run, (RDI_U32)n->val_count); // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return idx_runs;
|
||||
}
|
||||
|
||||
|
||||
@@ -1175,7 +1175,7 @@ RDI_PROC RDIM_BakeStringMap *rdim_bake_string_map_from_params(RDIM_Arena *arena,
|
||||
RDI_PROC RDIM_BakeNameMap *rdim_bake_name_map_from_kind_params(RDIM_Arena *arena, RDI_NameMapKind kind, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: bake idx run map building
|
||||
RDI_PROC RDIM_BakeIdxRunMap *rdim_bake_idx_run_map_from_params(RDIM_Arena *arena, RDIM_BakeParams *params);
|
||||
RDI_PROC RDIM_BakeIdxRunMap *rdim_bake_idx_run_map_from_params(RDIM_Arena *arena, RDIM_BakeNameMap *name_maps[RDI_NameMapKind_COUNT], RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: bake path tree building
|
||||
RDI_PROC RDIM_BakePathTree *rdim_bake_path_tree_from_params(RDIM_Arena *arena, RDIM_BakeParams *params);
|
||||
|
||||
+11
-22
@@ -617,46 +617,35 @@ entry_point(int argc, char **argv)
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
//- rjf: parse arguments
|
||||
P2R_ConvertIn *convert_in = p2r_convert_in_from_cmd_line(scratch.arena, &cmdln);
|
||||
P2R_User2Convert *user2convert = p2r_user2convert_from_cmdln(scratch.arena, &cmdln);
|
||||
|
||||
//- rjf: open output file
|
||||
String8 output_name = push_str8_copy(scratch.arena, convert_in->output_name);
|
||||
String8 output_name = push_str8_copy(scratch.arena, user2convert->output_name);
|
||||
OS_Handle out_file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_Write, output_name);
|
||||
B32 out_file_is_good = !os_handle_match(out_file, os_handle_zero());
|
||||
|
||||
//- rjf: convert
|
||||
P2R_ConvertOut *convert_out = 0;
|
||||
P2R_Convert2Bake *convert2bake = 0;
|
||||
if(out_file_is_good)
|
||||
{
|
||||
convert_out = p2r_convert(scratch.arena, convert_in);
|
||||
convert2bake = p2r_convert(scratch.arena, user2convert);
|
||||
}
|
||||
|
||||
//- rjf: bake
|
||||
String8List bake_strings = {0};
|
||||
if(convert_out != 0 && convert_in->output_name.size > 0)
|
||||
P2R_Bake2Serialize *bake2srlz = 0;
|
||||
ProfScope("bake")
|
||||
{
|
||||
RDIM_BakeParams bake_params = {0};
|
||||
{
|
||||
bake_params.top_level_info = convert_out->top_level_info;
|
||||
bake_params.binary_sections = convert_out->binary_sections;
|
||||
bake_params.units = convert_out->units;
|
||||
bake_params.types = convert_out->types;
|
||||
bake_params.udts = convert_out->udts;
|
||||
bake_params.src_files = convert_out->src_files;
|
||||
bake_params.global_variables = convert_out->global_variables;
|
||||
bake_params.thread_variables = convert_out->thread_variables;
|
||||
bake_params.procedures = convert_out->procedures;
|
||||
bake_params.scopes = convert_out->scopes;
|
||||
}
|
||||
RDIM_BakeSectionList sections = rdim_bake_sections_from_params(scratch.arena, &bake_params);
|
||||
bake_strings = rdim_blobs_from_bake_sections(scratch.arena, §ions);
|
||||
bake2srlz = p2r_bake(scratch.arena, convert2bake);
|
||||
}
|
||||
|
||||
//- rjf: serialize
|
||||
String8List serialize_out = rdim_serialized_strings_from_params_bake_section_list(scratch.arena, &convert2bake->bake_params, &bake2srlz->sections);
|
||||
|
||||
//- rjf: write
|
||||
if(out_file_is_good)
|
||||
{
|
||||
U64 off = 0;
|
||||
for(String8Node *n = bake_strings.first; n != 0; n = n->next)
|
||||
for(String8Node *n = serialize_out.first; n != 0; n = n->next)
|
||||
{
|
||||
os_file_write(out_file, r1u64(off, off+n->string.size), n->string.str);
|
||||
off += n->string.size;
|
||||
|
||||
@@ -3443,20 +3443,6 @@ p2r_bake(Arena *arena, P2R_Convert2Bake *in)
|
||||
rdim_bake_section_list_concat_in_place(§ions, &s);
|
||||
}
|
||||
|
||||
//- rjf: build interned idx run map
|
||||
RDIM_BakeIdxRunMap *idx_runs = 0;
|
||||
ProfScope("build interned idx run map")
|
||||
{
|
||||
idx_runs = rdim_bake_idx_run_map_from_params(arena, params);
|
||||
}
|
||||
|
||||
//- rjf: type nodes
|
||||
ProfScope("type nodes")
|
||||
{
|
||||
RDIM_BakeSectionList s = rdim_bake_type_node_section_list_from_params(arena, strings, idx_runs, path_tree, params);
|
||||
rdim_bake_section_list_concat_in_place(§ions, &s);
|
||||
}
|
||||
|
||||
//- rjf: UDTs
|
||||
ProfScope("UDTs")
|
||||
{
|
||||
@@ -3506,13 +3492,6 @@ p2r_bake(Arena *arena, P2R_Convert2Bake *in)
|
||||
rdim_bake_section_list_concat_in_place(§ions, &s);
|
||||
}
|
||||
|
||||
//- rjf: name maps
|
||||
ProfScope("name map")
|
||||
{
|
||||
RDIM_BakeSectionList s = rdim_bake_name_map_section_list_from_params_maps(arena, strings, idx_runs, params, name_maps);
|
||||
rdim_bake_section_list_concat_in_place(§ions, &s);
|
||||
}
|
||||
|
||||
//- rjf: file paths
|
||||
ProfScope("file paths")
|
||||
{
|
||||
@@ -3527,6 +3506,27 @@ p2r_bake(Arena *arena, P2R_Convert2Bake *in)
|
||||
rdim_bake_section_list_concat_in_place(§ions, &s);
|
||||
}
|
||||
|
||||
//- rjf: build interned idx run map
|
||||
RDIM_BakeIdxRunMap *idx_runs = 0;
|
||||
ProfScope("build interned idx run map")
|
||||
{
|
||||
idx_runs = rdim_bake_idx_run_map_from_params(arena, name_maps, params);
|
||||
}
|
||||
|
||||
//- rjf: type nodes
|
||||
ProfScope("type nodes")
|
||||
{
|
||||
RDIM_BakeSectionList s = rdim_bake_type_node_section_list_from_params(arena, strings, idx_runs, path_tree, params);
|
||||
rdim_bake_section_list_concat_in_place(§ions, &s);
|
||||
}
|
||||
|
||||
//- rjf: name maps
|
||||
ProfScope("name map")
|
||||
{
|
||||
RDIM_BakeSectionList s = rdim_bake_name_map_section_list_from_params_maps(arena, strings, idx_runs, params, name_maps);
|
||||
rdim_bake_section_list_concat_in_place(§ions, &s);
|
||||
}
|
||||
|
||||
//- rjf: index runs
|
||||
ProfScope("idx runs")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user