mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 05:48:40 +00:00
simplify debug info conversion loop
This commit is contained in:
@@ -1385,20 +1385,18 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get unit's contribution ranges
|
|
||||||
RDIM_Rng1U64ChunkList cu_voff_ranges = d2r_voff_ranges_from_cu_info_off(cu_contrib_map, cu_ranges.v[cu_idx].min);
|
|
||||||
|
|
||||||
String8 cu_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Name);
|
String8 cu_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Name);
|
||||||
String8 cu_dir = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
String8 cu_dir = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||||
String8 cu_prod = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Producer);
|
String8 cu_prod = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Producer);
|
||||||
DW_Language cu_lang = dw_const_u64_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Language);
|
DW_Language cu_lang = dw_const_u64_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Language);
|
||||||
|
RDIM_Rng1U64ChunkList cu_voff_ranges = d2r_voff_ranges_from_cu_info_off(cu_contrib_map, cu_ranges.v[cu_idx].min);
|
||||||
|
|
||||||
RDIM_Unit *unit = rdim_unit_chunk_list_push(arena, &units, UNIT_CHUNK_CAP);
|
RDIM_Unit *unit = rdim_unit_chunk_list_push(arena, &units, UNIT_CHUNK_CAP);
|
||||||
unit->unit_name = cu_name;
|
unit->unit_name = cu_name;
|
||||||
unit->compiler_name = cu_prod;
|
unit->compiler_name = cu_prod;
|
||||||
unit->source_file = str8_zero();
|
unit->source_file = str8_zero(); // TODO
|
||||||
unit->object_file = str8_zero();
|
unit->object_file = str8_zero(); // TODO
|
||||||
unit->archive_file = str8_zero();
|
unit->archive_file = str8_zero(); // TODO
|
||||||
unit->build_path = cu_dir;
|
unit->build_path = cu_dir;
|
||||||
unit->language = d2r_rdi_language_from_dw_language(cu_lang);
|
unit->language = d2r_rdi_language_from_dw_language(cu_lang);
|
||||||
unit->line_table = cu_line_tables_rdi[cu_idx];
|
unit->line_table = cu_line_tables_rdi[cu_idx];
|
||||||
@@ -1414,8 +1412,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
D2R_TagNode *tag_stack = push_array(comp_temp.arena, D2R_TagNode, 1);
|
D2R_TagNode *tag_stack = push_array(comp_temp.arena, D2R_TagNode, 1);
|
||||||
tag_stack->cur_node = tag_tree.root;
|
tag_stack->cur_node = tag_tree.root;
|
||||||
|
|
||||||
while (tag_stack) {
|
while (tag_stack && tag_stack->cur_node) {
|
||||||
while (tag_stack->cur_node) {
|
|
||||||
DW_TagNode *cur_node = tag_stack->cur_node;
|
DW_TagNode *cur_node = tag_stack->cur_node;
|
||||||
DW_Tag tag = cur_node->tag;
|
DW_Tag tag = cur_node->tag;
|
||||||
B32 visit_children = 1;
|
B32 visit_children = 1;
|
||||||
@@ -1953,9 +1950,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
|
|
||||||
// NOTE: due to a bug in clang in stb_sprint.h local variables
|
// NOTE: due to a bug in clang in stb_sprint.h local variables
|
||||||
// are declared in global scope without a name
|
// are declared in global scope without a name
|
||||||
if (name.size == 0) {
|
if (name.size == 0) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
RDIM_Symbol *gvar = rdim_symbol_chunk_list_push(arena, &gvars, GVAR_CHUNK_CAP);
|
RDIM_Symbol *gvar = rdim_symbol_chunk_list_push(arena, &gvars, GVAR_CHUNK_CAP);
|
||||||
gvar->is_extern = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_External);
|
gvar->is_extern = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_External);
|
||||||
@@ -2013,15 +2008,15 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
SLLStackPop(free_tags);
|
SLLStackPop(free_tags);
|
||||||
MemoryZeroStruct(frame);
|
MemoryZeroStruct(frame);
|
||||||
} else {
|
} else {
|
||||||
frame = push_array(scratch.arena, D2R_TagNode, 1);
|
frame = push_array(comp_temp.arena, D2R_TagNode, 1);
|
||||||
}
|
}
|
||||||
frame->cur_node = tag_stack->cur_node->first_child;
|
frame->cur_node = tag_stack->cur_node->first_child;
|
||||||
SLLStackPush(tag_stack, frame);
|
SLLStackPush(tag_stack, frame);
|
||||||
} else {
|
} else {
|
||||||
tag_stack->cur_node = tag_stack->cur_node->sibling;
|
tag_stack->cur_node = tag_stack->cur_node->sibling;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (tag_stack->cur_node == 0) {
|
||||||
// recycle free frame
|
// recycle free frame
|
||||||
D2R_TagNode *frame = tag_stack;
|
D2R_TagNode *frame = tag_stack;
|
||||||
SLLStackPop(tag_stack);
|
SLLStackPop(tag_stack);
|
||||||
@@ -2031,6 +2026,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
tag_stack->cur_node = tag_stack->cur_node->sibling;
|
tag_stack->cur_node = tag_stack->cur_node->sibling;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
temp_end(comp_temp);
|
temp_end(comp_temp);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user