mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-09-24 02:00:05 +00:00
get debugger onto new location info & symbol format
This commit is contained in:
+24
-260
@@ -77,7 +77,7 @@
|
||||
"";
|
||||
"// \"raddbg\\0\\0\"";
|
||||
"#define RDI_MAGIC_CONSTANT 0x0000676264646172";
|
||||
"#define RDI_ENCODING_VERSION 21";
|
||||
"#define RDI_ENCODING_VERSION 22";
|
||||
"";
|
||||
"////////////////////////////////////////////////////////////////";
|
||||
"//~ Format Types & Functions";
|
||||
@@ -179,52 +179,36 @@ RDI_SectionTable:
|
||||
{Members members RDI_Member 0x0015 U32 ""}
|
||||
{EnumMembers enum_members RDI_EnumMember 0x0016 U32 ""}
|
||||
|
||||
//- TODO(rjf): vvv old story for symbols
|
||||
{GlobalVariables global_variables RDI_GlobalVariable 0x0017 U32 ""}
|
||||
{ThreadVariables thread_variables RDI_ThreadVariable 0x0018 U32 ""}
|
||||
{Constants constants RDI_Constant 0x0019 U32 ""}
|
||||
{Procedures procedures RDI_Procedure 0x001A U32 ""}
|
||||
{Locals locals RDI_Local 0x001B U32 ""}
|
||||
|
||||
|
||||
//- rjf: scope info
|
||||
{Scopes scopes RDI_Scope 0x001C U32 ""}
|
||||
{ScopeVOffData scope_voff_data RDI_U64 0x001D U32 ""}
|
||||
{ScopeVMap scope_vmap RDI_VMapEntry 0x001E - ""}
|
||||
{InlineSites inline_sites RDI_InlineSite 0x001F U32 ""}
|
||||
{Scopes scopes RDI_Scope 0x0017 U32 ""}
|
||||
{ScopeVOffData scope_voff_data RDI_U64 0x0018 U32 ""}
|
||||
{ScopeVMap scope_vmap RDI_VMapEntry 0x0019 - ""}
|
||||
{InlineSites inline_sites RDI_InlineSite 0x001A U32 ""}
|
||||
|
||||
//- TODO(rjf): vvv old story for locations
|
||||
{LocationBlocks location_blocks RDI_LocationBlock 0x0020 U32 ""}
|
||||
{LocationData location_data RDI_U8 0x0021 U32 ""}
|
||||
//- rjf: symbols
|
||||
{GlobalVariableSymbols global_variable_symbols RDI_Symbol 0x001B U32 ""}
|
||||
{GlobalVMap global_vmap RDI_VMapEntry 0x001C - ""}
|
||||
{ThreadVariableSymbols thread_variable_symbols RDI_Symbol 0x001D U32 ""}
|
||||
{ConstantSymbols constant_symbols RDI_Symbol 0x001E U32 ""}
|
||||
{ProcedureSymbols procedure_symbols RDI_Symbol 0x001F U32 ""}
|
||||
{LocalVariableSymbols local_variable_symbols RDI_Symbol 0x0020 U32 ""}
|
||||
|
||||
//- NOTE(rjf): vvv new story for symbols
|
||||
{GlobalVariableSymbols global_variable_symbols RDI_Symbol 0x0022 U32 ""}
|
||||
{GlobalVMap global_vmap RDI_VMapEntry 0x0023 - ""}
|
||||
{ThreadVariableSymbols thread_variable_symbols RDI_Symbol 0x0024 U32 ""}
|
||||
{ConstantSymbols constant_symbols RDI_Symbol 0x0025 U32 ""}
|
||||
{ProcedureSymbols procedure_symbols RDI_Symbol 0x0026 U32 ""}
|
||||
{LocalVariableSymbols local_variable_symbols RDI_Symbol 0x0027 U32 ""}
|
||||
|
||||
//- NOTE(rjf): vvv new story for locations
|
||||
{LocationsBytecodeData locations_bytecode_data RDI_U8 0x0028 U32 ""}
|
||||
{LocationsConstantData locations_constant_data RDI_U8 0x0029 U32 ""}
|
||||
{LocationsSetElements locations_set_elements RDI_LocationSetElement 0x002A U32 ""}
|
||||
|
||||
//- TODO(rjf): vvv old story for locations (constants)
|
||||
{ConstantValueData constant_value_data RDI_U8 0x002B U32 ""}
|
||||
{ConstantValueTable constant_value_table RDI_U32 0x002C U32 ""}
|
||||
//- rjf: locations
|
||||
{LocationsBytecodeData locations_bytecode_data RDI_U8 0x0021 U32 ""}
|
||||
{LocationsConstantData locations_constant_data RDI_U8 0x0022 U32 ""}
|
||||
{LocationsSetElements locations_set_elements RDI_LocationSetElement 0x0023 U32 ""}
|
||||
|
||||
//- rjf: checksums / timestamps
|
||||
{MD5Checksums md5_checksums RDI_MD5 0x002D U32 ""}
|
||||
{SHA1Checksums sha1_checksums RDI_SHA1 0x002E U32 ""}
|
||||
{SHA256Checksums sha256_checksums RDI_SHA256 0x002F U32 ""}
|
||||
{Timestamps timestamps RDI_U64 0x0030 U32 ""}
|
||||
{MD5Checksums md5_checksums RDI_MD5 0x0024 U32 ""}
|
||||
{SHA1Checksums sha1_checksums RDI_SHA1 0x0025 U32 ""}
|
||||
{SHA256Checksums sha256_checksums RDI_SHA256 0x0026 U32 ""}
|
||||
{Timestamps timestamps RDI_U64 0x0027 U32 ""}
|
||||
|
||||
//- rjf: name maps
|
||||
{NameMaps name_maps RDI_NameMap 0x0031 U32 ""}
|
||||
{NameMapBuckets name_map_buckets RDI_NameMapBucket 0x0032 U32 ""}
|
||||
{NameMapNodes name_map_nodes RDI_NameMapNode 0x0033 U32 ""}
|
||||
{COUNT count RDI_U8 0x0034 - ""}
|
||||
{NameMaps name_maps RDI_NameMap 0x0028 U32 ""}
|
||||
{NameMapBuckets name_map_buckets RDI_NameMapBucket 0x0029 U32 ""}
|
||||
{NameMapNodes name_map_nodes RDI_NameMapNode 0x002A U32 ""}
|
||||
{COUNT count RDI_U8 0x002B - ""}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
@@ -1016,22 +1000,6 @@ RDI_ContainerFlagTable:
|
||||
{KindMask `0x7f`}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
RDI_LinkFlagTable:
|
||||
{
|
||||
{External `1<<0`}
|
||||
{TypeScoped `1<<1`}
|
||||
{ProcScoped `1<<2`}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
RDI_LocalKindTable:
|
||||
{
|
||||
{NULL 0x0}
|
||||
{Parameter 0x1}
|
||||
{Variable 0x2}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
RDI_LocationKindTable:
|
||||
{
|
||||
@@ -1075,47 +1043,6 @@ RDI_SymbolMemberTable:
|
||||
{link_name_string_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_GlobalVariableMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{link_flags RDI_LinkFlags ""}
|
||||
{voff RDI_U64 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{container_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ThreadVariableMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{link_flags RDI_LinkFlags ""}
|
||||
{tls_off RDI_U32 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{container_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ConstantMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{constant_value_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ProcedureMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{link_name_string_idx RDI_U32 ""}
|
||||
{link_flags RDI_LinkFlags ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{root_scope_idx RDI_U32 ""}
|
||||
{container_idx RDI_U32 ""}
|
||||
{frame_base_location_first RDI_U32 ""}
|
||||
{frame_base_location_opl RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ScopeMemberTable:
|
||||
{
|
||||
@@ -1139,54 +1066,6 @@ RDI_InlineSiteMemberTable:
|
||||
{line_table_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocalMemberTable:
|
||||
{
|
||||
{kind RDI_LocalKind ""}
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{pad RDI_U32 ""}
|
||||
{location_first RDI_U32 ""}
|
||||
{location_opl RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationBlockMemberTable:
|
||||
{
|
||||
{scope_off_first RDI_U32 }
|
||||
{scope_off_opl RDI_U32 }
|
||||
{location_data_off RDI_U32 }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationBytecodeStreamMemberTable:
|
||||
{
|
||||
{kind RDI_LocationKind ""}
|
||||
// [... 0] null terminated byte sequence RDI_EvalBytecodeStream
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationRegPlusU16MemberTable:
|
||||
{
|
||||
{kind RDI_LocationKind }
|
||||
{reg_code RDI_RegCode }
|
||||
{offset RDI_U16 }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationRegMemberTable:
|
||||
{
|
||||
{kind RDI_LocationKind }
|
||||
{reg_code RDI_RegCode }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_RegAndOffsetU16MemberTable:
|
||||
{
|
||||
{reg_code RDI_RegCode }
|
||||
{offset RDI_U16 }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationSetElementMemberTable:
|
||||
{
|
||||
@@ -1207,16 +1086,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_ContainerFlagTable a) `$(a.name .. =>20) = $(a.value)`,
|
||||
}
|
||||
|
||||
@enum(RDI_U32) RDI_LinkFlags:
|
||||
{
|
||||
@expand(RDI_LinkFlagTable a) `$(a.name .. =>20) = $(a.value)`
|
||||
}
|
||||
|
||||
@enum(RDI_U32) RDI_LocalKind:
|
||||
{
|
||||
@expand(RDI_LocalKindTable a) `$(a.name .. =>20) = $(a.value)`
|
||||
}
|
||||
|
||||
@enum(RDI_U8) RDI_SymbolFlags:
|
||||
{
|
||||
@expand(RDI_SymbolFlagTable a) `$(a.name .. =>20) = $(a.value)`
|
||||
@@ -1265,11 +1134,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_LinkFlagTable a) `$(a.name != COUNT -> a.name)`;
|
||||
}
|
||||
|
||||
@xlist RDI_LocalKind_XList:
|
||||
{
|
||||
@expand(RDI_LocalKindTable a) `$(a.name != COUNT -> a.name)`;
|
||||
}
|
||||
|
||||
@xlist RDI_LocationKind_XList:
|
||||
{
|
||||
@expand(RDI_LocationKindTable a) `$(a.name != COUNT -> a.name)`;
|
||||
@@ -1285,21 +1149,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_SymbolMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_GlobalVariable_XList:
|
||||
{
|
||||
@expand(RDI_GlobalVariableMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_ThreadVariable_XList:
|
||||
{
|
||||
@expand(RDI_ThreadVariableMemberTable a) `$(type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_Procedure_XList:
|
||||
{
|
||||
@expand(RDI_ProcedureMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_Scope_XList:
|
||||
{
|
||||
@expand(RDI_ScopeMemberTable a) `$(a.type), $(a.name)`
|
||||
@@ -1310,41 +1159,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_InlineSiteMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_Local_XList:
|
||||
{
|
||||
@expand(RDI_LocalMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationBlock_XList:
|
||||
{
|
||||
@expand(RDI_LocationBlockMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationBytecodeStream_XList:
|
||||
{
|
||||
@expand(RDI_LocationBytecodeStreamMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationRegPlusU16_XList:
|
||||
{
|
||||
@expand(RDI_LocationRegPlusU16MemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationReg_XList:
|
||||
{
|
||||
@expand(RDI_LocationRegMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_RegAndOffsetU16_XList:
|
||||
{
|
||||
@expand(RDI_RegAndOffsetU16MemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationSetElement_XList:
|
||||
{
|
||||
@expand(RDI_LocationSetElementMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
//- rjf: structs
|
||||
|
||||
@struct RDI_Namespace:
|
||||
@@ -1357,26 +1171,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_SymbolMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_GlobalVariable:
|
||||
{
|
||||
@expand(RDI_GlobalVariableMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_ThreadVariable:
|
||||
{
|
||||
@expand(RDI_ThreadVariableMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Constant:
|
||||
{
|
||||
@expand(RDI_ConstantMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Procedure:
|
||||
{
|
||||
@expand(RDI_ProcedureMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Scope:
|
||||
{
|
||||
@expand(RDI_ScopeMemberTable a) `$(a.type) $(a.name)`
|
||||
@@ -1387,36 +1181,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_InlineSiteMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Local:
|
||||
{
|
||||
@expand(RDI_LocalMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationBlock:
|
||||
{
|
||||
@expand(RDI_LocationBlockMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationBytecodeStream:
|
||||
{
|
||||
@expand(RDI_LocationBytecodeStreamMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationRegPlusU16:
|
||||
{
|
||||
@expand(RDI_LocationRegPlusU16MemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationReg:
|
||||
{
|
||||
@expand(RDI_LocationRegMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_RegAndOffsetU16:
|
||||
{
|
||||
@expand(RDI_RegAndOffsetU16MemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationSetElement:
|
||||
{
|
||||
@expand(RDI_LocationSetElementMemberTable a) `$(a.type) $(a.name)`
|
||||
|
||||
+1
-231
@@ -93,20 +93,6 @@ rdi_string_from_language(Arena *arena, RDI_Language v)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_local_kind(Arena *arena, RDI_LocalKind v)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(v)
|
||||
{
|
||||
default:{result = push_str8f(arena, "<invalid RDI_LocalKind %u>", v);}break;
|
||||
#define X(name) case RDI_LocalKind_##name:{result = str8_lit(#name);}break;
|
||||
RDI_LocalKind_XList
|
||||
#undef X
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
internal String8
|
||||
rdi_string_from_type_kind(Arena *arena, RDI_TypeKind v)
|
||||
@@ -251,21 +237,6 @@ rdi_string_from_udt_flags(Arena *arena, RDI_UDTFlags flags)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_link_flags(Arena *arena, RDI_LinkFlags flags)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List list = {0};
|
||||
#define X(name) if (flags & RDI_LinkFlag_##name) { flags &= ~RDI_LinkFlag_##name; str8_list_push(scratch.arena, &list, str8_lit(#name)); }
|
||||
RDI_LinkFlags_XList;
|
||||
#undef X
|
||||
StringJoin join = {.sep = str8_lit("|")};
|
||||
String8 result = str8_list_join(arena, &list, &join);
|
||||
if(result.size == 0) { result = str8_lit("None"); }
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_bytecode(Arena *arena, RDI_Arch arch, String8 bc)
|
||||
{
|
||||
@@ -427,103 +398,6 @@ rdi_string_from_bytecode(Arena *arena, RDI_Arch arch, String8 bc)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8List
|
||||
rdi_strings_from_locations(Arena *arena, RDI_Parsed *rdi, RDI_Arch arch, Rng1U64 location_block_range)
|
||||
{
|
||||
String8List strings = {0};
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
U64 location_block_count = 0;
|
||||
U64 location_data_size = 0;
|
||||
RDI_LocationBlock *location_block_array = rdi_table_from_name(rdi, LocationBlocks, &location_block_count);
|
||||
RDI_U8 *location_data = rdi_table_from_name(rdi, LocationData, &location_data_size);
|
||||
Rng1U64 location_block_range_clamped = r1u64(ClampTop(location_block_range.min, location_block_count),
|
||||
ClampTop(location_block_range.max, location_block_count));
|
||||
for(U64 block_idx = location_block_range_clamped.min;
|
||||
block_idx < location_block_range_clamped.max;
|
||||
block_idx +=1)
|
||||
{
|
||||
String8 qualifier = {0};
|
||||
String8 location_info = {0};
|
||||
RDI_LocationBlock *block_ptr = &location_block_array[block_idx];
|
||||
if(block_ptr->scope_off_first == 0 && block_ptr->scope_off_opl == max_U32)
|
||||
{
|
||||
qualifier = str8_lit("*always*");
|
||||
}
|
||||
else
|
||||
{
|
||||
qualifier = push_str8f(scratch.arena, "[%#08x, %#08x): ", block_ptr->scope_off_first, block_ptr->scope_off_opl);
|
||||
}
|
||||
if(block_ptr->location_data_off >= location_data_size)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "<bad-location-data-offset %x>", block_ptr->location_data_off);
|
||||
}
|
||||
else
|
||||
{
|
||||
U8 *loc_data_opl = location_data + location_data_size;
|
||||
U8 *loc_base_ptr = location_data + block_ptr->location_data_off;
|
||||
RDI_LocationKind kind = *(RDI_LocationKind *)loc_base_ptr;
|
||||
switch(kind)
|
||||
{
|
||||
default:
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "\?\?\? (%u)", kind);
|
||||
}break;
|
||||
case RDI_LocationKind_AddrBytecodeStream:
|
||||
{
|
||||
String8 bc = str8_range(loc_base_ptr + 1, loc_data_opl);
|
||||
String8 bc_str = rdi_string_from_bytecode(scratch.arena, arch, bc);
|
||||
location_info = push_str8f(scratch.arena, "AddrBytecodeStream(%S)", bc_str);
|
||||
}break;
|
||||
case RDI_LocationKind_ValBytecodeStream:
|
||||
{
|
||||
String8 bc = str8_range(loc_base_ptr + 1, loc_data_opl);
|
||||
String8 bc_str = rdi_string_from_bytecode(scratch.arena, arch, bc);
|
||||
location_info = push_str8f(scratch.arena, "ValBytecodeStream(%S)", bc_str);
|
||||
}break;
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
{
|
||||
if(loc_base_ptr + sizeof(RDI_LocationRegPlusU16) > loc_data_opl)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "AddrRegPlusU16(\?\?\?)");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDI_LocationRegPlusU16 *loc = (RDI_LocationRegPlusU16*)loc_base_ptr;
|
||||
location_info = push_str8f(scratch.arena, "AddrRegPlusU16(reg: %S, off: %u)", rdi_string_from_reg_code(scratch.arena, arch, loc->reg_code), loc->offset);
|
||||
}
|
||||
}break;
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
if(loc_base_ptr + sizeof(RDI_LocationRegPlusU16) > loc_data_opl)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "AddrAddrRegPlusU16(\?\?\?)");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDI_LocationRegPlusU16 *loc = (RDI_LocationRegPlusU16 *)loc_base_ptr;
|
||||
location_info = push_str8f(scratch.arena, "AddrAddrRegisterPlusU16(reg: %S, off: %u)", rdi_string_from_reg_code(scratch.arena, arch, loc->reg_code), loc->offset);
|
||||
}
|
||||
}break;
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
if(loc_base_ptr + sizeof(RDI_LocationReg) > loc_data_opl)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "ValReg(\?\?\?)");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDI_LocationReg *loc = (RDI_LocationReg*)loc_base_ptr;
|
||||
location_info = push_str8f(scratch.arena, "ValReg(reg: %S)", rdi_string_from_reg_code(scratch.arena, arch, loc->reg_code));
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
str8_list_pushf(arena, &strings, "%S: %S", qualifier, location_info);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return strings;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Dumping
|
||||
|
||||
@@ -997,30 +871,6 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump global variables
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(GlobalVariables)
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_GlobalVariable *v = rdi_table_from_name(rdi, GlobalVariables, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_GlobalVariable *gvar = &v[idx];
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
dumpf("\n '%S': // global_variable[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, gvar->name_string_idx), idx);
|
||||
dumpf(" link_flags: `%S`\n", rdi_string_from_link_flags(scratch.arena, gvar->link_flags));
|
||||
dumpf(" voff: %#08x\n", gvar->voff);
|
||||
dumpf(" type_idx: %u\n", gvar->type_idx);
|
||||
dumpf(" container_idx: %u\n", gvar->container_idx);
|
||||
dumpf(" }\n");
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump global variables vmap
|
||||
//
|
||||
@@ -1036,86 +886,6 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump thread variables
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(ThreadVariables)
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_ThreadVariable *v = rdi_table_from_name(rdi, ThreadVariables, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_ThreadVariable *tvar = &v[idx];
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
dumpf("\n '%S': // thread_variable[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, tvar->name_string_idx), idx);
|
||||
dumpf(" link_flags: `%S`\n", rdi_string_from_link_flags(scratch.arena, tvar->link_flags));
|
||||
dumpf(" tls_off: %#08x\n", tvar->tls_off);
|
||||
dumpf(" type_idx: %u\n", tvar->type_idx);
|
||||
dumpf(" container_idx: %u\n", tvar->container_idx);
|
||||
dumpf(" }\n");
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump constants
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(Constants)
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_Constant *v = rdi_table_from_name(rdi, Constants, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_Constant *cnst = &v[idx];
|
||||
dumpf("\n '%S': // constant[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, cnst->name_string_idx), idx);
|
||||
dumpf(" type_idx: %u\n", cnst->type_idx);
|
||||
dumpf(" }\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump procedures
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(Procedures)
|
||||
{
|
||||
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
|
||||
U64 count = 0;
|
||||
RDI_Procedure *v = rdi_table_from_name(rdi, Procedures, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_Procedure *proc = &v[idx];
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
dumpf("\n '%S': // procedure[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, proc->name_string_idx), idx);
|
||||
dumpf(" link_name: '%S'\n", str8_from_rdi_string_idx(rdi, proc->link_name_string_idx));
|
||||
dumpf(" link_flags: `%S`\n", rdi_string_from_link_flags(scratch.arena, proc->link_flags));
|
||||
dumpf(" type_idx: %u\n", proc->type_idx);
|
||||
dumpf(" root_scope_idx: %u\n", proc->root_scope_idx);
|
||||
dumpf(" container_idx: %u\n", proc->container_idx);
|
||||
if(proc->frame_base_location_first != 0)
|
||||
{
|
||||
String8List frame_base_location_strings = rdi_strings_from_locations(scratch.arena, rdi, tli->arch, r1u64(proc->frame_base_location_first, proc->frame_base_location_opl));
|
||||
dumpf(" frame_base: // (first: %u, opl: %u)\n", proc->frame_base_location_first, proc->frame_base_location_opl);
|
||||
dumpf(" {\n");
|
||||
for(String8Node *n = frame_base_location_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
dumpf(" %S\n", n->string);
|
||||
}
|
||||
dumpf(" }\n");
|
||||
}
|
||||
dumpf(" }\n");
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump symbols
|
||||
//
|
||||
@@ -1514,7 +1284,7 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
|
||||
#if SUBPROGRAM_CONVERSION_TEST
|
||||
internal String8
|
||||
rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Procedure *proc, RDI_TypeNode *type)
|
||||
rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Symbol *proc, RDI_TypeNode *type)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
|
||||
+1
-4
@@ -82,7 +82,6 @@ internal String8 str8_from_rdi_path_node_idx(Arena *arean, RDI_Parsed *rdi, Path
|
||||
internal String8 rdi_string_from_data_section_kind(Arena *arena, RDI_SectionKind v);
|
||||
internal String8 rdi_string_from_arch (Arena *arena, RDI_Arch v);
|
||||
internal String8 rdi_string_from_language (Arena *arena, RDI_Language v);
|
||||
internal String8 rdi_string_from_local_kind (Arena *arena, RDI_LocalKind v);
|
||||
#if 0 // TODO(rjf): conflicts with RDI...
|
||||
internal String8 rdi_string_from_type_kind (Arena *arena, RDI_TypeKind v);
|
||||
#endif
|
||||
@@ -92,9 +91,7 @@ internal String8 rdi_string_from_name_map_kind(RDI_NameMapKind kind);
|
||||
internal String8 rdi_string_from_binary_section_flags(Arena *arena, RDI_BinarySectionFlags flags);
|
||||
internal String8 rdi_string_from_type_modifier_flags (Arena *arena, RDI_TypeModifierFlags flags);
|
||||
internal String8 rdi_string_from_udt_flags (Arena *arena, RDI_UDTFlags flags);
|
||||
internal String8 rdi_string_from_link_flags (Arena *arena, RDI_LinkFlags flags);
|
||||
internal String8 rdi_string_from_bytecode(Arena *arena, RDI_Arch arch, String8 bc);
|
||||
internal String8List rdi_strings_from_locations(Arena *arena, RDI_Parsed *rdi, RDI_Arch arch, Rng1U64 location_block_range);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Dumping
|
||||
@@ -104,6 +101,6 @@ internal String8List rdi_dump_list_from_parsed(Arena *arena, RDI_Parsed *rdi, RD
|
||||
////////////////////////////////
|
||||
//~ Type Formatter
|
||||
|
||||
internal String8 rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Procedure *proc, RDI_TypeNode *type);
|
||||
internal String8 rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Symbol *proc, RDI_TypeNode *type);
|
||||
|
||||
#endif // RDI_FORMAT_LOCAL_H
|
||||
|
||||
Reference in New Issue
Block a user