mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-16 17:12:23 -07:00
add memory view rule; adjust memory view to appropriately use eval parameterizations, so that it can be used as a view rule correctly
This commit is contained in:
+51
-13
@@ -3731,6 +3731,40 @@ df_key_from_eval_space_range(E_Space space, Rng1U64 range, B32 zero_terminated)
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: space -> entire range
|
||||
|
||||
internal Rng1U64
|
||||
df_whole_range_from_eval_space(E_Space space)
|
||||
{
|
||||
Rng1U64 result = r1u64(0, 0);
|
||||
DF_Entity *entity = df_entity_from_eval_space(space);
|
||||
switch(entity->kind)
|
||||
{
|
||||
//- rjf: nil space -> filesystem key encoded inside of `space`
|
||||
case DF_EntityKind_Nil:
|
||||
{
|
||||
HS_Scope *scope = hs_scope_open();
|
||||
U128 hash = {0};
|
||||
for(U64 idx = 0; idx < 2; idx += 1)
|
||||
{
|
||||
hash = hs_hash_from_key(space, idx);
|
||||
if(!u128_match(hash, u128_zero()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
String8 data = hs_data_from_hash(scope, hash);
|
||||
result = r1u64(0, data.size);
|
||||
hs_scope_close(scope);
|
||||
}break;
|
||||
case DF_EntityKind_Process:
|
||||
{
|
||||
result = r1u64(0, 0x7FFFFFFFFFFFull);
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Views
|
||||
|
||||
@@ -5280,20 +5314,24 @@ df_range_from_eval_params(E_Eval eval, MD_Node *params)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 size = df_value_from_params_key(params, str8_lit("size")).u64;
|
||||
if(size == 0 &&
|
||||
(e_type_kind_from_key(eval.type_key) == E_TypeKind_Array ||
|
||||
e_type_kind_from_key(e_type_direct_from_key(eval.type_key)) == E_TypeKind_Array))
|
||||
E_TypeKey type_key = e_type_unwrap(eval.type_key);
|
||||
E_TypeKind type_kind = e_type_kind_from_key(type_key);
|
||||
E_TypeKey direct_type_key = e_type_unwrap(e_type_direct_from_key(eval.type_key));
|
||||
E_TypeKind direct_type_kind = e_type_kind_from_key(direct_type_key);
|
||||
if(size == 0 && e_type_kind_is_pointer_or_ref(type_kind) && (direct_type_kind == E_TypeKind_Struct ||
|
||||
direct_type_kind == E_TypeKind_Union ||
|
||||
direct_type_kind == E_TypeKind_Class ||
|
||||
direct_type_kind == E_TypeKind_Array ||
|
||||
e_type_kind_is_basic_or_enum(direct_type_kind)))
|
||||
{
|
||||
E_Type *type = e_type_from_key(scratch.arena, eval.type_key);
|
||||
E_Type *array_type = type;
|
||||
if(array_type->kind != E_TypeKind_Array)
|
||||
{
|
||||
array_type = e_type_from_key(scratch.arena, array_type->direct_type_key);
|
||||
}
|
||||
if(array_type->kind != E_TypeKind_Array)
|
||||
{
|
||||
size = array_type->count;
|
||||
}
|
||||
size = e_type_byte_size_from_key(e_type_direct_from_key(e_type_unwrap(eval.type_key)));
|
||||
}
|
||||
if(size == 0 && eval.mode == E_Mode_Offset && (type_kind == E_TypeKind_Struct ||
|
||||
type_kind == E_TypeKind_Union ||
|
||||
type_kind == E_TypeKind_Class ||
|
||||
type_kind == E_TypeKind_Array))
|
||||
{
|
||||
size = e_type_byte_size_from_key(e_type_unwrap(eval.type_key));
|
||||
}
|
||||
if(size == 0)
|
||||
{
|
||||
|
||||
@@ -1558,6 +1558,9 @@ internal B32 df_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range
|
||||
//- rjf: asynchronous streamed reads -> hashes from spaces
|
||||
internal U128 df_key_from_eval_space_range(E_Space space, Rng1U64 range, B32 zero_terminated);
|
||||
|
||||
//- rjf: space -> entire range
|
||||
internal Rng1U64 df_whole_range_from_eval_space(E_Space space);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Views
|
||||
|
||||
@@ -1629,6 +1632,7 @@ internal B32 df_viz_row_is_editable(DF_EvalVizRow *row);
|
||||
|
||||
//- rjf: eval / view rule params tree info extraction
|
||||
internal U64 df_base_offset_from_eval(E_Eval eval);
|
||||
internal U64 df_size_from_eval_params(E_Eval eval, MD_Node *params);
|
||||
internal E_Value df_value_from_params(MD_Node *params);
|
||||
internal E_TypeKey df_type_key_from_params(MD_Node *params);
|
||||
internal E_Value df_value_from_params_key(MD_Node *params, String8 key);
|
||||
|
||||
@@ -537,6 +537,7 @@ DF_CoreViewRuleTable:
|
||||
{RGBA rgba "rgba" - x - x "Color (RGBA)" x "" "Displays as a color, interpreting the data as encoding R, G, B, and A values." }
|
||||
{Text text "text" - x - x "Text" x "x:{'lang':lang, 'size':expr}" "Displays as text." }
|
||||
{Disasm disasm "disasm" - x - x "Disassembly" x "x:{'arch':arch, 'size':expr}" "Displays as disassembled instructions, interpreting the data as raw machine code." }
|
||||
{Memory memory "memory" - x - x "Memory" x "x:{'size':expr}" "Displays as a raw memory grid." }
|
||||
{Graph graph "graph" - x - x "Graph" x "" "Displays as a pointer graph, visualizing nodes and edges formed by pointers directly." }
|
||||
{Bitmap bitmap "bitmap" - x - x "Bitmap" x "x:{'w':expr, 'h':expr, 'fmt':tex2dformat}" "Displays as a bitmap, interpreting the data as raw pixel data." }
|
||||
{Geo geo "geo" - x - x "Geometry" x "x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}" "Displays as geometry, interpreting the data as vertex data." }
|
||||
|
||||
@@ -481,7 +481,7 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
|
||||
{ str8_lit_comp("log_marker"), str8_lit_comp("Logs a marker in the application log, to denote specific points in time within the log."), str8_lit_comp(""), str8_lit_comp("Log Marker"), (DF_CmdSpecFlag_ListInUI*1)|(DF_CmdSpecFlag_ListInIPCDocs*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
};
|
||||
|
||||
DF_CoreViewRuleSpecInfo df_g_core_view_rule_spec_info_table[20] =
|
||||
DF_CoreViewRuleSpecInfo df_g_core_view_rule_spec_info_table[21] =
|
||||
{
|
||||
{str8_lit_comp("default"), str8_lit_comp("Default"), str8_lit_comp(""), str8_lit_comp(""), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(default) , },
|
||||
{str8_lit_comp("array"), str8_lit_comp("Array"), str8_lit_comp("x:{expr}"), str8_lit_comp("Specifies that a pointer points to N elements, rather than only 1."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*0)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*1)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*0), DF_CORE_VIEW_RULE_EXPR_RESOLUTION_FUNCTION_NAME(array) , 0, },
|
||||
@@ -500,6 +500,7 @@ DF_CoreViewRuleSpecInfo df_g_core_view_rule_spec_info_table[20] =
|
||||
{str8_lit_comp("rgba"), str8_lit_comp("Color (RGBA)"), str8_lit_comp(""), str8_lit_comp("Displays as a color, interpreting the data as encoding R, G, B, and A values."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(rgba) , },
|
||||
{str8_lit_comp("text"), str8_lit_comp("Text"), str8_lit_comp("x:{'lang':lang, 'size':expr}"), str8_lit_comp("Displays as text."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(text) , },
|
||||
{str8_lit_comp("disasm"), str8_lit_comp("Disassembly"), str8_lit_comp("x:{'arch':arch, 'size':expr}"), str8_lit_comp("Displays as disassembled instructions, interpreting the data as raw machine code."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(disasm) , },
|
||||
{str8_lit_comp("memory"), str8_lit_comp("Memory"), str8_lit_comp("x:{'size':expr}"), str8_lit_comp("Displays as a raw memory grid."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(memory) , },
|
||||
{str8_lit_comp("graph"), str8_lit_comp("Graph"), str8_lit_comp(""), str8_lit_comp("Displays as a pointer graph, visualizing nodes and edges formed by pointers directly."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(graph) , },
|
||||
{str8_lit_comp("bitmap"), str8_lit_comp("Bitmap"), str8_lit_comp("x:{'w':expr, 'h':expr, 'fmt':tex2dformat}"), str8_lit_comp("Displays as a bitmap, interpreting the data as raw pixel data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(bitmap) , },
|
||||
{str8_lit_comp("geo"), str8_lit_comp("Geometry"), str8_lit_comp("x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}"), str8_lit_comp("Displays as geometry, interpreting the data as vertex data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(geo) , },
|
||||
|
||||
@@ -367,6 +367,7 @@ DF_CoreViewRuleKind_Checkbox,
|
||||
DF_CoreViewRuleKind_RGBA,
|
||||
DF_CoreViewRuleKind_Text,
|
||||
DF_CoreViewRuleKind_Disasm,
|
||||
DF_CoreViewRuleKind_Memory,
|
||||
DF_CoreViewRuleKind_Graph,
|
||||
DF_CoreViewRuleKind_Bitmap,
|
||||
DF_CoreViewRuleKind_Geo,
|
||||
@@ -442,6 +443,7 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(omit);
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(rgba);
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(text);
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(disasm);
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(memory);
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(graph);
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(bitmap);
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(geo);
|
||||
|
||||
@@ -974,6 +974,7 @@ internal void df_view_store_param(DF_View *view, String8 key, String8 value);
|
||||
internal void df_view_store_paramf(DF_View *view, String8 key, char *fmt, ...);
|
||||
#define df_view_store_param_f32(view, key, f32) df_view_store_paramf((view), (key), "%ff", (f32))
|
||||
#define df_view_store_param_s64(view, key, s64) df_view_store_paramf((view), (key), "%I64d", (s64))
|
||||
#define df_view_store_param_u64(view, key, u64) df_view_store_paramf((view), (key), "0x%I64x", (u64))
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Expand-Keyed Transient View Functions
|
||||
|
||||
@@ -331,6 +331,7 @@ DF_GfxViewRuleTable:
|
||||
{"rgba" - - x x "" }
|
||||
{"text" - - - x "code" }
|
||||
{"disasm" - - - x "disassembly" }
|
||||
{"memory" - - - x "memory" }
|
||||
{"bitmap" - - - x "bitmap" }
|
||||
{"geo" - - x x "geometry" }
|
||||
}
|
||||
|
||||
+11
-100
@@ -721,108 +721,19 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(disasm)
|
||||
df_eval_viz_block_end(out, vb);
|
||||
}
|
||||
|
||||
#if 0
|
||||
DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
////////////////////////////////
|
||||
//~ rjf: "memory"
|
||||
|
||||
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(memory)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
DASM_Scope *dasm_scope = dasm_scope_open();
|
||||
DF_VR_DisasmState *state = df_view_rule_block_user_state(key, DF_VR_DisasmState);
|
||||
if(!state->initialized)
|
||||
{
|
||||
state->initialized = 1;
|
||||
state->cursor = state->mark = txt_pt(1, 1);
|
||||
}
|
||||
if(state->last_open_frame_idx+1 < df_frame_index())
|
||||
{
|
||||
state->loaded_t = 0;
|
||||
}
|
||||
state->last_open_frame_idx = df_frame_index();
|
||||
{
|
||||
//- rjf: unpack params
|
||||
DF_DisasmTopologyInfo top = df_vr_disasm_topology_info_from_cfg(cfg);
|
||||
|
||||
//- rjf: resolve to address value & range
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr + (top.size_cap ? top.size_cap : 2048));
|
||||
|
||||
//- rjf: unpack thread/process of eval
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
|
||||
//- rjf: unpack key for this region in memory
|
||||
U128 dasm_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 0);
|
||||
|
||||
//- rjf: key -> parsed text info
|
||||
U128 data_hash = {0};
|
||||
DASM_Params dasm_params = {0};
|
||||
{
|
||||
dasm_params.vaddr = vaddr_range.min;
|
||||
dasm_params.arch = top.arch;
|
||||
dasm_params.style_flags = DASM_StyleFlag_Addresses;
|
||||
dasm_params.syntax = DASM_Syntax_Intel;
|
||||
dasm_params.base_vaddr = 0;
|
||||
}
|
||||
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &data_hash);
|
||||
String8 dasm_text_data = {0};
|
||||
TXT_TextInfo dasm_text_info = {0};
|
||||
TXT_LangKind lang_kind = TXT_LangKind_DisasmX64Intel;
|
||||
for(U64 rewind_idx = 0; rewind_idx < 2; rewind_idx += 1)
|
||||
{
|
||||
U128 dasm_text_hash = hs_hash_from_key(dasm_info.text_key, rewind_idx);
|
||||
dasm_text_data = hs_data_from_hash(hs_scope, dasm_text_hash);
|
||||
dasm_text_info = txt_text_info_from_hash_lang(txt_scope, dasm_text_hash, lang_kind);
|
||||
if(dasm_text_info.lines_count != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
TXT_LineTokensSlice line_tokens_slice = txt_line_tokens_slice_from_info_data_line_range(scratch.arena, &dasm_text_info, dasm_text_data, r1s64(1, dasm_info.lines.count));
|
||||
|
||||
//- rjf: info -> code slice info
|
||||
DF_CodeSliceParams code_slice_params = {0};
|
||||
{
|
||||
code_slice_params.flags = DF_CodeSliceFlag_LineNums;
|
||||
code_slice_params.line_num_range = r1s64(1, dasm_text_info.lines_count);
|
||||
code_slice_params.line_text = push_array(scratch.arena, String8, dasm_text_info.lines_count);
|
||||
code_slice_params.line_ranges = push_array(scratch.arena, Rng1U64, dasm_text_info.lines_count);
|
||||
code_slice_params.line_tokens = push_array(scratch.arena, TXT_TokenArray, dasm_text_info.lines_count);
|
||||
code_slice_params.line_bps = push_array(scratch.arena, DF_EntityList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_ips = push_array(scratch.arena, DF_EntityList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_pins = push_array(scratch.arena, DF_EntityList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_vaddrs = push_array(scratch.arena, U64, dasm_text_info.lines_count);
|
||||
code_slice_params.line_infos = push_array(scratch.arena, DF_LineList, dasm_text_info.lines_count);
|
||||
for(U64 line_idx = 0; line_idx < dasm_text_info.lines_count; line_idx += 1)
|
||||
{
|
||||
code_slice_params.line_text[line_idx] = str8_substr(dasm_text_data, dasm_info.lines.v[line_idx].text_range);
|
||||
code_slice_params.line_ranges[line_idx] = dasm_info.lines.v[line_idx].text_range;
|
||||
code_slice_params.line_tokens[line_idx] = line_tokens_slice.line_tokens[line_idx];
|
||||
}
|
||||
code_slice_params.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
code_slice_params.font_size = ui_top_font_size();
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(ws, DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.line_height_px = ui_top_font_size()*1.5f;
|
||||
code_slice_params.priority_margin_width_px = 0;
|
||||
code_slice_params.catchall_margin_width_px = 0;
|
||||
code_slice_params.line_num_width_px = ui_top_font_size()*5.f;
|
||||
code_slice_params.line_text_max_width_px = ui_top_font_size()*2.f*dasm_text_info.lines_max_size;
|
||||
}
|
||||
|
||||
//- rjf: build code slice
|
||||
if(dasm_info.lines.count != 0 && dasm_text_info.lines_count != 0)
|
||||
UI_Padding(ui_pct(1, 0)) UI_PrefWidth(ui_px(dasm_text_info.lines_max_size*ui_top_font_size()*1.2f, 1.f)) UI_Column UI_Padding(ui_pct(1, 0))
|
||||
{
|
||||
DF_CodeSliceSignal sig = df_code_slice(ws, &code_slice_params, &state->cursor, &state->mark, &state->preferred_column, str8_lit("###code_slice"));
|
||||
}
|
||||
}
|
||||
dasm_scope_close(dasm_scope);
|
||||
txt_scope_close(txt_scope);
|
||||
hs_scope_close(hs_scope);
|
||||
scratch_end(scratch);
|
||||
DF_EvalVizBlock *vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_Canvas, key, df_expand_key_make(df_hash_from_expand_key(key), 1), depth);
|
||||
vb->string = string;
|
||||
vb->expr = expr;
|
||||
vb->visual_idx_range = r1u64(0, 16);
|
||||
vb->semantic_idx_range = r1u64(0, 1);
|
||||
vb->cfg_table = cfg_table;
|
||||
df_eval_viz_block_end(out, vb);
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "graph"
|
||||
|
||||
+73
-121
@@ -7237,13 +7237,6 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Memory)
|
||||
{
|
||||
DF_MemoryViewState *mv = df_view_user_state(view, DF_MemoryViewState);
|
||||
if(mv->initialized == 0)
|
||||
{
|
||||
mv->initialized = 1;
|
||||
mv->num_columns = 16;
|
||||
mv->bytes_per_cell = 1;
|
||||
mv->last_viewed_memory_cache_arena = df_view_push_arena_ext(view);
|
||||
}
|
||||
}
|
||||
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Memory)
|
||||
@@ -7275,20 +7268,13 @@ DF_VIEW_CMD_FUNCTION_DEF(Memory)
|
||||
// with this view.
|
||||
if(df_view_from_handle(params->view) == view)
|
||||
{
|
||||
mv->cursor = mv->mark = params->vaddr;
|
||||
mv->center_cursor = 1;
|
||||
// TODO(rjf)
|
||||
}
|
||||
}break;
|
||||
case DF_CoreCmdKind_SetColumns:
|
||||
if(df_view_from_handle(params->view) == view)
|
||||
{
|
||||
U64 num_columns = params->index;
|
||||
mv->num_columns = Clamp(1, num_columns, 64);
|
||||
if(mv->num_columns % mv->bytes_per_cell != 0)
|
||||
{
|
||||
mv->bytes_per_cell = 1;
|
||||
}
|
||||
mv->center_cursor = 1;
|
||||
// TODO(rjf)
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -7299,17 +7285,27 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack state
|
||||
//
|
||||
DF_MemoryViewState *mv = df_view_user_state(view, DF_MemoryViewState);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack entity params
|
||||
//- rjf: unpack parameterization info
|
||||
//
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
E_Eval eval = e_eval_from_string(scratch.arena, string);
|
||||
if(u128_match(eval.space, u128_zero()))
|
||||
{
|
||||
eval.space = df_eval_space_from_entity(df_entity_from_handle(df_interact_regs()->process));
|
||||
}
|
||||
Rng1U64 space_range = df_whole_range_from_eval_space(eval.space);
|
||||
U64 cursor = df_value_from_params_key(params, str8_lit("cursor_vaddr")).u64;
|
||||
U64 mark = df_value_from_params_key(params, str8_lit("mark_vaddr")).u64;
|
||||
U64 bytes_per_cell = df_value_from_params_key(params, str8_lit("bytes_per_cell")).u64;
|
||||
U64 num_columns = df_value_from_params_key(params, str8_lit("num_columns")).u64;
|
||||
if(num_columns == 0)
|
||||
{
|
||||
num_columns = 16;
|
||||
}
|
||||
num_columns = ClampBot(1, num_columns);
|
||||
bytes_per_cell = ClampBot(1, bytes_per_cell);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack visual params
|
||||
@@ -7318,7 +7314,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
F32 font_size = df_font_size_from_slot(ws, DF_FontSlot_Code);
|
||||
F32 big_glyph_advance = f_dim_from_tag_size_string(font, font_size, 0, 0, str8_lit("H")).x;
|
||||
F32 row_height_px = floor_f32(font_size*2.f);
|
||||
F32 cell_width_px = floor_f32(font_size*2.f * mv->bytes_per_cell);
|
||||
F32 cell_width_px = floor_f32(font_size*2.f * bytes_per_cell);
|
||||
F32 scroll_bar_dim = floor_f32(ui_top_font_size()*1.5f);
|
||||
Vec2F32 panel_dim = dim_2f32(rect);
|
||||
F32 footer_dim = font_size*10.f;
|
||||
@@ -7329,7 +7325,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
//////////////////////////////
|
||||
//- rjf: determine legal scroll range
|
||||
//
|
||||
Rng1S64 scroll_idx_rng = r1s64(0, 0x7FFFFFFFFFFFull/mv->num_columns);
|
||||
Rng1S64 scroll_idx_rng = r1s64(0, space_range.max/num_columns);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: determine info about visible range of rows
|
||||
@@ -7343,8 +7339,8 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
viz_range_rows.max = view->scroll_pos.y.idx + (S64)view->scroll_pos.y.off + num_possible_visible_rows,
|
||||
viz_range_rows.min = clamp_1s64(scroll_idx_rng, viz_range_rows.min);
|
||||
viz_range_rows.max = clamp_1s64(scroll_idx_rng, viz_range_rows.max);
|
||||
viz_range_bytes.min = viz_range_rows.min*mv->num_columns;
|
||||
viz_range_bytes.max = (viz_range_rows.max+1)*mv->num_columns+1;
|
||||
viz_range_bytes.min = viz_range_rows.min*num_columns;
|
||||
viz_range_bytes.max = (viz_range_rows.max+1)*num_columns+1;
|
||||
if(viz_range_bytes.min > viz_range_bytes.max)
|
||||
{
|
||||
Swap(U64, viz_range_bytes.min, viz_range_bytes.max);
|
||||
@@ -7356,8 +7352,8 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
//
|
||||
UI_Focus(UI_FocusKind_On) if(ui_is_focus_active())
|
||||
{
|
||||
U64 next_cursor = mv->cursor;
|
||||
U64 next_mark = mv->mark;
|
||||
U64 next_cursor = cursor;
|
||||
U64 next_mark = mark;
|
||||
for(UI_Event *evt = 0; ui_next_event(&evt);)
|
||||
{
|
||||
Vec2S64 cell_delta = {0};
|
||||
@@ -7374,11 +7370,11 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
{
|
||||
if(evt->delta_2s32.x < 0)
|
||||
{
|
||||
cell_delta.x = -(S64)(mv->cursor%mv->num_columns);
|
||||
cell_delta.x = -(S64)(cursor%num_columns);
|
||||
}
|
||||
else if(evt->delta_2s32.x > 0)
|
||||
{
|
||||
cell_delta.x = (mv->num_columns-1) - (S64)(mv->cursor%mv->num_columns);
|
||||
cell_delta.x = (num_columns-1) - (S64)(cursor%num_columns);
|
||||
}
|
||||
if(evt->delta_2s32.y < 0)
|
||||
{
|
||||
@@ -7395,27 +7391,27 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
{
|
||||
good_action = 1;
|
||||
}
|
||||
if(good_action && evt->flags & UI_EventFlag_ZeroDeltaOnSelect && mv->cursor != mv->mark)
|
||||
if(good_action && evt->flags & UI_EventFlag_ZeroDeltaOnSelect && cursor != mark)
|
||||
{
|
||||
MemoryZeroStruct(&cell_delta);
|
||||
}
|
||||
if(good_action)
|
||||
{
|
||||
cell_delta.x = ClampBot(cell_delta.x, (S64)-next_cursor);
|
||||
cell_delta.y = ClampBot(cell_delta.y, (S64)-(next_cursor/mv->num_columns));
|
||||
cell_delta.y = ClampBot(cell_delta.y, (S64)-(next_cursor/num_columns));
|
||||
next_cursor += cell_delta.x;
|
||||
next_cursor += cell_delta.y*mv->num_columns;
|
||||
next_cursor += cell_delta.y*num_columns;
|
||||
next_cursor = ClampTop(0x7FFFFFFFFFFFull, next_cursor);
|
||||
}
|
||||
if(good_action && evt->flags & UI_EventFlag_PickSelectSide && mv->cursor != mv->mark)
|
||||
if(good_action && evt->flags & UI_EventFlag_PickSelectSide && cursor != mark)
|
||||
{
|
||||
if(evt->delta_2s32.x < 0 || evt->delta_2s32.y < 0)
|
||||
{
|
||||
next_cursor = Min(mv->cursor, mv->mark);
|
||||
next_cursor = Min(cursor, mark);
|
||||
}
|
||||
else
|
||||
{
|
||||
next_cursor = Max(mv->cursor, mv->mark);
|
||||
next_cursor = Max(cursor, mark);
|
||||
}
|
||||
}
|
||||
if(good_action && !(evt->flags & UI_EventFlag_KeepMark))
|
||||
@@ -7428,17 +7424,17 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
ui_eat_event(evt);
|
||||
}
|
||||
}
|
||||
mv->cursor = next_cursor;
|
||||
mv->mark = next_mark;
|
||||
cursor = next_cursor;
|
||||
mark = next_mark;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: clamp cursor
|
||||
//
|
||||
{
|
||||
Rng1U64 cursor_valid_rng = r1u64(0, 0x7FFFFFFFFFFFull);
|
||||
mv->cursor = clamp_1u64(cursor_valid_rng, mv->cursor);
|
||||
mv->mark = clamp_1u64(cursor_valid_rng, mv->mark);
|
||||
Rng1U64 cursor_valid_rng = space_range;
|
||||
cursor = clamp_1u64(cursor_valid_rng, cursor);
|
||||
mark = clamp_1u64(cursor_valid_rng, mark);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -7447,7 +7443,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
if(mv->center_cursor)
|
||||
{
|
||||
mv->center_cursor = 0;
|
||||
S64 cursor_row_idx = mv->cursor/mv->num_columns;
|
||||
S64 cursor_row_idx = cursor/num_columns;
|
||||
S64 new_idx = (cursor_row_idx-num_possible_visible_rows/2+1);
|
||||
new_idx = clamp_1s64(scroll_idx_rng, new_idx);
|
||||
ui_scroll_pt_target_idx(&view->scroll_pos.y, new_idx);
|
||||
@@ -7459,7 +7455,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
if(mv->contain_cursor)
|
||||
{
|
||||
mv->contain_cursor = 0;
|
||||
S64 cursor_row_idx = mv->cursor/mv->num_columns;
|
||||
S64 cursor_row_idx = cursor/num_columns;
|
||||
Rng1S64 cursor_viz_range = r1s64(clamp_1s64(scroll_idx_rng, cursor_row_idx-2), clamp_1s64(scroll_idx_rng, cursor_row_idx+3));
|
||||
S64 min_delta = Min(0, cursor_viz_range.min-viz_range_rows.min);
|
||||
S64 max_delta = Max(0, cursor_viz_range.max-viz_range_rows.max);
|
||||
@@ -7493,63 +7489,9 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
//- rjf: grab windowed memory
|
||||
//
|
||||
U64 visible_memory_size = dim_1u64(viz_range_bytes);
|
||||
U8 *visible_memory = 0;
|
||||
U8 *visible_memory = push_array(scratch.arena, U8, visible_memory_size);
|
||||
{
|
||||
Rng1U64 chunk_aligned_range_bytes = r1u64(AlignDownPow2(viz_range_bytes.min, KB(4)), AlignPow2(viz_range_bytes.max, KB(4)));
|
||||
U64 current_memgen_idx = ctrl_mem_gen();
|
||||
B32 range_changed = (chunk_aligned_range_bytes.min != mv->last_viewed_memory_cache_range.min ||
|
||||
chunk_aligned_range_bytes.max != mv->last_viewed_memory_cache_range.max);
|
||||
B32 mem_changed = (current_memgen_idx != mv->last_viewed_memory_cache_memgen_idx);
|
||||
if(range_changed || mem_changed)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
// rjf: try to read new memory for this range
|
||||
U64 bytes_to_read = dim_1u64(chunk_aligned_range_bytes);
|
||||
U8 *buffer = push_array_no_zero(scratch.arena, U8, bytes_to_read);
|
||||
U64 half1_bytes_read = dmn_process_read(process->ctrl_handle, r1u64(chunk_aligned_range_bytes.min, chunk_aligned_range_bytes.min+bytes_to_read/2), buffer+0);
|
||||
U64 half2_bytes_read = dmn_process_read(process->ctrl_handle, r1u64(chunk_aligned_range_bytes.min+bytes_to_read/2, chunk_aligned_range_bytes.max), buffer+bytes_to_read/2);
|
||||
|
||||
// rjf: worked? -> clear cache & store
|
||||
if(half1_bytes_read+half2_bytes_read >= bytes_to_read)
|
||||
{
|
||||
arena_clear(mv->last_viewed_memory_cache_arena);
|
||||
mv->last_viewed_memory_cache_buffer = push_array_no_zero(mv->last_viewed_memory_cache_arena, U8, bytes_to_read);
|
||||
MemoryCopy(mv->last_viewed_memory_cache_buffer, buffer, bytes_to_read);
|
||||
}
|
||||
|
||||
// rjf: didn't work, but range didn't change? -> no-op
|
||||
if(half1_bytes_read == 0 && half2_bytes_read == 0 && !range_changed)
|
||||
{
|
||||
// NOTE(rjf): nothing - use stale memory from cache.
|
||||
}
|
||||
|
||||
// rjf: didn't work, but range DID change? -> clear cache
|
||||
if(half1_bytes_read == 0 && half2_bytes_read == 0 && range_changed)
|
||||
{
|
||||
arena_clear(mv->last_viewed_memory_cache_arena);
|
||||
mv->last_viewed_memory_cache_buffer = push_array(mv->last_viewed_memory_cache_arena, U8, bytes_to_read);
|
||||
}
|
||||
|
||||
// rjf: didn't fully work, but changed? -> clear cache memory, fill what we can, zero the rest.
|
||||
if(half1_bytes_read+half2_bytes_read < bytes_to_read && half1_bytes_read+half2_bytes_read != 0)
|
||||
{
|
||||
arena_clear(mv->last_viewed_memory_cache_arena);
|
||||
mv->last_viewed_memory_cache_buffer = push_array(mv->last_viewed_memory_cache_arena, U8, bytes_to_read);
|
||||
MemoryCopy(mv->last_viewed_memory_cache_buffer+0, buffer+0, half1_bytes_read);
|
||||
MemoryCopy(mv->last_viewed_memory_cache_buffer+bytes_to_read/2, buffer+bytes_to_read/2, half2_bytes_read);
|
||||
}
|
||||
|
||||
// rjf: update cache stamps
|
||||
if(!df_ctrl_targets_running())
|
||||
{
|
||||
mv->last_viewed_memory_cache_range = chunk_aligned_range_bytes;
|
||||
mv->last_viewed_memory_cache_memgen_idx = current_memgen_idx;
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
}
|
||||
visible_memory = mv->last_viewed_memory_cache_buffer + viz_range_bytes.min-chunk_aligned_range_bytes.min;
|
||||
e_space_read(eval.space, visible_memory, viz_range_bytes);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -7573,6 +7515,8 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
};
|
||||
AnnotationList *visible_memory_annotations = push_array(scratch.arena, AnnotationList, visible_memory_size);
|
||||
{
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
CTRL_Unwind unwind = df_query_cached_unwind_from_thread(thread);
|
||||
|
||||
//- rjf: fill unwind frame annotations
|
||||
@@ -7704,8 +7648,8 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
UI_PrefWidth(ui_px(cell_width_px, 1.f))
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
{
|
||||
Rng1U64 col_selection_rng = r1u64(mv->cursor%mv->num_columns, mv->mark%mv->num_columns);
|
||||
for(U64 row_off = 0; row_off < mv->num_columns*mv->bytes_per_cell; row_off += mv->bytes_per_cell)
|
||||
Rng1U64 col_selection_rng = r1u64(cursor%num_columns, mark%num_columns);
|
||||
for(U64 row_off = 0; row_off < num_columns*bytes_per_cell; row_off += bytes_per_cell)
|
||||
{
|
||||
if(!(col_selection_rng.min <= row_off && row_off <= col_selection_rng.max))
|
||||
{
|
||||
@@ -7790,18 +7734,18 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
if(mouse_hover_byte_num == 0)
|
||||
{
|
||||
U64 col_idx = ClampBot(mouse_rel.x-big_glyph_advance*18.f, 0)/cell_width_px;
|
||||
if(col_idx < mv->num_columns)
|
||||
if(col_idx < num_columns)
|
||||
{
|
||||
mouse_hover_byte_num = viz_range_bytes.min + row_idx*mv->num_columns + col_idx + 1;
|
||||
mouse_hover_byte_num = viz_range_bytes.min + row_idx*num_columns + col_idx + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: try from ascii
|
||||
if(mouse_hover_byte_num == 0)
|
||||
{
|
||||
U64 col_idx = ClampBot(mouse_rel.x - (big_glyph_advance*18.f + cell_width_px*mv->num_columns + big_glyph_advance*1.5f), 0)/big_glyph_advance;
|
||||
col_idx = ClampTop(col_idx, mv->num_columns-1);
|
||||
mouse_hover_byte_num = viz_range_bytes.min + row_idx*mv->num_columns + col_idx + 1;
|
||||
U64 col_idx = ClampBot(mouse_rel.x - (big_glyph_advance*18.f + cell_width_px*num_columns + big_glyph_advance*1.5f), 0)/big_glyph_advance;
|
||||
col_idx = ClampTop(col_idx, num_columns-1);
|
||||
mouse_hover_byte_num = viz_range_bytes.min + row_idx*num_columns + col_idx + 1;
|
||||
}
|
||||
|
||||
mouse_hover_byte_num = Clamp(1, mouse_hover_byte_num, 0x7FFFFFFFFFFFull+1);
|
||||
@@ -7821,10 +7765,10 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
{
|
||||
mv->contain_cursor = 1;
|
||||
}
|
||||
mv->cursor = mouse_hover_byte_num-1;
|
||||
cursor = mouse_hover_byte_num-1;
|
||||
if(ui_pressed(sig))
|
||||
{
|
||||
mv->mark = mv->cursor;
|
||||
mark = cursor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7856,12 +7800,12 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
//
|
||||
UI_Parent(row_container_box) DF_Font(ws, DF_FontSlot_Code) UI_FontSize(font_size)
|
||||
{
|
||||
Rng1U64 selection = r1u64(mv->cursor, mv->mark);
|
||||
U8 *row_ascii_buffer = push_array(scratch.arena, U8, mv->num_columns);
|
||||
Rng1U64 selection = r1u64(cursor, mark);
|
||||
U8 *row_ascii_buffer = push_array(scratch.arena, U8, num_columns);
|
||||
UI_WidthFill UI_PrefHeight(ui_px(row_height_px, 1.f))
|
||||
for(S64 row_idx = viz_range_rows.min; row_idx <= viz_range_rows.max; row_idx += 1)
|
||||
{
|
||||
Rng1U64 row_range_bytes = r1u64(row_idx*mv->num_columns, (row_idx+1)*mv->num_columns);
|
||||
Rng1U64 row_range_bytes = r1u64(row_idx*num_columns, (row_idx+1)*num_columns);
|
||||
B32 row_is_boundary = 0;
|
||||
Vec4F32 row_boundary_color = {0};
|
||||
if(row_range_bytes.min%64 == 0)
|
||||
@@ -7884,9 +7828,9 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_CornerRadius(0)
|
||||
{
|
||||
for(U64 col_idx = 0; col_idx < mv->num_columns; col_idx += 1)
|
||||
for(U64 col_idx = 0; col_idx < num_columns; col_idx += 1)
|
||||
{
|
||||
U64 visible_byte_idx = (row_idx-viz_range_rows.min)*mv->num_columns + col_idx;
|
||||
U64 visible_byte_idx = (row_idx-viz_range_rows.min)*num_columns + col_idx;
|
||||
U64 global_byte_idx = viz_range_bytes.min+visible_byte_idx;
|
||||
U64 global_byte_num = global_byte_idx+1;
|
||||
U8 byte_value = visible_memory[visible_byte_idx];
|
||||
@@ -7965,17 +7909,17 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
ui_spacer(ui_px(big_glyph_advance*1.5f, 1.f));
|
||||
UI_WidthFill
|
||||
{
|
||||
MemoryZero(row_ascii_buffer, mv->num_columns);
|
||||
for(U64 col_idx = 0; col_idx < mv->num_columns; col_idx += 1)
|
||||
MemoryZero(row_ascii_buffer, num_columns);
|
||||
for(U64 col_idx = 0; col_idx < num_columns; col_idx += 1)
|
||||
{
|
||||
U8 byte_value = visible_memory[(row_idx-viz_range_rows.min)*mv->num_columns + col_idx];
|
||||
U8 byte_value = visible_memory[(row_idx-viz_range_rows.min)*num_columns + col_idx];
|
||||
row_ascii_buffer[col_idx] = byte_value;
|
||||
if(byte_value <= 32 || 127 < byte_value)
|
||||
{
|
||||
row_ascii_buffer[col_idx] = '.';
|
||||
}
|
||||
}
|
||||
String8 ascii_text = str8(row_ascii_buffer, mv->num_columns);
|
||||
String8 ascii_text = str8(row_ascii_buffer, num_columns);
|
||||
UI_Box *ascii_box = ui_build_box_from_stringf(UI_BoxFlag_DrawText, "%S###ascii_row_%I64x", ascii_text, row_range_bytes.min);
|
||||
if(selection.max >= row_range_bytes.min && selection.min < row_range_bytes.max)
|
||||
{
|
||||
@@ -8039,15 +7983,15 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
UI_PrefWidth(ui_em(45.f, 1.f)) UI_HeightFill UI_Column
|
||||
UI_PrefHeight(ui_px(row_height_px, 0.f))
|
||||
{
|
||||
B32 cursor_in_range = (viz_range_bytes.min <= mv->cursor && mv->cursor+8 <= viz_range_bytes.max);
|
||||
ui_labelf("%016I64X", mv->cursor);
|
||||
B32 cursor_in_range = (viz_range_bytes.min <= cursor && cursor+8 <= viz_range_bytes.max);
|
||||
ui_labelf("%016I64X", cursor);
|
||||
if(cursor_in_range)
|
||||
{
|
||||
U64 as_u8 = 0;
|
||||
U64 as_u16 = 0;
|
||||
U64 as_u32 = 0;
|
||||
U64 as_u64 = 0;
|
||||
U64 cursor_off = mv->cursor-viz_range_bytes.min;
|
||||
U64 cursor_off = cursor-viz_range_bytes.min;
|
||||
as_u8 = (U64)*(U8 *)(visible_memory + cursor_off);
|
||||
as_u16 = (U64)*(U16*)(visible_memory + cursor_off);
|
||||
as_u32 = (U64)*(U32*)(visible_memory + cursor_off);
|
||||
@@ -8074,6 +8018,14 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: save parameters
|
||||
//
|
||||
df_view_store_param_u64(view, str8_lit("cursor_vaddr"), cursor);
|
||||
df_view_store_param_u64(view, str8_lit("mark_vaddr"), mark);
|
||||
df_view_store_param_u64(view, str8_lit("bytes_per_cell"), bytes_per_cell);
|
||||
df_view_store_param_u64(view, str8_lit("num_columns"), num_columns);
|
||||
|
||||
hs_scope_close(hs_scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
|
||||
@@ -432,23 +432,6 @@ struct DF_DisasmViewState
|
||||
typedef struct DF_MemoryViewState DF_MemoryViewState;
|
||||
struct DF_MemoryViewState
|
||||
{
|
||||
B32 initialized;
|
||||
|
||||
// rjf: last-viewed-memory cache
|
||||
Arena *last_viewed_memory_cache_arena;
|
||||
U8 *last_viewed_memory_cache_buffer;
|
||||
Rng1U64 last_viewed_memory_cache_range;
|
||||
U64 last_viewed_memory_cache_memgen_idx;
|
||||
|
||||
// rjf: control state
|
||||
U64 cursor;
|
||||
U64 mark;
|
||||
|
||||
// rjf: organization state
|
||||
U64 num_columns;
|
||||
U64 bytes_per_cell;
|
||||
|
||||
// rjf: command pass-through data
|
||||
B32 center_cursor;
|
||||
B32 contain_cursor;
|
||||
};
|
||||
|
||||
@@ -209,7 +209,7 @@ str8_lit_comp("goto_name"),
|
||||
str8_lit_comp("add_function_breakpoint"),
|
||||
};
|
||||
|
||||
DF_GfxViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[15] =
|
||||
DF_GfxViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[16] =
|
||||
{
|
||||
{ str8_lit_comp("array"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*0), 0, 0, 0, str8_lit_comp("") },
|
||||
{ str8_lit_comp("list"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*1)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*0), DF_GFX_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_NAME(list) , 0, 0, str8_lit_comp("") },
|
||||
@@ -224,6 +224,7 @@ DF_GfxViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[15] =
|
||||
{ str8_lit_comp("rgba"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*1)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(rgba) , str8_lit_comp("") },
|
||||
{ str8_lit_comp("text"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("code") },
|
||||
{ str8_lit_comp("disasm"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("disassembly") },
|
||||
{ str8_lit_comp("memory"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("memory") },
|
||||
{ str8_lit_comp("bitmap"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("bitmap") },
|
||||
{ str8_lit_comp("geo"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*1)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(geo) , str8_lit_comp("geometry") },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user