shift first-class basic type names to more widely-used names (int32 instead of S32, etc.); force match of any debugger-known basic type name -> key, do not settle for bogus aliases from debug info

This commit is contained in:
Ryan Fleury
2025-04-01 16:04:38 -07:00
parent 1c518bfa07
commit 190b74f411
4 changed files with 93 additions and 72 deletions
+2 -2
View File
@@ -52,8 +52,8 @@ commands =
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta eval_scratch && raddbg_stable --ipc bring_to_front && raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: running target
// .f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: local target builds
.build_raddbg = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+25 -25
View File
@@ -26,32 +26,32 @@ E_TypeKindTable:
{UChar8 "uchar8" 1 }
{UChar16 "uchar16" 2 }
{UChar32 "uchar32" 4 }
{U8 "U8" 1 }
{U16 "U16" 2 }
{U32 "U32" 4 }
{U64 "U64" 8 }
{U128 "U128" 16 }
{U256 "U256" 32 }
{U512 "U512" 64 }
{S8 "S8" 1 }
{S16 "S16" 2 }
{S32 "S32" 4 }
{S64 "S64" 8 }
{S128 "S128" 16 }
{S256 "S256" 32 }
{S512 "S512" 64 }
{U8 "uint8" 1 }
{U16 "uint16" 2 }
{U32 "uint32" 4 }
{U64 "uint64" 8 }
{U128 "uint128" 16 }
{U256 "uint256" 32 }
{U512 "uint512" 64 }
{S8 "int8" 1 }
{S16 "int16" 2 }
{S32 "int32" 4 }
{S64 "int64" 8 }
{S128 "int128" 16 }
{S256 "int256" 32 }
{S512 "int512" 64 }
{Bool "bool" 1 }
{F16 "F16" 2 }
{F32 "F32" 4 }
{F32PP "F32PP" 4 }
{F48 "F48" 6 }
{F64 "F64" 8 }
{F80 "F80" 10 }
{F128 "F128" 16 }
{ComplexF32 "ComplexF32" 8 }
{ComplexF64 "ComplexF64" 16 }
{ComplexF80 "ComplexF80" 20 }
{ComplexF128 "ComplexF128" 32 }
{F16 "float16" 2 }
{F32 "float32" 4 }
{F32PP "float32PP" 4 }
{F48 "float48" 6 }
{F64 "float64" 8 }
{F80 "float80" 10 }
{F128 "float128" 16 }
{ComplexF32 "complex_float32" 8 }
{ComplexF64 "complex_float64" 16 }
{ComplexF80 "complex_float80" 20 }
{ComplexF128 "complex_float128" 32 }
{Modifier "modifier" 0 }
{Ptr "ptr" 0 }
{LRef "lref" 0 }
+41 -20
View File
@@ -914,104 +914,125 @@ e_leaf_type_from_name(String8 name)
{
E_TypeKey key = zero_struct;
B32 found = 0;
for(U64 module_idx = 0; module_idx < e_parse_state->ctx->modules_count; module_idx += 1)
{
RDI_Parsed *rdi = e_parse_state->ctx->modules[module_idx].rdi;
RDI_NameMap *name_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Types);
RDI_ParsedNameMap parsed_name_map = {0};
rdi_parsed_from_name_map(rdi, name_map, &parsed_name_map);
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &parsed_name_map, name.str, name.size);
if(node != 0)
{
U32 match_count = 0;
U32 *matches = rdi_matches_from_map_node(rdi, node, &match_count);
if(match_count != 0)
{
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, matches[0]);
found = (type_node->kind != RDI_TypeKind_NULL);
key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), matches[0], module_idx);
break;
}
}
}
if(!found)
{
#define Case(str) (str8_match(name, str8_lit(str), 0))
if(0){}
else if(Case("u8") || Case("uint8") || Case("uint8_t") || Case("U8"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_U8);
}
else if(Case("uchar8") || Case("uchar"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_UChar8);
}
else if(Case("u16") || Case("uint16") || Case("uint16_t") || Case("U16"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_U16);
}
else if(Case("uchar16"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_UChar16);
}
else if(Case("u32") || Case("uint32") || Case("uint32_t") || Case("U32") || Case("uint"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_U32);
}
else if(Case("uchar32"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_UChar32);
}
else if(Case("u64") || Case("uint64") || Case("uint64_t") || Case("U64") || Case("size_t"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_U64);
}
else if(Case("s8") || Case("b8") || Case("B8") || Case("i8") || Case("int8") || Case("int8_t") || Case("S8"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_S8);
}
else if(Case("char8") || Case("char"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_Char8);
}
else if(Case("s16") || Case("b16") || Case("B16") || Case("i16") || Case("int16") || Case("int16_t") || Case("S16"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_S16);
}
else if(Case("char16"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_Char16);
}
else if(Case("s32") || Case("b32") || Case("B32") || Case("i32") || Case("int32") || Case("int32_t") || Case("char32") || Case("S32") || Case("int"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_S32);
}
else if(Case("char32"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_Char32);
}
else if(Case("s64") || Case("b64") || Case("B64") || Case("i64") || Case("int64") || Case("int64_t") || Case("S64") || Case("ssize_t"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_S64);
}
else if(Case("void"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_Void);
}
else if(Case("bool"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_Bool);
}
else if(Case("float") || Case("f32") || Case("F32") || Case("r32") || Case("R32"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_F32);
}
else if(Case("double") || Case("f64") || Case("F64") || Case("r64") || Case("R64"))
{
found = 1;
key = e_type_key_basic(E_TypeKind_F64);
}
#undef Case
}
if(!found)
{
for(U64 module_idx = 0; module_idx < e_parse_state->ctx->modules_count; module_idx += 1)
{
RDI_Parsed *rdi = e_parse_state->ctx->modules[module_idx].rdi;
RDI_NameMap *name_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Types);
RDI_ParsedNameMap parsed_name_map = {0};
rdi_parsed_from_name_map(rdi, name_map, &parsed_name_map);
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &parsed_name_map, name.str, name.size);
if(node != 0)
{
U32 match_count = 0;
U32 *matches = rdi_matches_from_map_node(rdi, node, &match_count);
if(match_count != 0)
{
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, matches[0]);
found = (type_node->kind != RDI_TypeKind_NULL);
key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), matches[0], module_idx);
break;
}
}
}
}
return key;
}
+25 -25
View File
@@ -26,32 +26,32 @@ str8_lit_comp("char32"),
str8_lit_comp("uchar8"),
str8_lit_comp("uchar16"),
str8_lit_comp("uchar32"),
str8_lit_comp("U8"),
str8_lit_comp("U16"),
str8_lit_comp("U32"),
str8_lit_comp("U64"),
str8_lit_comp("U128"),
str8_lit_comp("U256"),
str8_lit_comp("U512"),
str8_lit_comp("S8"),
str8_lit_comp("S16"),
str8_lit_comp("S32"),
str8_lit_comp("S64"),
str8_lit_comp("S128"),
str8_lit_comp("S256"),
str8_lit_comp("S512"),
str8_lit_comp("uint8"),
str8_lit_comp("uint16"),
str8_lit_comp("uint32"),
str8_lit_comp("uint64"),
str8_lit_comp("uint128"),
str8_lit_comp("uint256"),
str8_lit_comp("uint512"),
str8_lit_comp("int8"),
str8_lit_comp("int16"),
str8_lit_comp("int32"),
str8_lit_comp("int64"),
str8_lit_comp("int128"),
str8_lit_comp("int256"),
str8_lit_comp("int512"),
str8_lit_comp("bool"),
str8_lit_comp("F16"),
str8_lit_comp("F32"),
str8_lit_comp("F32PP"),
str8_lit_comp("F48"),
str8_lit_comp("F64"),
str8_lit_comp("F80"),
str8_lit_comp("F128"),
str8_lit_comp("ComplexF32"),
str8_lit_comp("ComplexF64"),
str8_lit_comp("ComplexF80"),
str8_lit_comp("ComplexF128"),
str8_lit_comp("float16"),
str8_lit_comp("float32"),
str8_lit_comp("float32PP"),
str8_lit_comp("float48"),
str8_lit_comp("float64"),
str8_lit_comp("float80"),
str8_lit_comp("float128"),
str8_lit_comp("complex_float32"),
str8_lit_comp("complex_float64"),
str8_lit_comp("complex_float80"),
str8_lit_comp("complex_float128"),
str8_lit_comp("modifier"),
str8_lit_comp("ptr"),
str8_lit_comp("lref"),