mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-14 16:12:24 -07:00
split conversion pass into three (types, udts, and symbols) and use
new locations chunk list
This commit is contained in:
@@ -1999,6 +1999,8 @@ dw_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind k
|
||||
} else {
|
||||
result = dw_interp_const_u64(attrib->form_kind, attrib->form);
|
||||
}
|
||||
} else if (attrib_class == DW_AttribClass_Address) {
|
||||
result = dw_address_from_attrib(input, cu, attrib);
|
||||
} else if (attrib_class == DW_AttribClass_Reference) {
|
||||
NotImplemented;
|
||||
} else if (attrib_class != DW_AttribClass_Null) {
|
||||
|
||||
@@ -132,6 +132,7 @@ typedef struct DW_Tag
|
||||
DW_TagKind kind;
|
||||
DW_AttribList attribs;
|
||||
U64 info_off;
|
||||
U8 v[1];
|
||||
} DW_Tag;
|
||||
|
||||
typedef struct DW_TagNode
|
||||
|
||||
@@ -1130,16 +1130,22 @@ rdim_scope_push_local(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope
|
||||
return local;
|
||||
}
|
||||
|
||||
RDI_PROC RDIM_LocationCase *
|
||||
rdim_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_LocationCaseList *list, RDIM_Location *location, RDIM_Rng1U64 voff_range)
|
||||
{
|
||||
RDIM_LocationCase *n = rdim_push_array(arena, RDIM_LocationCase, 1);
|
||||
RDIM_SLLQueuePush(list->first, list->last, n);
|
||||
list->count += 1;
|
||||
n->location = location;
|
||||
n->voff_range = voff_range;
|
||||
scopes->location_case_count += 1;
|
||||
return n;
|
||||
}
|
||||
|
||||
RDI_PROC RDIM_LocationCase *
|
||||
rdim_local_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location *location, RDIM_Rng1U64 voff_range)
|
||||
{
|
||||
RDIM_LocationCase *loc_case = rdim_push_array(arena, RDIM_LocationCase, 1);
|
||||
RDIM_SLLQueuePush(local->location_cases.first, local->location_cases.last, loc_case);
|
||||
local->location_cases.count += 1;
|
||||
loc_case->location = location;
|
||||
loc_case->voff_range = voff_range;
|
||||
scopes->location_case_count += 1;
|
||||
return loc_case;
|
||||
return rdim_push_location_case(arena, scopes, &local->location_cases, location, voff_range);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
+1086
-861
File diff suppressed because it is too large
Load Diff
@@ -6,13 +6,13 @@
|
||||
typedef struct D2R_ConvertParams D2R_ConvertParams;
|
||||
struct D2R_ConvertParams
|
||||
{
|
||||
String8 dbg_name;
|
||||
String8 dbg_data;
|
||||
String8 exe_name;
|
||||
String8 exe_data;
|
||||
String8 dbg_name;
|
||||
String8 dbg_data;
|
||||
String8 exe_name;
|
||||
String8 exe_data;
|
||||
ExecutableImageKind exe_kind;
|
||||
RDIM_SubsetFlags subset_flags;
|
||||
B32 deterministic;
|
||||
RDIM_SubsetFlags subset_flags;
|
||||
B32 deterministic;
|
||||
};
|
||||
|
||||
typedef struct D2R_TypeTable
|
||||
@@ -23,12 +23,20 @@ typedef struct D2R_TypeTable
|
||||
RDIM_Type **builtin_types;
|
||||
} D2R_TypeTable;
|
||||
|
||||
typedef struct D2R_TagNode
|
||||
typedef struct D2R_TagFrame
|
||||
{
|
||||
struct D2R_TagNode *next;
|
||||
DW_TagNode *cur_node;
|
||||
RDIM_Scope *scope;
|
||||
} D2R_TagNode;
|
||||
DW_TagNode *node;
|
||||
RDIM_Scope *scope;
|
||||
struct D2R_TagFrame *next;
|
||||
} D2R_TagFrame;
|
||||
|
||||
typedef struct D2R_TagIterator
|
||||
{
|
||||
D2R_TagFrame *free_list;
|
||||
D2R_TagFrame *stack;
|
||||
DW_TagNode *tag_node;
|
||||
B32 visit_children;
|
||||
} D2R_TagIterator;
|
||||
|
||||
typedef struct D2R_CompUnitContribMap
|
||||
{
|
||||
@@ -43,59 +51,54 @@ typedef struct D2R_CompUnitContribMap
|
||||
internal RDI_Language d2r_rdi_language_from_dw_language(DW_Language v);
|
||||
internal RDI_RegCodeX86 d2r_rdi_reg_code_from_dw_reg_x86(DW_RegX86 v);
|
||||
internal RDI_RegCodeX64 d2r_rdi_reg_code_from_dw_reg_x64(DW_RegX64 v);
|
||||
internal RDI_RegCode d2r_rdi_reg_code_from_dw_reg(Arch arch, DW_Reg v);
|
||||
internal RDI_RegCode d2r_rdi_reg_code_from_dw_reg(Arch arch, DW_Reg v);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Type Conversion Helpers
|
||||
|
||||
internal RDIM_Type * d2r_create_type(Arena *arena, D2R_TypeTable *type_table);
|
||||
internal RDIM_Type * d2r_find_or_create_type_from_offset(Arena *arena, D2R_TypeTable *type_table, U64 info_off);
|
||||
internal RDIM_Type * d2r_type_from_attrib(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal RDIM_Type * d2r_infer_parent_type(DW_CompUnit *cu, D2R_TagNode *tag_stack);
|
||||
internal Rng1U64List d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag);
|
||||
internal RDIM_Type ** d2r_collect_proc_params(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_TagNode *cur_node, U64 *param_count_out);
|
||||
internal RDI_TypeKind d2r_unsigned_type_kind_from_size(U64 byte_size);
|
||||
internal RDI_TypeKind d2r_signed_type_kind_from_size(U64 byte_size);
|
||||
internal RDIM_Type * d2r_create_type(Arena *arena, D2R_TypeTable *type_table);
|
||||
internal RDIM_Type * d2r_create_type_from_offset(Arena *arena, D2R_TypeTable *type_table, U64 info_off);
|
||||
internal RDIM_Type * d2r_type_from_offset(D2R_TypeTable *type_table, U64 info_off);
|
||||
internal RDIM_Type * d2r_type_from_attrib(D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal Rng1U64List d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag);
|
||||
internal RDIM_Type ** d2r_collect_proc_params(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_TagNode *cur_node, U64 *param_count_out);
|
||||
internal RDI_TypeKind d2r_unsigned_type_kind_from_size(U64 byte_size);
|
||||
internal RDI_TypeKind d2r_signed_type_kind_from_size(U64 byte_size);
|
||||
internal RDI_EvalTypeGroup d2r_type_group_from_type_kind(RDI_TypeKind x);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Bytecode Conversion Helpers
|
||||
|
||||
internal RDIM_EvalBytecode
|
||||
d2r_bytecode_from_expression(Arena *arena,
|
||||
DW_Input *input,
|
||||
U64 image_base,
|
||||
U64 address_size,
|
||||
Arch arch,
|
||||
DW_ListUnit *addr_lu,
|
||||
String8 expr,
|
||||
DW_CompUnit *cu,
|
||||
B32 *is_addr_out);
|
||||
internal RDIM_Location *d2r_transpile_expression(Arena *arena, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr);
|
||||
internal RDIM_Location *d2r_location_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
|
||||
internal RDIM_LocationCaseList d2r_locset_from_attrib(Arena *arena,
|
||||
DW_Input *input,
|
||||
DW_CompUnit *cu,
|
||||
RDIM_ScopeChunkList *scopes,
|
||||
RDIM_Scope *curr_scope,
|
||||
U64 image_base,
|
||||
Arch arch,
|
||||
DW_Tag tag,
|
||||
DW_AttribKind kind);
|
||||
internal RDIM_LocationCaseList d2r_var_locset_from_tag(Arena *arena,
|
||||
DW_Input *input,
|
||||
DW_CompUnit *cu,
|
||||
RDIM_ScopeChunkList *scopes,
|
||||
RDIM_Scope *curr_scope,
|
||||
U64 image_base,
|
||||
Arch arch,
|
||||
DW_Tag tag);
|
||||
internal RDIM_EvalBytecode d2r_bytecode_from_expression(Arena *arena, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, String8 expr, DW_CompUnit *cu, B32 *is_addr_out);
|
||||
internal RDIM_Location * d2r_transpile_expression(Arena *arena, RDIM_LocationChunkList *locations, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr);
|
||||
internal RDIM_Location * d2r_location_from_attrib(Arena *arena, RDIM_LocationChunkList *locations, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
|
||||
internal RDIM_LocationCaseList d2r_locset_from_attrib(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, RDIM_LocationChunkList *locations, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
|
||||
internal RDIM_LocationCaseList d2r_var_locset_from_tag(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *curr_scope, RDIM_LocationChunkList *locations, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Compilation Unit / Scope Conversion Helpers
|
||||
|
||||
internal D2R_CompUnitContribMap d2r_cu_contrib_map_from_aranges(Arena *arena, DW_Input *input, U64 image_base);
|
||||
internal RDIM_Rng1U64ChunkList d2r_voff_ranges_from_cu_info_off(D2R_CompUnitContribMap map, U64 info_off);
|
||||
internal RDIM_Rng1U64ChunkList d2r_voff_ranges_from_cu_info_off(D2R_CompUnitContribMap map, U64 info_off);
|
||||
|
||||
////////////////////////////////
|
||||
//~ Tag Iterator
|
||||
|
||||
internal D2R_TagIterator * d2r_tag_iterator_init(Arena *arena, DW_TagNode *root);
|
||||
internal void d2r_tag_iterator_next(Arena *arena, D2R_TagIterator *iter);
|
||||
internal void d2r_tag_iterator_skip_children(D2R_TagIterator *iter);
|
||||
internal DW_TagNode * d2r_tag_iterator_parent_tag_node(D2R_TagIterator *iter);
|
||||
internal DW_Tag d2r_tag_iterator_parent_tag(D2R_TagIterator *iter);
|
||||
|
||||
////////////////////////////////
|
||||
//~ Type/UDT/Symbol Conversion
|
||||
|
||||
internal void d2r_flag_converted_tag(DW_TagNode *tag_node);
|
||||
internal B8 d2r_is_tag_converted(DW_TagNode *tag_node);
|
||||
|
||||
internal void d2r_convert_types(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root);
|
||||
internal void d2r_convert_udts(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, DW_TagNode *root);
|
||||
internal void d2r_convert_symbols(Arena *arena, D2R_TypeTable *type_table, RDIM_Scope *global_scope, DW_Input *input, DW_CompUnit *cu, DW_Language cu_lang, U64 arch_addr_size, U64 image_base, Arch arch, DW_TagNode *root);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Main Conversion Entry Point
|
||||
|
||||
Reference in New Issue
Block a user