mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-07 14:28:40 +00:00
all constants evaluation; constant autocompletion; constant name string baking fix
This commit is contained in:
@@ -9960,7 +9960,7 @@ rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs)
|
||||
// rjf: calculate most general list expression, given the dst_eval space
|
||||
B32 force_allow = 0;
|
||||
B32 expr_based_replace = 1;
|
||||
String8 list_expr = str8_lit("query:locals, query:globals, query:thread_locals, query:procedures, query:types");
|
||||
String8 list_expr = str8_lit("query:locals, query:globals, query:thread_locals, query:procedures, query:types, query:constants");
|
||||
{
|
||||
E_TypeKey maybe_enum_type = e_type_key_unwrap(dst_eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative & ~E_TypeUnwrapFlag_Enums);
|
||||
if(dst_eval.space.kind == RD_EvalSpaceKind_MetaCfg)
|
||||
@@ -12169,6 +12169,7 @@ rd_frame(void)
|
||||
{
|
||||
str8_lit_comp("procedures"),
|
||||
str8_lit_comp("thread_locals"),
|
||||
str8_lit_comp("constants"),
|
||||
str8_lit_comp("globals"),
|
||||
str8_lit_comp("types"),
|
||||
};
|
||||
|
||||
@@ -1553,6 +1553,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(debug_info_table)
|
||||
else if(str8_match(lhs_type->name, str8_lit("procedures"), 0)) {section = RDI_SectionKind_Procedures;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("globals"), 0)) {section = RDI_SectionKind_GlobalVariables;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("thread_locals"), 0)) {section = RDI_SectionKind_ThreadVariables;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("constants"), 0)) {section = RDI_SectionKind_Constants;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("types"), 0)) {section = RDI_SectionKind_UDTs;}
|
||||
}
|
||||
|
||||
@@ -1646,6 +1647,13 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(debug_info_table)
|
||||
symbol_name.str = rdi_string_from_idx(module->rdi, tvar->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_Constants:
|
||||
{
|
||||
RDI_Constant *cnst = rdi_element_from_name_idx(module->rdi, Constants, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(module->rdi, cnst->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_UDTs:
|
||||
{
|
||||
RDI_UDT *udt = rdi_element_from_name_idx(module->rdi, UDTs, element_idx);
|
||||
|
||||
@@ -1683,7 +1683,9 @@ rdi_print(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RD_Op
|
||||
rd_indent();
|
||||
for (U64 i = 0; i < tvar_count; ++i) {
|
||||
rd_printf("thread_variable[%llu]:", i);
|
||||
rd_indent();
|
||||
rdi_print_thread_variable(arena, out, indent, rdi, &tvar_array[i]);
|
||||
rd_unindent();
|
||||
}
|
||||
rd_unindent();
|
||||
rd_newline();
|
||||
@@ -1695,7 +1697,9 @@ rdi_print(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RD_Op
|
||||
rd_indent();
|
||||
for (U64 i = 0; i < constants_count; ++i) {
|
||||
rd_printf("constant[%llu]:", i);
|
||||
rd_indent();
|
||||
rdi_print_constant(arena, out, indent, rdi, &constants_array[i]);
|
||||
rd_unindent();
|
||||
}
|
||||
rd_unindent();
|
||||
rd_newline();
|
||||
|
||||
+14
-13
@@ -165,6 +165,7 @@ global read_only struct
|
||||
{ RD_Option_RdiUserDefinedTypes, "rdi_udt", "Dump user defined types" },
|
||||
{ RD_Option_RdiGlobalVars, "rdi_global_vars", "Dump global variables" },
|
||||
{ RD_Option_RdiThreadVars, "rdi_thread_vars", "Dump thread variables" },
|
||||
{ RD_Option_RdiConstants, "rdi_constants", "Dump constants" },
|
||||
{ RD_Option_RdiScopes, "rdi_scopes", "Dump scopes" },
|
||||
{ RD_Option_RdiScopeVMap, "rdi_scope_virtual_map", "Dump scope virtual map" },
|
||||
{ RD_Option_RdiInlineSites, "rdi_inline_sites", "Dump inline sites" },
|
||||
@@ -274,18 +275,18 @@ entry_point(CmdLine *cmdline)
|
||||
RDI_Parsed rdi = {0};
|
||||
RDI_ParseStatus parse_status = rdi_parse(raw_data.str, raw_data.size, &rdi);
|
||||
switch (parse_status) {
|
||||
case RDI_ParseStatus_Good: {
|
||||
RD_Option rdi_print_opts = opts;
|
||||
if ((rdi_print_opts & RD_Option_RdiAll) == 0) {
|
||||
rdi_print_opts |= RD_Option_RdiAll;
|
||||
}
|
||||
rdi_print(arena, out, indent, &rdi, rdi_print_opts);
|
||||
} break;
|
||||
case RDI_ParseStatus_HeaderDoesNotMatch: rd_errorf("RDI Parse: header does not match"); break;
|
||||
case RDI_ParseStatus_UnsupportedVersionNumber: rd_errorf("RDI Parse: unsupported version"); break;
|
||||
case RDI_ParseStatus_InvalidDataSecionLayout: rd_errorf("RDI Parse: invalid data section layout"); break;
|
||||
case RDI_ParseStatus_MissingRequiredSection: rd_errorf("RDI Parse: missing required section"); break;
|
||||
default: rd_errorf("RDI Parse: unknown parse status %u", parse_status); break;
|
||||
case RDI_ParseStatus_Good: {
|
||||
RD_Option rdi_print_opts = opts;
|
||||
if ((rdi_print_opts & RD_Option_RdiAll) == 0) {
|
||||
rdi_print_opts |= RD_Option_RdiAll;
|
||||
}
|
||||
rdi_print(arena, out, indent, &rdi, rdi_print_opts);
|
||||
} break;
|
||||
case RDI_ParseStatus_HeaderDoesNotMatch: rd_errorf("RDI Parse: header does not match"); break;
|
||||
case RDI_ParseStatus_UnsupportedVersionNumber: rd_errorf("RDI Parse: unsupported version"); break;
|
||||
case RDI_ParseStatus_InvalidDataSecionLayout: rd_errorf("RDI Parse: invalid data section layout"); break;
|
||||
case RDI_ParseStatus_MissingRequiredSection: rd_errorf("RDI Parse: missing required section"); break;
|
||||
default: rd_errorf("RDI Parse: unknown parse status %u", parse_status); break;
|
||||
}
|
||||
} else if (coff_is_regular_archive(raw_data) || coff_is_thin_archive(raw_data)) {
|
||||
coff_print_archive(arena, out, indent, raw_data, opts);
|
||||
@@ -305,7 +306,7 @@ entry_point(CmdLine *cmdline)
|
||||
//elf_print_dwarf_expressions(arena, out, indent, raw_data);
|
||||
}
|
||||
|
||||
exit:;
|
||||
exit:;
|
||||
// print formatted string
|
||||
String8 out_string = str8_list_join(arena, out, &(StringJoin){ .sep = str8_lit("\n"),});
|
||||
fprintf(stdout, "%.*s", str8_varg(out_string));
|
||||
|
||||
@@ -2971,10 +2971,13 @@ ASYNC_WORK_DEF(p2r_symbol_stream_convert_work)
|
||||
}
|
||||
|
||||
// rjf: build constant symbol
|
||||
RDIM_Symbol *cnst = rdim_symbol_chunk_list_push(arena, &sym_constants, sym_constants_chunk_cap);
|
||||
cnst->name = name_qualified;
|
||||
cnst->type = type;
|
||||
rdim_symbol_push_value_data(arena, &sym_constants, cnst, val_data);
|
||||
if(name_qualified.size != 0)
|
||||
{
|
||||
RDIM_Symbol *cnst = rdim_symbol_chunk_list_push(arena, &sym_constants, sym_constants_chunk_cap);
|
||||
cnst->name = name_qualified;
|
||||
cnst->type = type;
|
||||
rdim_symbol_push_value_data(arena, &sym_constants, cnst, val_data);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,6 +768,7 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
|
||||
&in_params->global_variables,
|
||||
&in_params->thread_variables,
|
||||
&in_params->procedures,
|
||||
&in_params->constants,
|
||||
};
|
||||
for(U64 list_idx = 0; list_idx < ArrayCount(symbol_lists); list_idx += 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user