mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-17 09:32:22 -07:00
attrib -> attrib_kind; attrib_ptr -> attrib
This commit is contained in:
+17
-17
@@ -1920,9 +1920,9 @@ dw_dump_list_from_sections(Arena *arena, DW_Input *input, Arch arch, ExecutableI
|
||||
//- rjf: unpack unit
|
||||
Rng1U64 unit_range = unit_ranges.v[unit_idx];
|
||||
DW_CompUnit unit = dw_cu_from_info_off(unit_temp.arena, input, lu_input, unit_range.min, relaxed);
|
||||
String8 unit_dir = dw_string_from_attrib(input, &unit, unit.tag, DW_AttribKind_CompDir );
|
||||
String8 unit_name = dw_string_from_attrib(input, &unit, unit.tag, DW_AttribKind_Name );
|
||||
String8 stmt_list = dw_line_ptr_from_attrib(input, &unit, unit.tag, DW_AttribKind_StmtList);
|
||||
String8 unit_dir = dw_string_from_tag_attrib_kind(input, &unit, unit.tag, DW_AttribKind_CompDir );
|
||||
String8 unit_name = dw_string_from_tag_attrib_kind(input, &unit, unit.tag, DW_AttribKind_Name );
|
||||
String8 stmt_list = dw_line_ptr_from_tag_attrib_kind(input, &unit, unit.tag, DW_AttribKind_StmtList);
|
||||
DW_LineVMHeader line_vm = {0};
|
||||
dw_read_line_vm_header(unit_temp.arena, stmt_list, 0, input, unit_dir, unit_name, unit.address_size, unit.str_offsets_lu, &line_vm);
|
||||
|
||||
@@ -1984,26 +1984,26 @@ dw_dump_list_from_sections(Arena *arena, DW_Input *input, Arch arch, ExecutableI
|
||||
str8_list_pushf(attrib_temp.arena, &attrib_list, "ERROR: undefined value class");
|
||||
} break;
|
||||
case DW_AttribClass_Address: {
|
||||
U64 address = dw_address_from_attrib_ptr(input, &unit, attrib);
|
||||
U64 address = dw_address_from_attrib(input, &unit, attrib);
|
||||
str8_list_pushf(attrib_temp.arena, &attrib_list, "%#llx", address);
|
||||
} break;
|
||||
case DW_AttribClass_Block: {
|
||||
String8 block = dw_block_from_attrib_ptr(input, &unit, attrib);
|
||||
String8 block = dw_block_from_attrib(input, &unit, attrib);
|
||||
String8List block_strs = numeric_str8_list_from_data(attrib_temp.arena, 16, block, 1);
|
||||
String8 block_str = str8_list_join(attrib_temp.arena, &block_strs, &(StringJoin){.sep = str8_lit(", ")});
|
||||
str8_list_push(attrib_temp.arena, &attrib_list, block_str);
|
||||
} break;
|
||||
case DW_AttribClass_Const: {
|
||||
U64 constant = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
U64 constant = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
str8_list_pushf(attrib_temp.arena, &attrib_list, "%#llx", constant);
|
||||
} break;
|
||||
case DW_AttribClass_ExprLoc: {
|
||||
String8 exprloc = dw_exprloc_from_attrib_ptr(input, &unit, attrib);
|
||||
String8 exprloc = dw_exprloc_from_attrib(input, &unit, attrib);
|
||||
String8 exprloc_str = dw_format_expression_single_line(attrib_temp.arena, exprloc, unit_range.min, unit.address_size, arch, unit.version, unit.ext, unit.format);
|
||||
str8_list_push(attrib_temp.arena, &attrib_list, exprloc_str);
|
||||
} break;
|
||||
case DW_AttribClass_Flag: {
|
||||
B32 flag = dw_flag_from_attrib_ptr(input, &unit, attrib);
|
||||
B32 flag = dw_flag_from_attrib(input, &unit, attrib);
|
||||
str8_list_pushf(attrib_temp.arena, &attrib_list, "%llu (%s)", flag, flag == 0 ? "false" : "true");
|
||||
} break;
|
||||
case DW_AttribClass_LinePtr: {
|
||||
@@ -2060,7 +2060,7 @@ dw_dump_list_from_sections(Arena *arena, DW_Input *input, Arch arch, ExecutableI
|
||||
if (attrib->form_kind == DW_Form_Strp) {
|
||||
str8_list_pushf(attrib_temp.arena, &attrib_list, "%#llx", attrib->form.sec_offset);
|
||||
}
|
||||
String8 string = dw_string_from_attrib_ptr(input, &unit, attrib);
|
||||
String8 string = dw_string_from_attrib(input, &unit, attrib);
|
||||
str8_list_pushf(attrib_temp.arena, &attrib_list, "(%S)", string);
|
||||
} break;
|
||||
case DW_AttribClass_StrOffsetsPtr: {
|
||||
@@ -2082,35 +2082,35 @@ dw_dump_list_from_sections(Arena *arena, DW_Input *input, Arch arch, ExecutableI
|
||||
String8 attrib_str = {0};
|
||||
switch (attrib->attrib_kind) {
|
||||
case DW_AttribKind_Language: {
|
||||
DW_Language lang = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
DW_Language lang = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
attrib_str = dw_string_from_language(attrib_temp.arena, lang);
|
||||
} break;
|
||||
case DW_AttribKind_DeclFile: {
|
||||
U64 file_idx = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
DW_LineFile *file = dw_file_from_attrib_ptr(&unit, &line_vm, attrib);
|
||||
U64 file_idx = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
DW_LineFile *file = dw_file_from_attrib(&unit, &line_vm, attrib);
|
||||
attrib_str = str8_lit("\?\?\?");
|
||||
if (file) {
|
||||
attrib_str = dw_path_from_file(attrib_temp.arena, &line_vm, file);
|
||||
}
|
||||
} break;
|
||||
case DW_AttribKind_DeclLine: {
|
||||
U64 line = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
U64 line = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
attrib_str = push_str8f(attrib_temp.arena, "%llu", line);
|
||||
} break;
|
||||
case DW_AttribKind_Inline: {
|
||||
DW_InlKind inl = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
DW_InlKind inl = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
attrib_str = dw_string_from_inl(attrib_temp.arena, inl);
|
||||
} break;
|
||||
case DW_AttribKind_Accessibility: {
|
||||
DW_AccessKind access = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
DW_AccessKind access = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
attrib_str = dw_string_from_access_kind(attrib_temp.arena, access);
|
||||
} break;
|
||||
case DW_AttribKind_CallingConvention: {
|
||||
DW_CallingConventionKind calling_convetion = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
DW_CallingConventionKind calling_convetion = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
attrib_str = dw_string_from_calling_convetion(attrib_temp.arena, calling_convetion);
|
||||
} break;
|
||||
case DW_AttribKind_Encoding: {
|
||||
DW_ATE encoding = dw_const_u64_from_attrib_ptr(input, &unit, attrib);
|
||||
DW_ATE encoding = dw_const_u64_from_attrib(input, &unit, attrib);
|
||||
attrib_str = dw_string_from_attrib_type_encoding(attrib_temp.arena, encoding);
|
||||
} break;
|
||||
}
|
||||
|
||||
+45
-45
@@ -1675,7 +1675,7 @@ dw_value_class_from_attrib(DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_exprloc_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_exprloc_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_ExprLoc || value_class == DW_AttribClass_Block);
|
||||
@@ -1683,7 +1683,7 @@ dw_exprloc_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal U128
|
||||
dw_const_u128_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_const_u128_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||
@@ -1691,7 +1691,7 @@ dw_const_u128_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attri
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_const_u64_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_const_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||
@@ -1699,7 +1699,7 @@ dw_const_u64_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib
|
||||
}
|
||||
|
||||
internal U32
|
||||
dw_const_u32_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_const_u32_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||
@@ -1707,7 +1707,7 @@ dw_const_u32_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib
|
||||
}
|
||||
|
||||
internal S64
|
||||
dw_const_s64_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_const_s64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||
@@ -1715,7 +1715,7 @@ dw_const_s64_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib
|
||||
}
|
||||
|
||||
internal S32
|
||||
dw_const_s32_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_const_s32_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||
@@ -1723,7 +1723,7 @@ dw_const_s32_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib
|
||||
}
|
||||
|
||||
internal B32
|
||||
dw_flag_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_flag_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Flag);
|
||||
@@ -1731,7 +1731,7 @@ dw_flag_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_address_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_address_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null ||
|
||||
@@ -1756,7 +1756,7 @@ dw_address_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_block_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_block_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Block);
|
||||
@@ -1764,7 +1764,7 @@ dw_block_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_string_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_String || value_class == DW_AttribClass_StrOffsetsPtr);
|
||||
@@ -1772,7 +1772,7 @@ dw_string_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_line_ptr_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_line_ptr_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_LinePtr);
|
||||
@@ -1780,7 +1780,7 @@ dw_line_ptr_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal DW_LineFile *
|
||||
dw_file_from_attrib_ptr(DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *attrib)
|
||||
dw_file_from_attrib(DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Const);
|
||||
@@ -1788,7 +1788,7 @@ dw_file_from_attrib_ptr(DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *at
|
||||
}
|
||||
|
||||
internal DW_Reference
|
||||
dw_ref_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_ref_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null || value_class == DW_AttribClass_Reference);
|
||||
@@ -1796,7 +1796,7 @@ dw_ref_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
}
|
||||
|
||||
internal DW_LocList
|
||||
dw_loclist_from_attrib_ptr(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_loclist_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
AssertAlways(value_class == DW_AttribClass_Null ||
|
||||
@@ -1806,7 +1806,7 @@ dw_loclist_from_attrib_ptr(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_At
|
||||
}
|
||||
|
||||
internal Rng1U64List
|
||||
dw_rnglist_from_attrib_ptr(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
dw_rnglist_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib)
|
||||
{
|
||||
Rng1U64List rnglist = {0};
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(cu, attrib);
|
||||
@@ -1860,81 +1860,81 @@ dw_tag_has_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind ki
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_exprloc_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_exprloc_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_exprloc_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_exprloc_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_block_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_block_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_block_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_block_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal U128
|
||||
dw_const_u128_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_const_u128_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_const_u128_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_const_u128_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_const_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_const_u64_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_const_u64_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_const_u64_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal U32
|
||||
dw_const_u32_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_const_u32_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_const_u32_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_const_u32_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal U64
|
||||
dw_address_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_address_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_address_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_address_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_string_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_string_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_string_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_string_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal String8
|
||||
dw_line_ptr_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_line_ptr_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_line_ptr_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_line_ptr_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal DW_Reference
|
||||
dw_ref_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_ref_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_ref_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_ref_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal DW_LocList
|
||||
dw_loclist_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_loclist_from_tag_attrib_kind(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_loclist_from_attrib_ptr(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_loclist_from_attrib(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal Rng1U64List
|
||||
dw_rnglist_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_rnglist_from_tag_attrib_kind(Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_rnglist_from_attrib_ptr(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_rnglist_from_attrib(arena, input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal B32
|
||||
dw_flag_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_flag_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_flag_from_attrib_ptr(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_flag_from_attrib(input, cu, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal DW_LineFile *
|
||||
dw_file_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind)
|
||||
dw_file_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind)
|
||||
{
|
||||
return dw_file_from_attrib_ptr(cu, line_vm, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
return dw_file_from_attrib(cu, line_vm, dw_attrib_from_tag(input, cu, tag, kind));
|
||||
}
|
||||
|
||||
internal B32
|
||||
@@ -1948,10 +1948,10 @@ dw_try_byte_size_from_tag(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, U64 *byt
|
||||
}
|
||||
|
||||
if (has_byte_size) {
|
||||
*byte_size_out = dw_const_u64_from_attrib(input, cu, tag, DW_AttribKind_ByteSize);
|
||||
*byte_size_out = dw_const_u64_from_tag_attrib_kind(input, cu, tag, DW_AttribKind_ByteSize);
|
||||
return 1;
|
||||
} else if (has_bit_size) {
|
||||
U64 bit_size = dw_const_u64_from_attrib(input, cu, tag, DW_AttribKind_BitSize);
|
||||
U64 bit_size = dw_const_u64_from_tag_attrib_kind(input, cu, tag, DW_AttribKind_BitSize);
|
||||
*byte_size_out = bit_size / 8;
|
||||
return 1;
|
||||
}
|
||||
@@ -1987,11 +1987,11 @@ dw_u64_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind k
|
||||
if (attrib_class == DW_AttribClass_Const || attrib_class == DW_AttribClass_Block) {
|
||||
if (dw_tag_has_attrib(input, cu, tag, DW_AttribKind_Type)) {
|
||||
Temp scratch = scratch_begin(0,0);
|
||||
DW_Reference type_ref = dw_ref_from_attrib(input, cu, tag, DW_AttribKind_Type);
|
||||
DW_Reference type_ref = dw_ref_from_tag_attrib_kind(input, cu, tag, DW_AttribKind_Type);
|
||||
DW_Tag type_tag = {0};
|
||||
dw_read_tag_cu(scratch.arena, input, type_ref.cu, type_ref.info_off, &type_tag);
|
||||
U64 type_byte_size = dw_byte_size_from_tag(input, cu, type_tag);
|
||||
DW_ATE type_encoding = dw_const_u64_from_attrib(input, type_ref.cu, type_tag, DW_AttribKind_Encoding);
|
||||
DW_ATE type_encoding = dw_const_u64_from_tag_attrib_kind(input, type_ref.cu, type_tag, DW_AttribKind_Encoding);
|
||||
if (type_encoding == DW_ATE_Unsigned || type_encoding == DW_ATE_UnsignedChar) {
|
||||
result = dw_interp_const64(type_byte_size, type_encoding, attrib->form_kind, attrib->form);
|
||||
}
|
||||
|
||||
+29
-29
@@ -376,36 +376,36 @@ internal DW_Reference dw_interp_ref (DW_Input *input, DW_CompUnit *cu, DW
|
||||
internal DW_LocList dw_interp_loclist (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
||||
internal Rng1U64List dw_interp_rnglist (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_FormKind form_kind, DW_Form form);
|
||||
|
||||
internal String8 dw_exprloc_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U128 dw_const_u128_from_attrib_ptr(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U64 dw_const_u64_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U32 dw_const_u32_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal S64 dw_const_s64_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal S32 dw_const_s32_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal B32 dw_flag_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U64 dw_address_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal String8 dw_block_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal String8 dw_string_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal String8 dw_line_ptr_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal DW_LineFile * dw_file_from_attrib_ptr (DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *attrib);
|
||||
internal DW_Reference dw_ref_from_attrib_ptr (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal DW_LocList dw_loclist_from_attrib_ptr (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal Rng1U64List dw_rnglist_from_attrib_ptr (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal String8 dw_exprloc_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U128 dw_const_u128_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U64 dw_const_u64_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U32 dw_const_u32_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal S64 dw_const_s64_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal S32 dw_const_s32_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal B32 dw_flag_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal U64 dw_address_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal String8 dw_block_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal String8 dw_string_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal String8 dw_line_ptr_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal DW_LineFile * dw_file_from_attrib (DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Attrib *attrib);
|
||||
internal DW_Reference dw_ref_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal DW_LocList dw_loclist_from_attrib (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
internal Rng1U64List dw_rnglist_from_attrib (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Attrib *attrib);
|
||||
|
||||
internal String8 dw_exprloc_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U128 dw_const_u128_from_attrib(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U64 dw_const_u64_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U32 dw_const_u32_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal B32 dw_flag_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U64 dw_address_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_block_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_string_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_line_ptr_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_line_ptr_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal DW_LineFile * dw_file_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind);
|
||||
internal DW_Reference dw_ref_from_attrib (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal DW_LocList dw_loclist_from_attrib (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal Rng1U64List dw_rnglist_from_attrib (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_exprloc_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U128 dw_const_u128_from_tag_attrib_kind(DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U64 dw_const_u64_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U32 dw_const_u32_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal B32 dw_flag_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal U64 dw_address_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_block_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_string_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal String8 dw_line_ptr_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal DW_LineFile * dw_file_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_LineVMHeader *line_vm, DW_Tag tag, DW_AttribKind kind);
|
||||
internal DW_Reference dw_ref_from_tag_attrib_kind (DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal DW_LocList dw_loclist_from_tag_attrib_kind (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
internal Rng1U64List dw_rnglist_from_tag_attrib_kind (Arena *arena, DW_Input *input, DW_CompUnit *cu, DW_Tag tag, DW_AttribKind kind);
|
||||
|
||||
// compile unit
|
||||
|
||||
|
||||
+46
-46
@@ -78,7 +78,7 @@ d2r_type_from_attrib(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, D
|
||||
|
||||
if (value_class == DW_AttribClass_Reference) {
|
||||
// resolve reference
|
||||
DW_Reference ref = dw_ref_from_attrib(input, cu, attrib);
|
||||
DW_Reference ref = dw_ref_from_tag_attrib_kind(input, cu, attrib);
|
||||
|
||||
// TODO: support for external compile unit references
|
||||
AssertAlways(ref.cu == cu);
|
||||
@@ -99,7 +99,7 @@ internal Rng1U64List
|
||||
d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag)
|
||||
{
|
||||
// collect non-contiguous range
|
||||
Rng1U64List ranges = dw_rnglist_from_attrib(arena, input, cu, tag, DW_AttribKind_Ranges);
|
||||
Rng1U64List ranges = dw_rnglist_from_tag_attrib_kind(arena, input, cu, tag, DW_AttribKind_Ranges);
|
||||
|
||||
// debase ranges
|
||||
for (Rng1U64Node *range_n = ranges.first; range_n != 0; range_n = range_n->next) {
|
||||
@@ -114,14 +114,14 @@ d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 imag
|
||||
DW_Attrib *lo_pc_attrib = dw_attrib_from_tag(input, cu, tag, DW_AttribKind_LowPc);
|
||||
DW_Attrib *hi_pc_attrib = dw_attrib_from_tag(input, cu, tag, DW_AttribKind_HighPc);
|
||||
if (lo_pc_attrib->attrib_kind != DW_AttribKind_Null && hi_pc_attrib->attrib_kind != DW_AttribKind_Null) {
|
||||
U64 lo_pc = dw_address_from_attrib(input, cu, lo_pc_attrib);
|
||||
U64 lo_pc = dw_address_from_tag_attrib_kind(input, cu, lo_pc_attrib);
|
||||
|
||||
U64 hi_pc;
|
||||
DW_AttribClass hi_pc_class = dw_value_class_from_attrib(cu, hi_pc_attrib);
|
||||
if (hi_pc_class == DW_AttribClass_Address) {
|
||||
hi_pc = dw_address_from_attrib(input, cu, hi_pc_attrib);
|
||||
hi_pc = dw_address_from_tag_attrib_kind(input, cu, hi_pc_attrib);
|
||||
} else if (hi_pc_class == DW_AttribClass_Const) {
|
||||
hi_pc = dw_const_u64_from_attrib(input, cu, hi_pc_attrib);
|
||||
hi_pc = dw_const_u64_from_tag_attrib_kind(input, cu, hi_pc_attrib);
|
||||
hi_pc += lo_pc;
|
||||
} else {
|
||||
AssertAlways(!"undefined attrib encoding");
|
||||
@@ -592,7 +592,7 @@ SLLStackPush(stack, f); \
|
||||
DW_Tag tag = tag_node->tag;
|
||||
if (tag.kind == DW_TagKind_BaseType) {
|
||||
// extract encoding attribute
|
||||
DW_ATE encoding = dw_const_u64_from_attrib(input, cu, tag, DW_AttribKind_Encoding);
|
||||
DW_ATE encoding = dw_const_u64_from_tag_attrib_kind(input, cu, tag, DW_AttribKind_Encoding);
|
||||
|
||||
// DW_ATE -> RDI_EvalTypeGroup
|
||||
switch (encoding) {
|
||||
@@ -601,7 +601,7 @@ SLLStackPush(stack, f); \
|
||||
case DW_ATE_UnsignedChar:
|
||||
case DW_ATE_Unsigned: out = RDI_EvalTypeGroup_U; break;
|
||||
case DW_ATE_Float: {
|
||||
U64 byte_size = dw_const_u64_from_attrib(input, cu, tag, DW_AttribKind_ByteSize);
|
||||
U64 byte_size = dw_const_u64_from_tag_attrib_kind(input, cu, tag, DW_AttribKind_ByteSize);
|
||||
switch (byte_size) {
|
||||
case 4: out = RDI_EvalTypeGroup_F32; break;
|
||||
case 8: out = RDI_EvalTypeGroup_F64; break;
|
||||
@@ -838,7 +838,7 @@ d2r_transpile_expression(Arena *arena, DW_Input *input, U64 image_base, U64 addr
|
||||
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)
|
||||
{
|
||||
String8 expr = dw_exprloc_from_attrib(input, cu, tag, kind);
|
||||
String8 expr = dw_exprloc_from_tag_attrib_kind(input, cu, tag, kind);
|
||||
RDIM_Location *location = d2r_transpile_expression(arena, input, image_base, cu->address_size, arch, cu->addr_lu, cu, expr);
|
||||
return location;
|
||||
}
|
||||
@@ -864,7 +864,7 @@ d2r_locset_from_attrib(Arena *arena,
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
// extract location list from attrib
|
||||
DW_LocList loclist = dw_loclist_from_attrib(scratch.arena, input, cu, attrib);
|
||||
DW_LocList loclist = dw_loclist_from_tag_attrib_kind(scratch.arena, input, cu, attrib);
|
||||
|
||||
// convert location list to RDIM location set
|
||||
for (DW_LocNode *loc_n = loclist.first; loc_n != 0; loc_n = loc_n->next) {
|
||||
@@ -876,7 +876,7 @@ d2r_locset_from_attrib(Arena *arena,
|
||||
scratch_end(scratch);
|
||||
} else if (attrib_class == DW_AttribClass_ExprLoc) {
|
||||
// extract expression from attrib
|
||||
String8 expr = dw_exprloc_from_attrib(input, cu, attrib);
|
||||
String8 expr = dw_exprloc_from_tag_attrib_kind(input, cu, attrib);
|
||||
|
||||
// convert expression and inherit life-time ranges from enclosed scope
|
||||
RDIM_Location *location = d2r_transpile_expression(arena, input, image_base, cu->address_size, arch, cu->addr_lu, cu, expr);
|
||||
@@ -1202,9 +1202,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
DW_LineTableParseResult *cu_line_tables = push_array(scratch.arena, DW_LineTableParseResult, cu_ranges.count);
|
||||
for (U64 cu_idx = 0; cu_idx < cu_ranges.count; ++cu_idx) {
|
||||
DW_CompUnit *cu = &cu_arr[cu_idx];
|
||||
String8 cu_stmt_list = dw_line_ptr_from_attrib(&input, cu, cu->tag, DW_AttribKind_StmtList);
|
||||
String8 cu_dir = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||
String8 cu_name = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_Name);
|
||||
String8 cu_stmt_list = dw_line_ptr_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_StmtList);
|
||||
String8 cu_dir = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||
String8 cu_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Name);
|
||||
cu_line_tables[cu_idx] = dw_parsed_line_table_from_data(scratch.arena, cu_stmt_list, &input, cu_dir, cu_name, cu->address_size, cu->str_offsets_lu);
|
||||
}
|
||||
ProfEnd();
|
||||
@@ -1327,8 +1327,8 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
// build tag hash table for abstract origin resolution
|
||||
cu->tag_ht = dw_make_tag_hash_table(comp_temp.arena, tag_tree);
|
||||
|
||||
String8 dwo_name = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_DwoName);
|
||||
String8 gnu_dwo_name = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_GNU_DwoName);
|
||||
String8 dwo_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_DwoName);
|
||||
String8 gnu_dwo_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_GNU_DwoName);
|
||||
if (dwo_name.size || gnu_dwo_name.size || cu->dwo_id) {
|
||||
// TODO: report that we dont support DWO
|
||||
continue;
|
||||
@@ -1337,10 +1337,10 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
// get unit's contribution ranges
|
||||
RDIM_Rng1U64List 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_attrib(&input, cu, cu->tag, DW_AttribKind_Name);
|
||||
String8 cu_dir = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||
String8 cu_prod = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_Producer);
|
||||
DW_Language cu_lang = dw_const_u64_from_attrib(&input, cu, cu->tag, DW_AttribKind_Language);
|
||||
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_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);
|
||||
|
||||
RDIM_Unit *unit = rdim_unit_chunk_list_push(arena, &units, UNIT_CHUNK_CAP);
|
||||
unit->unit_name = cu_name;
|
||||
@@ -1376,9 +1376,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
} break;
|
||||
case DW_TagKind_ClassType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteClass;
|
||||
|
||||
@@ -1398,9 +1398,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
} break;
|
||||
case DW_TagKind_StructureType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteStruct;
|
||||
|
||||
@@ -1420,9 +1420,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
} break;
|
||||
case DW_TagKind_UnionType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteUnion;
|
||||
|
||||
@@ -1442,9 +1442,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
} break;
|
||||
case DW_TagKind_EnumerationType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteEnum;
|
||||
|
||||
@@ -1491,11 +1491,11 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
case DW_TagKind_Typedef: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->kind = RDI_TypeKind_Alias;
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->direct_type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
} break;
|
||||
case DW_TagKind_BaseType: {
|
||||
DW_ATE encoding = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_Encoding);
|
||||
DW_ATE encoding = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Encoding);
|
||||
U64 byte_size = dw_byte_size_from_tag(&input, cu, tag);
|
||||
|
||||
// convert base type encoding to RDI version
|
||||
@@ -1602,7 +1602,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->kind = RDI_TypeKind_Alias;
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->direct_type = base_type;
|
||||
} break;
|
||||
case DW_TagKind_PointerType: {
|
||||
@@ -1751,7 +1751,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
RDIM_UDTMember *member = rdim_udt_push_member(arena, &udts, parent->udt);
|
||||
member->kind = RDI_MemberKind_Base;
|
||||
member->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
member->off = safe_cast_u32(dw_const_u32_from_attrib(&input, cu, tag, DW_AttribKind_DataMemberLocation));
|
||||
member->off = safe_cast_u32(dw_const_u32_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_DataMemberLocation));
|
||||
} break;
|
||||
case DW_TagKind_Enumerator: {
|
||||
DW_TagNode *parent_node = tag_stack->next->cur_node;
|
||||
@@ -1762,8 +1762,8 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
|
||||
RDIM_Type *type = tag_stack->next->type;
|
||||
RDIM_UDTEnumVal *member = rdim_udt_push_enum_val(arena, &udts, type->udt);
|
||||
member->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->val = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_ConstValue);
|
||||
member->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->val = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_ConstValue);
|
||||
} break;
|
||||
case DW_TagKind_Member: {
|
||||
DW_TagNode *parent_node = tag_stack->next->cur_node;
|
||||
@@ -1784,9 +1784,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
RDIM_Type *type = tag_stack->next->type;
|
||||
RDIM_UDTMember *member = rdim_udt_push_member(arena, &udts, type->udt);
|
||||
member->kind = RDI_MemberKind_DataField;
|
||||
member->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
member->off = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_DataMemberLocation);
|
||||
member->off = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_DataMemberLocation);
|
||||
} break;
|
||||
case DW_TagKind_SubProgram: {
|
||||
DW_InlKind inl = dw_u64_from_attrib(&input, cu, tag, DW_AttribKind_Inline);
|
||||
@@ -1813,7 +1813,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
}
|
||||
|
||||
// get frame base expression
|
||||
String8 frame_base_expr = dw_exprloc_from_attrib(&input, cu, tag, DW_AttribKind_FrameBase);
|
||||
String8 frame_base_expr = dw_exprloc_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_FrameBase);
|
||||
|
||||
// get proc container symbol
|
||||
RDIM_Symbol *proc = rdim_symbol_chunk_list_push(arena, &procs, PROC_CHUNK_CAP );
|
||||
@@ -1824,9 +1824,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
root_scope->symbol = proc;
|
||||
|
||||
// fill out proc
|
||||
proc->is_extern = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_External);
|
||||
proc->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
proc->link_name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
proc->is_extern = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_External);
|
||||
proc->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
proc->link_name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
proc->type = proc_type;
|
||||
proc->container_symbol = 0;
|
||||
proc->container_type = container_type;
|
||||
@@ -1837,7 +1837,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
DW_TagKind parent_tag_kind = tag_stack->next->cur_node->tag.kind;
|
||||
if (parent_tag_kind == DW_TagKind_ClassType || parent_tag_kind == DW_TagKind_StructureType) {
|
||||
RDI_MemberKind member_kind = RDI_MemberKind_NULL;
|
||||
DW_VirtualityKind virtuality = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_Virtuality);
|
||||
DW_VirtualityKind virtuality = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Virtuality);
|
||||
switch (virtuality) {
|
||||
case DW_VirtualityKind_None: member_kind = RDI_MemberKind_Method; break;
|
||||
case DW_VirtualityKind_Virtual: member_kind = RDI_MemberKind_VirtualMethod; break;
|
||||
@@ -1849,7 +1849,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
RDIM_UDTMember *member = rdim_udt_push_member(arena, &udts, type->udt);
|
||||
member->kind = member_kind;
|
||||
member->type = type;
|
||||
member->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
} else if (parent_tag_kind != DW_TagKind_CompileUnit) {
|
||||
//AssertAlways(!"unexpected tag");
|
||||
}
|
||||
@@ -1887,7 +1887,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
|
||||
// fill out inline site
|
||||
RDIM_InlineSite *inline_site = rdim_inline_site_chunk_list_push(arena, &inline_sites, INLINE_SITE_CHUNK_CAP);
|
||||
inline_site->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
inline_site->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
inline_site->type = proc_type;
|
||||
inline_site->owner = owner;
|
||||
inline_site->line_table = 0;
|
||||
@@ -1898,7 +1898,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
root_scope->inline_site = inline_site;
|
||||
} break;
|
||||
case DW_TagKind_Variable: {
|
||||
String8 name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
String8 name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
RDIM_Type *type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
|
||||
DW_TagKind parent_tag_kind = tag_stack->next->cur_node->tag.kind;
|
||||
@@ -1920,9 +1920,9 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
}
|
||||
|
||||
RDIM_Symbol *gvar = rdim_symbol_chunk_list_push(arena, &gvars, GVAR_CHUNK_CAP);
|
||||
gvar->is_extern = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_External);
|
||||
gvar->is_extern = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_External);
|
||||
gvar->name = name;
|
||||
gvar->link_name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
gvar->link_name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
gvar->type = type;
|
||||
//gvar->locset = d2r_locset_from_attrib(arena, &input, cu, &scopes, global_scope, image_base, arch, tag, DW_AttribKind_Location);
|
||||
gvar->container_symbol = 0;
|
||||
@@ -1935,7 +1935,7 @@ d2r_convert(Arena *arena, RDIM_LocalState *local_state, RC_Context *in)
|
||||
RDIM_Scope *scope = tag_stack->next->scope;
|
||||
RDIM_Local *param = rdim_scope_push_local(arena, &scopes, scope);
|
||||
param->kind = RDI_LocalKind_Parameter;
|
||||
param->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
param->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
param->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
param->locset = d2r_var_locset_from_tag(arena, &input, cu, &scopes, scope, image_base, arch, tag);
|
||||
} else {
|
||||
|
||||
@@ -4947,7 +4947,7 @@ elf_print_dwarf_expressions(Arena *arena, String8List *out, String8 indent, Stri
|
||||
} else if (tag.kind == DW_TagKind_LexicalBlock || tag.kind == DW_TagKind_SubProgram) {
|
||||
++lexical_block_depth;
|
||||
if (tag.kind == DW_TagKind_SubProgram) {
|
||||
String8 expr = dw_exprloc_from_attrib(&dwarf_input, &cu, tag, DW_AttribKind_FrameBase);
|
||||
String8 expr = dw_exprloc_from_tag_attrib_kind(&dwarf_input, &cu, tag, DW_AttribKind_FrameBase);
|
||||
if (expr.size > 0) {
|
||||
String8 expr_str = dw_format_expression_single_line(comp_temp.arena, expr, cu_base, cu.address_size, arch, cu.version, cu.ext, cu.format);
|
||||
}
|
||||
@@ -4955,7 +4955,7 @@ elf_print_dwarf_expressions(Arena *arena, String8List *out, String8 indent, Stri
|
||||
} else if (tag.kind == DW_Tag_VariaKindble || tag.kind == DW_Tag_FormalParameter) {
|
||||
#if 0
|
||||
local_persist B32 is_global_var = 0;
|
||||
String8 name = dw_string_from_attrib(&dwarf_input, &cu, tag, DW_AttribKind_Name);
|
||||
String8 name = dw_string_from_tag_attrib_kind(&dwarf_input, &cu, tag, DW_AttribKind_Name);
|
||||
DW_Attrib *location_attrib = dw_attrib_from_tag(&dwarf_input, &cu, tag, DW_AttribKind_Location);
|
||||
DW_AttribClass value_class = dw_value_class_from_attrib(&cu, location_attrib);
|
||||
if (value_class != DW_AttribClass_Null) {
|
||||
@@ -4969,13 +4969,13 @@ elf_print_dwarf_expressions(Arena *arena, String8List *out, String8 indent, Stri
|
||||
|
||||
rd_indent();
|
||||
if (value_class == DW_AttribClass_LocListPtr || value_class == DW_AttribClass_LocList) {
|
||||
DW_LocList location = dw_loclist_from_attrib(comp_temp.arena, &dwarf_input, &cu, location_attrib);
|
||||
DW_LocList location = dw_loclist_from_tag_attrib_kind(comp_temp.arena, &dwarf_input, &cu, location_attrib);
|
||||
for (DW_LocNode *loc_n = location.first; loc_n != 0; loc_n = loc_n->next) {
|
||||
String8 expr_str = dw_format_expression_single_line(comp_temp.arena, loc_n->v.expr, cu_base, cu.address_size, arch, cu.version, cu.ext, cu.format);
|
||||
rd_printf("[%llx-%llx] %S", loc_n->v.range.min, loc_n->v.range.max, expr_str);
|
||||
}
|
||||
} else if (value_class == DW_AttribClass_ExprLoc) {
|
||||
String8 expr = dw_exprloc_from_attrib(&dwarf_input, &cu, location_attrib);
|
||||
String8 expr = dw_exprloc_from_tag_attrib_kind(&dwarf_input, &cu, location_attrib);
|
||||
String8 expr_str = dw_format_expression_single_line(comp_temp.arena, expr, cu_base, cu.address_size, arch, cu.version, cu.ext, cu.format);
|
||||
rd_printf("%S", expr_str);
|
||||
}
|
||||
@@ -4989,7 +4989,7 @@ elf_print_dwarf_expressions(Arena *arena, String8List *out, String8 indent, Stri
|
||||
Temp temp = temp_begin(comp_temp.arena);
|
||||
DW_Attrib *ranges_attrib = dw_attrib_from_tag(&dwarf_input, &cu, tag, DW_AttribKind_Ranges);
|
||||
if (ranges_attrib->attrib_kind == DW_AttribKind_Ranges) {
|
||||
Rng1U64List ranges = dw_rnglist_from_attrib(temp.arena, &dwarf_input, &cu, ranges_attrib);
|
||||
Rng1U64List ranges = dw_rnglist_from_tag_attrib_kind(temp.arena, &dwarf_input, &cu, ranges_attrib);
|
||||
}
|
||||
temp_end(temp);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ d2r_type_from_attrib(Arena *arena, D2R_TypeTable *type_table, DW_Input *input, D
|
||||
|
||||
if (value_class == DW_AttribClass_Reference) {
|
||||
// resolve reference
|
||||
DW_Reference ref = dw_ref_from_attrib_ptr(input, cu, attrib);
|
||||
DW_Reference ref = dw_ref_from_attrib(input, cu, attrib);
|
||||
|
||||
// TODO: support for external compile unit references
|
||||
AssertAlways(ref.cu == cu);
|
||||
@@ -99,7 +99,7 @@ internal Rng1U64List
|
||||
d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, DW_Tag tag)
|
||||
{
|
||||
// collect non-contiguous range
|
||||
Rng1U64List ranges = dw_rnglist_from_attrib(arena, input, cu, tag, DW_AttribKind_Ranges);
|
||||
Rng1U64List ranges = dw_rnglist_from_tag_attrib_kind(arena, input, cu, tag, DW_AttribKind_Ranges);
|
||||
|
||||
// debase ranges
|
||||
for (Rng1U64Node *range_n = ranges.first; range_n != 0; range_n = range_n->next) {
|
||||
@@ -114,14 +114,14 @@ d2r_range_list_from_tag(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 imag
|
||||
DW_Attrib *lo_pc_attrib = dw_attrib_from_tag(input, cu, tag, DW_AttribKind_LowPc);
|
||||
DW_Attrib *hi_pc_attrib = dw_attrib_from_tag(input, cu, tag, DW_AttribKind_HighPc);
|
||||
if (lo_pc_attrib->attrib_kind != DW_AttribKind_Null && hi_pc_attrib->attrib_kind != DW_AttribKind_Null) {
|
||||
U64 lo_pc = dw_address_from_attrib_ptr(input, cu, lo_pc_attrib);
|
||||
U64 lo_pc = dw_address_from_attrib(input, cu, lo_pc_attrib);
|
||||
|
||||
U64 hi_pc;
|
||||
DW_AttribClass hi_pc_class = dw_value_class_from_attrib(cu, hi_pc_attrib);
|
||||
if (hi_pc_class == DW_AttribClass_Address) {
|
||||
hi_pc = dw_address_from_attrib_ptr(input, cu, hi_pc_attrib);
|
||||
hi_pc = dw_address_from_attrib(input, cu, hi_pc_attrib);
|
||||
} else if (hi_pc_class == DW_AttribClass_Const) {
|
||||
hi_pc = dw_const_u64_from_attrib_ptr(input, cu, hi_pc_attrib);
|
||||
hi_pc = dw_const_u64_from_attrib(input, cu, hi_pc_attrib);
|
||||
hi_pc += lo_pc;
|
||||
} else {
|
||||
AssertAlways(!"undefined attrib encoding");
|
||||
@@ -592,7 +592,7 @@ SLLStackPush(stack, f); \
|
||||
DW_Tag tag = tag_node->tag;
|
||||
if (tag.kind == DW_TagKind_BaseType) {
|
||||
// extract encoding attribute
|
||||
DW_ATE encoding = dw_const_u64_from_attrib(input, cu, tag, DW_AttribKind_Encoding);
|
||||
DW_ATE encoding = dw_const_u64_from_tag_attrib_kind(input, cu, tag, DW_AttribKind_Encoding);
|
||||
|
||||
// DW_ATE -> RDI_EvalTypeGroup
|
||||
switch (encoding) {
|
||||
@@ -601,7 +601,7 @@ SLLStackPush(stack, f); \
|
||||
case DW_ATE_UnsignedChar:
|
||||
case DW_ATE_Unsigned: out = RDI_EvalTypeGroup_U; break;
|
||||
case DW_ATE_Float: {
|
||||
U64 byte_size = dw_const_u64_from_attrib(input, cu, tag, DW_AttribKind_ByteSize);
|
||||
U64 byte_size = dw_const_u64_from_tag_attrib_kind(input, cu, tag, DW_AttribKind_ByteSize);
|
||||
switch (byte_size) {
|
||||
case 4: out = RDI_EvalTypeGroup_F32; break;
|
||||
case 8: out = RDI_EvalTypeGroup_F64; break;
|
||||
@@ -838,7 +838,7 @@ d2r_transpile_expression(Arena *arena, DW_Input *input, U64 image_base, U64 addr
|
||||
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)
|
||||
{
|
||||
String8 expr = dw_exprloc_from_attrib(input, cu, tag, kind);
|
||||
String8 expr = dw_exprloc_from_tag_attrib_kind(input, cu, tag, kind);
|
||||
RDIM_Location *location = d2r_transpile_expression(arena, input, image_base, cu->address_size, arch, cu->addr_lu, cu, expr);
|
||||
return location;
|
||||
}
|
||||
@@ -864,7 +864,7 @@ d2r_locset_from_attrib(Arena *arena,
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
// extract location list from attrib
|
||||
DW_LocList loclist = dw_loclist_from_attrib_ptr(scratch.arena, input, cu, attrib);
|
||||
DW_LocList loclist = dw_loclist_from_attrib(scratch.arena, input, cu, attrib);
|
||||
|
||||
// convert location list to RDIM location set
|
||||
for (DW_LocNode *loc_n = loclist.first; loc_n != 0; loc_n = loc_n->next) {
|
||||
@@ -876,7 +876,7 @@ d2r_locset_from_attrib(Arena *arena,
|
||||
scratch_end(scratch);
|
||||
} else if (attrib_class == DW_AttribClass_ExprLoc) {
|
||||
// extract expression from attrib
|
||||
String8 expr = dw_exprloc_from_attrib_ptr(input, cu, attrib);
|
||||
String8 expr = dw_exprloc_from_attrib(input, cu, attrib);
|
||||
|
||||
// convert expression and inherit life-time ranges from enclosed scope
|
||||
RDIM_Location *location = d2r_transpile_expression(arena, input, image_base, cu->address_size, arch, cu->addr_lu, cu, expr);
|
||||
@@ -1211,9 +1211,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
DW_LineTableParseResult *cu_line_tables = push_array(scratch.arena, DW_LineTableParseResult, cu_ranges.count);
|
||||
for (U64 cu_idx = 0; cu_idx < cu_ranges.count; ++cu_idx) {
|
||||
DW_CompUnit *cu = &cu_arr[cu_idx];
|
||||
String8 cu_stmt_list = dw_line_ptr_from_attrib(&input, cu, cu->tag, DW_AttribKind_StmtList);
|
||||
String8 cu_dir = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||
String8 cu_name = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_Name);
|
||||
String8 cu_stmt_list = dw_line_ptr_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_StmtList);
|
||||
String8 cu_dir = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||
String8 cu_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_Name);
|
||||
cu_line_tables[cu_idx] = dw_parsed_line_table_from_data(scratch.arena, cu_stmt_list, &input, cu_dir, cu_name, cu->address_size, cu->str_offsets_lu);
|
||||
}
|
||||
ProfEnd();
|
||||
@@ -1336,8 +1336,8 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
// build tag hash table for abstract origin resolution
|
||||
cu->tag_ht = dw_make_tag_hash_table(comp_temp.arena, tag_tree);
|
||||
|
||||
String8 dwo_name = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_DwoName);
|
||||
String8 gnu_dwo_name = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_GNU_DwoName);
|
||||
String8 dwo_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_DwoName);
|
||||
String8 gnu_dwo_name = dw_string_from_tag_attrib_kind(&input, cu, cu->tag, DW_AttribKind_GNU_DwoName);
|
||||
if (dwo_name.size || gnu_dwo_name.size || cu->dwo_id) {
|
||||
// TODO: report that we dont support DWO
|
||||
continue;
|
||||
@@ -1346,10 +1346,10 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
// 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_attrib(&input, cu, cu->tag, DW_AttribKind_Name);
|
||||
String8 cu_dir = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||
String8 cu_prod = dw_string_from_attrib(&input, cu, cu->tag, DW_AttribKind_Producer);
|
||||
DW_Language cu_lang = dw_const_u64_from_attrib(&input, cu, cu->tag, DW_AttribKind_Language);
|
||||
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_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);
|
||||
|
||||
RDIM_Unit *unit = rdim_unit_chunk_list_push(arena, &units, UNIT_CHUNK_CAP);
|
||||
unit->unit_name = cu_name;
|
||||
@@ -1385,9 +1385,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
} break;
|
||||
case DW_TagKind_ClassType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteClass;
|
||||
|
||||
@@ -1407,9 +1407,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
} break;
|
||||
case DW_TagKind_StructureType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteStruct;
|
||||
|
||||
@@ -1429,9 +1429,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
} break;
|
||||
case DW_TagKind_UnionType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteUnion;
|
||||
|
||||
@@ -1451,9 +1451,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
} break;
|
||||
case DW_TagKind_EnumerationType: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
|
||||
B32 is_decl = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
B32 is_decl = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Declaration);
|
||||
if (is_decl) {
|
||||
type->kind = RDI_TypeKind_IncompleteEnum;
|
||||
|
||||
@@ -1500,11 +1500,11 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
case DW_TagKind_Typedef: {
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->kind = RDI_TypeKind_Alias;
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->direct_type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
} break;
|
||||
case DW_TagKind_BaseType: {
|
||||
DW_ATE encoding = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_Encoding);
|
||||
DW_ATE encoding = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Encoding);
|
||||
U64 byte_size = dw_byte_size_from_tag(&input, cu, tag);
|
||||
|
||||
// convert base type encoding to RDI version
|
||||
@@ -1611,7 +1611,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
|
||||
RDIM_Type *type = d2r_find_or_create_type_from_offset(arena, type_table, tag.info_off);
|
||||
type->kind = RDI_TypeKind_Alias;
|
||||
type->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
type->direct_type = base_type;
|
||||
} break;
|
||||
case DW_TagKind_PointerType: {
|
||||
@@ -1760,7 +1760,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
RDIM_UDTMember *member = rdim_udt_push_member(arena, &udts, parent->udt);
|
||||
member->kind = RDI_MemberKind_Base;
|
||||
member->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
member->off = safe_cast_u32(dw_const_u32_from_attrib(&input, cu, tag, DW_AttribKind_DataMemberLocation));
|
||||
member->off = safe_cast_u32(dw_const_u32_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_DataMemberLocation));
|
||||
} break;
|
||||
case DW_TagKind_Enumerator: {
|
||||
DW_TagNode *parent_node = tag_stack->next->cur_node;
|
||||
@@ -1771,8 +1771,8 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
|
||||
RDIM_Type *type = tag_stack->next->type;
|
||||
RDIM_UDTEnumVal *member = rdim_udt_push_enum_val(arena, &udts, type->udt);
|
||||
member->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->val = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_ConstValue);
|
||||
member->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->val = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_ConstValue);
|
||||
} break;
|
||||
case DW_TagKind_Member: {
|
||||
DW_TagNode *parent_node = tag_stack->next->cur_node;
|
||||
@@ -1793,9 +1793,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
RDIM_Type *type = tag_stack->next->type;
|
||||
RDIM_UDTMember *member = rdim_udt_push_member(arena, &udts, type->udt);
|
||||
member->kind = RDI_MemberKind_DataField;
|
||||
member->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
member->off = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_DataMemberLocation);
|
||||
member->off = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_DataMemberLocation);
|
||||
} break;
|
||||
case DW_TagKind_SubProgram: {
|
||||
DW_InlKind inl = dw_u64_from_attrib(&input, cu, tag, DW_AttribKind_Inline);
|
||||
@@ -1822,7 +1822,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
}
|
||||
|
||||
// get frame base expression
|
||||
String8 frame_base_expr = dw_exprloc_from_attrib(&input, cu, tag, DW_AttribKind_FrameBase);
|
||||
String8 frame_base_expr = dw_exprloc_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_FrameBase);
|
||||
|
||||
// get proc container symbol
|
||||
RDIM_Symbol *proc = rdim_symbol_chunk_list_push(arena, &procs, PROC_CHUNK_CAP );
|
||||
@@ -1833,9 +1833,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
root_scope->symbol = proc;
|
||||
|
||||
// fill out proc
|
||||
proc->is_extern = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_External);
|
||||
proc->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
proc->link_name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
proc->is_extern = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_External);
|
||||
proc->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
proc->link_name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
proc->type = proc_type;
|
||||
proc->container_symbol = 0;
|
||||
proc->container_type = container_type;
|
||||
@@ -1846,7 +1846,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
DW_TagKind parent_tag_kind = tag_stack->next->cur_node->tag.kind;
|
||||
if (parent_tag_kind == DW_TagKind_ClassType || parent_tag_kind == DW_TagKind_StructureType) {
|
||||
RDI_MemberKind member_kind = RDI_MemberKind_NULL;
|
||||
DW_VirtualityKind virtuality = dw_const_u64_from_attrib(&input, cu, tag, DW_AttribKind_Virtuality);
|
||||
DW_VirtualityKind virtuality = dw_const_u64_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Virtuality);
|
||||
switch (virtuality) {
|
||||
case DW_VirtualityKind_None: member_kind = RDI_MemberKind_Method; break;
|
||||
case DW_VirtualityKind_Virtual: member_kind = RDI_MemberKind_VirtualMethod; break;
|
||||
@@ -1858,7 +1858,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
RDIM_UDTMember *member = rdim_udt_push_member(arena, &udts, type->udt);
|
||||
member->kind = member_kind;
|
||||
member->type = type;
|
||||
member->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
member->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
} else if (parent_tag_kind != DW_TagKind_CompileUnit) {
|
||||
//AssertAlways(!"unexpected tag");
|
||||
}
|
||||
@@ -1896,7 +1896,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
|
||||
// fill out inline site
|
||||
RDIM_InlineSite *inline_site = rdim_inline_site_chunk_list_push(arena, &inline_sites, INLINE_SITE_CHUNK_CAP);
|
||||
inline_site->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
inline_site->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
inline_site->type = proc_type;
|
||||
inline_site->owner = owner;
|
||||
inline_site->line_table = 0;
|
||||
@@ -1907,7 +1907,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
root_scope->inline_site = inline_site;
|
||||
} break;
|
||||
case DW_TagKind_Variable: {
|
||||
String8 name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
String8 name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
RDIM_Type *type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
|
||||
DW_TagKind parent_tag_kind = tag_stack->next->cur_node->tag.kind;
|
||||
@@ -1929,9 +1929,9 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
}
|
||||
|
||||
RDIM_Symbol *gvar = rdim_symbol_chunk_list_push(arena, &gvars, GVAR_CHUNK_CAP);
|
||||
gvar->is_extern = dw_flag_from_attrib(&input, cu, tag, DW_AttribKind_External);
|
||||
gvar->is_extern = dw_flag_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_External);
|
||||
gvar->name = name;
|
||||
gvar->link_name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
gvar->link_name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_LinkageName);
|
||||
gvar->type = type;
|
||||
//gvar->locset = d2r_locset_from_attrib(arena, &input, cu, &scopes, global_scope, image_base, arch, tag, DW_AttribKind_Location);
|
||||
gvar->container_symbol = 0;
|
||||
@@ -1944,7 +1944,7 @@ d2r_convert(Arena *arena, ASYNC_Root *async_root, D2R_ConvertParams *params)
|
||||
RDIM_Scope *scope = tag_stack->next->scope;
|
||||
RDIM_Local *param = rdim_scope_push_local(arena, &scopes, scope);
|
||||
param->kind = RDI_LocalKind_Parameter;
|
||||
param->name = dw_string_from_attrib(&input, cu, tag, DW_AttribKind_Name);
|
||||
param->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
|
||||
param->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
|
||||
param->locset = d2r_var_locset_from_tag(arena, &input, cu, &scopes, scope, image_base, arch, tag);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user