mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-30 03:00:01 +00:00
promote content scope to base layer, rename as 'access'; generalize based just on list of scope refcounts, + optional cvs; eliminate c_scope; replace dasm_scope with access as well
This commit is contained in:
+29
-29
@@ -1750,9 +1750,9 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
|
||||
C_ID id = {space.u128};
|
||||
C_Key key = c_key_make(root, id);
|
||||
U128 hash = c_hash_from_key(key, 0);
|
||||
C_Scope *scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
{
|
||||
String8 data = c_data_from_hash(scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
Rng1U64 legal_range = r1u64(0, data.size);
|
||||
Rng1U64 read_range = intersect_1u64(range, legal_range);
|
||||
if(read_range.min < read_range.max)
|
||||
@@ -1761,7 +1761,7 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
|
||||
MemoryCopy(out, data.str + read_range.min, dim_1u64(read_range));
|
||||
}
|
||||
}
|
||||
c_scope_close(scope);
|
||||
access_close(access);
|
||||
}break;
|
||||
|
||||
//- rjf: file reads
|
||||
@@ -1783,9 +1783,9 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
|
||||
U128 hash = c_hash_from_key(key, 0);
|
||||
|
||||
// rjf: look up from hash store
|
||||
C_Scope *scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
{
|
||||
String8 data = c_data_from_hash(scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
Rng1U64 legal_range = r1u64(containing_range.min, containing_range.min + data.size);
|
||||
Rng1U64 read_range = intersect_1u64(range, legal_range);
|
||||
if(read_range.min < read_range.max)
|
||||
@@ -1794,7 +1794,7 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
|
||||
MemoryCopy(out, data.str + read_range.min - containing_range.min, dim_1u64(read_range));
|
||||
}
|
||||
}
|
||||
c_scope_close(scope);
|
||||
access_close(access);
|
||||
}break;
|
||||
|
||||
//- rjf: interior control entity reads (inside process address space or thread register block)
|
||||
@@ -2181,12 +2181,12 @@ rd_whole_range_from_eval_space(E_Space space)
|
||||
C_ID id = {space.u128};
|
||||
C_Key key = c_key_make(root, id);
|
||||
U128 hash = c_hash_from_key(key, 0);
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
{
|
||||
String8 data = c_data_from_hash(c_scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
result = r1u64(0, data.size);
|
||||
}
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}break;
|
||||
case E_SpaceKind_File:
|
||||
{
|
||||
@@ -2879,10 +2879,10 @@ rd_view_ui(Rng2F32 rect)
|
||||
B32 data_is_ready = 0;
|
||||
String8 new_view_name = {0};
|
||||
{
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
if(!u128_match(hash, u128_zero()))
|
||||
{
|
||||
String8 data = c_data_from_hash(c_scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
U64 num_utf8_bytes = 0;
|
||||
U64 num_unknown_bytes = 0;
|
||||
for(U64 idx = 0; idx < data.size && idx < range.max;)
|
||||
@@ -2911,7 +2911,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
new_view_name = str8_lit("memory");
|
||||
}
|
||||
}
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}
|
||||
|
||||
// rjf: if we don't have a viewer, just use the memory viewer.
|
||||
@@ -5993,7 +5993,7 @@ rd_window_frame(void)
|
||||
//- rjf: @window_frame_part compute window's theme
|
||||
//
|
||||
{
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
|
||||
//- rjf: try to find theme settings from the project, then the user.
|
||||
RD_CfgList colors_cfgs = {0};
|
||||
@@ -6039,7 +6039,7 @@ rd_window_frame(void)
|
||||
}
|
||||
|
||||
//- rjf: map the theme config to the associated tree (either from a preset, or from a file)
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, c_scope, theme_cfg->first->string);
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, access, theme_cfg->first->string);
|
||||
if(colors_cfgs.count == 0 && theme_tree == &md_nil_node)
|
||||
{
|
||||
theme_tree = rd_state->theme_preset_trees[RD_ThemePreset_DefaultDark];
|
||||
@@ -6110,7 +6110,7 @@ rd_window_frame(void)
|
||||
}
|
||||
}
|
||||
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -10205,7 +10205,7 @@ rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs)
|
||||
//- rjf: colors
|
||||
|
||||
internal MD_Node *
|
||||
rd_theme_tree_from_name(Arena *arena, C_Scope *scope, String8 theme_name)
|
||||
rd_theme_tree_from_name(Arena *arena, Access *access, String8 theme_name)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
MD_Node *theme_tree = &md_nil_node;
|
||||
@@ -10228,7 +10228,7 @@ rd_theme_tree_from_name(Arena *arena, C_Scope *scope, String8 theme_name)
|
||||
endt_us = os_now_microseconds()+50000;
|
||||
}
|
||||
U128 hash = fs_hash_from_path_range(path, r1u64(0, max_U64), endt_us);
|
||||
String8 data = c_data_from_hash(scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
theme_tree = md_tree_from_string(arena, data);
|
||||
}
|
||||
}
|
||||
@@ -12459,10 +12459,10 @@ rd_frame(void)
|
||||
|
||||
//- rjf: add macro for output log
|
||||
{
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
C_Key key = d_state->output_log_key;
|
||||
U128 hash = c_hash_from_key(key, 0);
|
||||
String8 data = c_data_from_hash(c_scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
E_Space space = e_space_make(E_SpaceKind_HashStoreKey);
|
||||
space.u64_0 = key.root.u64[0];
|
||||
space.u128 = key.id.u128[0];
|
||||
@@ -12471,7 +12471,7 @@ rd_frame(void)
|
||||
expr->mode = E_Mode_Offset;
|
||||
expr->type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), data.size, 0);
|
||||
e_string2expr_map_insert(scratch.arena, macro_map, str8_lit("output"), expr);
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}
|
||||
|
||||
//- rjf: (DEBUG) add macro for cfg strings
|
||||
@@ -15936,10 +15936,10 @@ rd_frame(void)
|
||||
}break;
|
||||
case RD_CmdKind_AddThemeColor:
|
||||
{
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg);
|
||||
RD_Cfg *theme = rd_cfg_child_from_string_or_alloc(parent, str8_lit("theme"));
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, c_scope, theme->first->string);
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, access, theme->first->string);
|
||||
if(theme_tree == &md_nil_node)
|
||||
{
|
||||
rd_cfg_new_replace(theme, rd_theme_preset_display_string_table[RD_ThemePreset_DefaultDark]);
|
||||
@@ -15948,11 +15948,11 @@ rd_frame(void)
|
||||
rd_cfg_new(color, str8_lit("tags"));
|
||||
RD_Cfg *value = rd_cfg_new(color, str8_lit("value"));
|
||||
rd_cfg_new(value, str8_lit("0xffffffff"));
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}break;
|
||||
case RD_CmdKind_ForkTheme:
|
||||
{
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg);
|
||||
RD_CfgList colors = rd_cfg_child_list_from_string(scratch.arena, parent, str8_lit("theme_color"));
|
||||
for(RD_CfgNode *n = colors.first; n != 0; n = n->next)
|
||||
@@ -15961,7 +15961,7 @@ rd_frame(void)
|
||||
}
|
||||
RD_Cfg *theme_cfg = rd_cfg_child_from_string(parent, str8_lit("theme"));
|
||||
String8 theme_name = theme_cfg->first->string;
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, c_scope, theme_name);
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, access, theme_name);
|
||||
if(theme_tree == &md_nil_node)
|
||||
{
|
||||
theme_tree = rd_state->theme_preset_trees[RD_ThemePreset_DefaultDark];
|
||||
@@ -15978,7 +15978,7 @@ rd_frame(void)
|
||||
}
|
||||
}
|
||||
rd_cfg_release(theme_cfg);
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}break;
|
||||
case RD_CmdKind_SaveTheme:
|
||||
case RD_CmdKind_SaveAndSetTheme:
|
||||
@@ -16091,7 +16091,7 @@ rd_frame(void)
|
||||
case RD_CmdKind_GoToNameAtCursor:
|
||||
case RD_CmdKind_ToggleWatchExpressionAtCursor:
|
||||
{
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
RD_Regs *regs = rd_regs();
|
||||
C_Key text_key = regs->text_key;
|
||||
@@ -16099,7 +16099,7 @@ rd_frame(void)
|
||||
TxtRng range = txt_rng(regs->cursor, regs->mark);
|
||||
U128 hash = {0};
|
||||
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, text_key, lang_kind, &hash);
|
||||
String8 data = c_data_from_hash(c_scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
Rng1U64 expr_off_range = {0};
|
||||
if(range.min.column != range.max.column)
|
||||
{
|
||||
@@ -16115,7 +16115,7 @@ rd_frame(void)
|
||||
RD_CmdKind_GoToName),
|
||||
.string = expr);
|
||||
txt_scope_close(txt_scope);
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}break;
|
||||
case RD_CmdKind_SetNextStatement:
|
||||
{
|
||||
|
||||
@@ -988,7 +988,7 @@ internal void rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs);
|
||||
//~ rjf: Colors, Fonts, Config
|
||||
|
||||
//- rjf: colors
|
||||
internal MD_Node *rd_theme_tree_from_name(Arena *arena, C_Scope *scope, String8 theme_name);
|
||||
internal MD_Node *rd_theme_tree_from_name(Arena *arena, Access *access, String8 theme_name);
|
||||
internal Vec4F32 rd_rgba_from_code_color_slot(RD_CodeColorSlot slot);
|
||||
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind(TXT_TokenKind kind);
|
||||
internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string);
|
||||
|
||||
+13
-15
@@ -1944,8 +1944,8 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" "));
|
||||
dr_fstrs_push_new(arena, &fstrs, ¶ms, name);
|
||||
{
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, c_scope, name);
|
||||
Access *access = access_open();
|
||||
MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, access, name);
|
||||
U64 color_idx = 0;
|
||||
for(MD_Node *n = theme_tree; color_idx < 4 && !md_node_is_nil(n); n = md_node_rec_depth_first_pre(n, theme_tree).next)
|
||||
{
|
||||
@@ -1973,7 +1973,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
}
|
||||
}
|
||||
}
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
}
|
||||
result.eval_fstrs = fstrs;
|
||||
}break;
|
||||
@@ -2025,7 +2025,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
|
||||
RD_CodeViewState *cv = rd_view_state(RD_CodeViewState);
|
||||
rd_code_view_init(cv);
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
|
||||
//////////////////////////////
|
||||
@@ -2091,7 +2091,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
|
||||
}
|
||||
U128 hash = {0};
|
||||
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, rd_regs()->text_key, rd_regs()->lang_kind, &hash);
|
||||
String8 data = c_data_from_hash(c_scope, hash);
|
||||
String8 data = c_data_from_hash(access, hash);
|
||||
B32 file_is_missing = (rd_regs()->file_path.size != 0 && os_properties_from_file_path(rd_regs()->file_path).modified == 0);
|
||||
B32 key_has_data = !u128_match(hash, u128_zero()) && info.lines_count;
|
||||
ProfEnd();
|
||||
@@ -2251,7 +2251,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
|
||||
rd_store_view_param_s64(str8_lit("mark_column"), rd_regs()->mark.column);
|
||||
|
||||
txt_scope_close(txt_scope);
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -2291,8 +2291,7 @@ RD_VIEW_UI_FUNCTION_DEF(disasm)
|
||||
}
|
||||
RD_CodeViewState *cv = &dv->cv;
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
DASM_Scope *dasm_scope = dasm_scope_open();
|
||||
Access *access = access_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
|
||||
//////////////////////////////
|
||||
@@ -2410,12 +2409,12 @@ RD_VIEW_UI_FUNCTION_DEF(disasm)
|
||||
dasm_params.base_vaddr = base_vaddr;
|
||||
dasm_params.dbgi_key = dbgi_key;
|
||||
}
|
||||
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash);
|
||||
DASM_Info dasm_info = dasm_info_from_key_params(access, dasm_key, &dasm_params, &dasm_data_hash);
|
||||
rd_regs()->text_key = dasm_info.text_key;
|
||||
rd_regs()->lang_kind = txt_lang_kind_from_arch(arch);
|
||||
U128 dasm_text_hash = {0};
|
||||
TXT_TextInfo dasm_text_info = txt_text_info_from_key_lang(txt_scope, rd_regs()->text_key, rd_regs()->lang_kind, &dasm_text_hash);
|
||||
String8 dasm_text_data = c_data_from_hash(c_scope, dasm_text_hash);
|
||||
String8 dasm_text_data = c_data_from_hash(access, dasm_text_hash);
|
||||
B32 has_disasm = (dasm_info.lines.count != 0 && dasm_text_info.lines_count != 0);
|
||||
B32 is_loading = (!has_disasm && dim_1u64(range) != 0 && eval.msgs.max_kind == E_MsgKind_Null && (space.kind != RD_EvalSpaceKind_CtrlEntity || space_entity != &ctrl_entity_nil));
|
||||
|
||||
@@ -2496,8 +2495,7 @@ RD_VIEW_UI_FUNCTION_DEF(disasm)
|
||||
dv->mark = rd_regs()->mark;
|
||||
|
||||
txt_scope_close(txt_scope);
|
||||
dasm_scope_close(dasm_scope);
|
||||
c_scope_close(c_scope);
|
||||
access_close(access);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -3826,7 +3824,7 @@ EV_EXPAND_RULE_INFO_FUNCTION_DEF(bitmap)
|
||||
RD_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
C_Scope *c_scope = c_scope_open();
|
||||
Access *access = access_open();
|
||||
TEX_Scope *tex_scope = tex_scope_open();
|
||||
|
||||
//////////////////////////////
|
||||
@@ -3878,7 +3876,7 @@ RD_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
TEX_Topology topology = tex_topology_make(dim, fmt);
|
||||
U128 data_hash = {0};
|
||||
R_Handle texture = tex_texture_from_key_topology(tex_scope, texture_key, topology, &data_hash);
|
||||
String8 data = c_data_from_hash(c_scope, data_hash);
|
||||
String8 data = c_data_from_hash(access, data_hash);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: equip loading info
|
||||
@@ -4031,8 +4029,8 @@ RD_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
rd_store_view_param_f32(str8_lit("x"), view_center_pos.x);
|
||||
rd_store_view_param_f32(str8_lit("y"), view_center_pos.y);
|
||||
|
||||
c_scope_close(c_scope);
|
||||
tex_scope_close(tex_scope);
|
||||
access_close(access);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user