mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-02 20:18:12 +00:00
first pass at converting frontend over to using new eval system
This commit is contained in:
+327
-710
File diff suppressed because it is too large
Load Diff
+30
-69
@@ -68,17 +68,6 @@ struct DF_ExpandTreeTable
|
||||
DF_ExpandNode *free_node;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Control Context Types
|
||||
|
||||
typedef struct DF_CtrlCtx DF_CtrlCtx;
|
||||
struct DF_CtrlCtx
|
||||
{
|
||||
DF_Handle thread;
|
||||
U64 unwind_count;
|
||||
U64 inline_depth;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity Kind Flags
|
||||
|
||||
@@ -177,26 +166,6 @@ struct DF_CtrlFlowInfo
|
||||
U64 total_size;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Types
|
||||
|
||||
typedef struct DF_Eval DF_Eval;
|
||||
struct DF_Eval
|
||||
{
|
||||
TG_Key type_key;
|
||||
EVAL_EvalMode mode;
|
||||
U64 offset;
|
||||
union
|
||||
{
|
||||
S64 imm_s64;
|
||||
U64 imm_u64;
|
||||
F32 imm_f32;
|
||||
F64 imm_f64;
|
||||
U64 imm_u128[2];
|
||||
};
|
||||
EVAL_ErrorList errors;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: View Rule Hook Types
|
||||
|
||||
@@ -205,10 +174,10 @@ typedef struct DF_CfgVal DF_CfgVal;
|
||||
typedef struct DF_CfgTable DF_CfgTable;
|
||||
typedef struct DF_EvalView DF_EvalView;
|
||||
typedef struct DF_EvalVizBlockList DF_EvalVizBlockList;
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) DF_Eval name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, DF_CfgVal *val)
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) E_Eval name(Arena *arena, E_Eval eval, DF_CfgVal *val)
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name) df_core_view_rule_eval_resolution__##name
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name))
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, DF_Eval eval, String8 string, DF_CfgTable *cfg_table, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth, DF_CfgNode *cfg, struct DF_EvalVizBlockList *out)
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, DF_EvalView *eval_view, E_Eval eval, String8 string, DF_CfgTable *cfg_table, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth, DF_CfgNode *cfg, struct DF_EvalVizBlockList *out)
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name) df_core_view_rule_viz_block_prod__##name
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name))
|
||||
typedef DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CoreViewRuleEvalResolutionHookFunctionType);
|
||||
@@ -682,7 +651,7 @@ struct DF_EvalViewCache
|
||||
typedef struct DF_EvalLinkBase DF_EvalLinkBase;
|
||||
struct DF_EvalLinkBase
|
||||
{
|
||||
EVAL_EvalMode mode;
|
||||
E_Mode mode;
|
||||
U64 offset;
|
||||
};
|
||||
|
||||
@@ -733,19 +702,19 @@ struct DF_EvalVizBlock
|
||||
S32 depth;
|
||||
|
||||
// rjf: evaluation info
|
||||
DF_Eval eval;
|
||||
E_Eval eval;
|
||||
String8 string;
|
||||
TG_Member *member;
|
||||
E_Member *member;
|
||||
|
||||
// rjf: info about ranges that this block spans
|
||||
Rng1U64 visual_idx_range;
|
||||
Rng1U64 semantic_idx_range;
|
||||
FZY_Target fzy_target;
|
||||
RDI_SectionKind fzy_target;
|
||||
FZY_ItemArray fzy_backing_items;
|
||||
|
||||
// rjf: visualization config extensions
|
||||
DF_CfgTable cfg_table;
|
||||
TG_Key link_member_type_key;
|
||||
E_TypeKey link_member_type_key;
|
||||
U64 link_member_off;
|
||||
};
|
||||
|
||||
@@ -804,14 +773,14 @@ struct DF_EvalVizRow
|
||||
DF_ExpandKey key;
|
||||
|
||||
// rjf: evaluation artifacts
|
||||
DF_Eval eval;
|
||||
E_Eval eval;
|
||||
|
||||
// rjf: basic visualization contents
|
||||
String8 display_expr;
|
||||
String8 edit_expr;
|
||||
String8 display_value;
|
||||
String8 edit_value;
|
||||
TG_KeyList inherited_type_key_chain;
|
||||
E_TypeKeyList inherited_type_key_chain;
|
||||
|
||||
// rjf: variable-size & hook info
|
||||
U64 size_in_rows;
|
||||
@@ -1042,7 +1011,7 @@ struct DF_RunLocalsCacheNode
|
||||
DF_RunLocalsCacheNode *hash_next;
|
||||
DI_Key dbgi_key;
|
||||
U64 voff;
|
||||
EVAL_String2NumMap *locals_map;
|
||||
E_String2NumMap *locals_map;
|
||||
};
|
||||
|
||||
typedef struct DF_RunLocalsCacheSlot DF_RunLocalsCacheSlot;
|
||||
@@ -1154,8 +1123,11 @@ struct DF_State
|
||||
F32 dt;
|
||||
F32 seconds_til_autosave;
|
||||
|
||||
// rjf: interaction registers
|
||||
// rjf: frame info
|
||||
Arena *frame_arenas[2];
|
||||
DI_Scope *frame_di_scope;
|
||||
|
||||
// rjf: interaction registers
|
||||
DF_InteractRegsNode base_interact_regs;
|
||||
DF_InteractRegsNode *top_interact_regs;
|
||||
|
||||
@@ -1218,9 +1190,6 @@ struct DF_State
|
||||
DF_HandleList frozen_threads;
|
||||
DF_HandleNode *free_handle_node;
|
||||
|
||||
// rjf: main control context
|
||||
DF_CtrlCtx ctrl_ctx;
|
||||
|
||||
// rjf: control thread user -> ctrl driving state
|
||||
Arena *ctrl_last_run_arena;
|
||||
DF_RunKind ctrl_last_run_kind;
|
||||
@@ -1401,7 +1370,7 @@ internal String8 df_cmd_arg_part_from_string(String8 string);
|
||||
internal DF_CmdParams df_cmd_params_zero(void);
|
||||
internal void df_cmd_params_mark_slot(DF_CmdParams *params, DF_CmdParamSlot slot);
|
||||
internal B32 df_cmd_params_has_slot(DF_CmdParams *params, DF_CmdParamSlot slot);
|
||||
internal String8 df_cmd_params_apply_spec_query(Arena *arena, DF_CtrlCtx *ctrl_ctx, DF_CmdParams *params, DF_CmdSpec *spec, String8 query);
|
||||
internal String8 df_cmd_params_apply_spec_query(Arena *arena, DF_CmdParams *params, DF_CmdSpec *spec, String8 query);
|
||||
|
||||
//- rjf: command lists
|
||||
internal void df_cmd_list_push(Arena *arena, DF_CmdList *cmds, DF_CmdParams *params, DF_CmdSpec *spec);
|
||||
@@ -1581,8 +1550,8 @@ internal DF_Entity *df_module_from_process_vaddr(DF_Entity *process, U64 vaddr);
|
||||
internal DF_Entity *df_module_from_thread(DF_Entity *thread);
|
||||
internal U64 df_tls_base_vaddr_from_process_root_rip(DF_Entity *process, U64 root_vaddr, U64 rip_vaddr);
|
||||
internal Architecture df_architecture_from_entity(DF_Entity *entity);
|
||||
internal EVAL_String2NumMap *df_push_locals_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
|
||||
internal EVAL_String2NumMap *df_push_member_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
|
||||
internal E_String2NumMap *df_push_locals_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
|
||||
internal E_String2NumMap *df_push_member_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
|
||||
internal B32 df_set_thread_rip(DF_Entity *thread, U64 vaddr);
|
||||
internal DF_Entity *df_module_from_thread_candidates(DF_Entity *thread, DF_EntityList *candidates);
|
||||
internal DF_Unwind df_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, DF_Entity *process, CTRL_Unwind *base_unwind);
|
||||
@@ -1600,15 +1569,10 @@ internal void df_ctrl_run(DF_RunKind run, DF_Entity *run_thread, CTRL_RunFlags f
|
||||
internal CTRL_Event df_ctrl_last_stop_event(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation
|
||||
//~ rjf: Evaluation Context
|
||||
|
||||
internal B32 df_eval_memory_read(void *u, void *out, U64 addr, U64 size);
|
||||
internal EVAL_ParseCtx df_eval_parse_ctx_from_process_vaddr(DI_Scope *scope, DF_Entity *process, U64 vaddr);
|
||||
internal EVAL_ParseCtx df_eval_parse_ctx_from_src_loc(DI_Scope *scope, DF_Entity *file, TxtPt pt);
|
||||
internal DF_Eval df_eval_from_string(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, String8 string);
|
||||
internal DF_Eval df_value_mode_eval_from_eval(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, DF_Eval eval);
|
||||
internal DF_Eval df_dynamically_typed_eval_from_eval(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, DF_Eval eval);
|
||||
internal DF_Eval df_eval_from_eval_cfg_table(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, DF_CfgTable *cfg);
|
||||
internal B32 df_eval_memory_read(void *u, void *out, Rng1U64 vaddr_range);
|
||||
internal E_Eval df_eval_from_eval_cfg_table(Arena *arena, E_Eval eval, DF_CfgTable *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Views
|
||||
@@ -1631,14 +1595,14 @@ internal String8 df_eval_view_rule_from_key(DF_EvalView *eval_view, DF_ExpandKey
|
||||
|
||||
//- rjf: evaluation value string builder helpers
|
||||
internal String8 df_string_from_ascii_value(Arena *arena, U8 val);
|
||||
internal String8 df_string_from_simple_typed_eval(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, DF_EvalVizStringFlags flags, U32 radix, DF_Eval eval);
|
||||
internal String8 df_string_from_simple_typed_eval(Arena *arena, DF_EvalVizStringFlags flags, U32 radix, E_Eval eval);
|
||||
|
||||
//- rjf: writing values back to child processes
|
||||
internal B32 df_commit_eval_value(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, DF_Eval dst_eval, DF_Eval src_eval);
|
||||
internal B32 df_commit_eval_value(E_Eval dst_eval, E_Eval src_eval);
|
||||
|
||||
//- rjf: type helpers
|
||||
internal TG_MemberArray df_filtered_data_members_from_members_cfg_table(Arena *arena, TG_MemberArray members, DF_CfgTable *cfg);
|
||||
internal DF_EvalLinkBaseChunkList df_eval_link_base_chunk_list_from_eval(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, TG_Key link_member_type_key, U64 link_member_off, DF_CtrlCtx *ctrl_ctx, DF_Eval eval, U64 cap);
|
||||
internal E_MemberArray df_filtered_data_members_from_members_cfg_table(Arena *arena, E_MemberArray members, DF_CfgTable *cfg);
|
||||
internal DF_EvalLinkBaseChunkList df_eval_link_base_chunk_list_from_eval(Arena *arena, E_TypeKey link_member_type_key, U64 link_member_off, E_Eval eval, U64 cap);
|
||||
internal DF_EvalLinkBase df_eval_link_base_from_chunk_list_index(DF_EvalLinkBaseChunkList *list, U64 idx);
|
||||
internal DF_EvalLinkBaseArray df_eval_link_base_array_from_chunk_list(Arena *arena, DF_EvalLinkBaseChunkList *chunks);
|
||||
|
||||
@@ -1646,8 +1610,8 @@ internal DF_EvalLinkBaseArray df_eval_link_base_array_from_chunk_list(Arena *are
|
||||
internal DF_EvalVizBlock *df_eval_viz_block_begin(Arena *arena, DF_EvalVizBlockKind kind, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth);
|
||||
internal DF_EvalVizBlock *df_eval_viz_block_split_and_continue(Arena *arena, DF_EvalVizBlockList *list, DF_EvalVizBlock *split_block, U64 split_idx);
|
||||
internal void df_eval_viz_block_end(DF_EvalVizBlockList *list, DF_EvalVizBlock *block);
|
||||
internal void df_append_viz_blocks_for_parent__rec(Arena *arena, DI_Scope *scope, DF_EvalView *view, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_ExpandKey parent_key, DF_ExpandKey key, String8 string, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table, S32 depth, DF_EvalVizBlockList *list_out);
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_eval_view_expr_keys(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, String8 expr, DF_ExpandKey parent_key, DF_ExpandKey key);
|
||||
internal void df_append_viz_blocks_for_parent__rec(Arena *arena, DI_Scope *scope, DF_EvalView *view, DF_ExpandKey parent_key, DF_ExpandKey key, String8 string, E_Eval eval, E_Member *opt_member, DF_CfgTable *cfg_table, S32 depth, DF_EvalVizBlockList *list_out);
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_eval_view_expr_keys(Arena *arena, DI_Scope *scope, DF_EvalView *eval_view, String8 expr, DF_ExpandKey parent_key, DF_ExpandKey key);
|
||||
internal void df_eval_viz_block_list_concat__in_place(DF_EvalVizBlockList *dst, DF_EvalVizBlockList *to_push);
|
||||
|
||||
//- rjf: viz block list <-> table coordinates
|
||||
@@ -1656,7 +1620,7 @@ internal DF_ExpandKey df_key_from_viz_block_list_row_num(DF_EvalVizBlockList *bl
|
||||
internal DF_ExpandKey df_parent_key_from_viz_block_list_row_num(DF_EvalVizBlockList *blocks, S64 row_num);
|
||||
|
||||
//- rjf: viz row list building
|
||||
internal DF_EvalVizRow *df_eval_viz_row_list_push_new(Arena *arena, EVAL_ParseCtx *parse_ctx, DF_EvalVizWindowedRowList *rows, DF_EvalVizBlock *block, DF_ExpandKey key, DF_Eval eval);
|
||||
internal DF_EvalVizRow *df_eval_viz_row_list_push_new(Arena *arena, DF_EvalVizWindowedRowList *rows, DF_EvalVizBlock *block, DF_ExpandKey key, E_Eval eval);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Main State Accessors/Mutators
|
||||
@@ -1669,6 +1633,7 @@ internal F64 df_time_in_seconds(void);
|
||||
|
||||
//- rjf: interaction registers
|
||||
internal DF_InteractRegs *df_interact_regs(void);
|
||||
internal DF_InteractRegs *df_base_interact_regs(void);
|
||||
internal DF_InteractRegs *df_push_interact_regs(void);
|
||||
internal DF_InteractRegs *df_pop_interact_regs(void);
|
||||
|
||||
@@ -1681,10 +1646,6 @@ internal U64 df_ctrl_last_run_frame_idx(void);
|
||||
internal U64 df_ctrl_run_gen(void);
|
||||
internal B32 df_ctrl_targets_running(void);
|
||||
|
||||
//- rjf: control context
|
||||
internal DF_CtrlCtx df_ctrl_ctx(void);
|
||||
internal void df_ctrl_ctx_apply_overrides(DF_CtrlCtx *ctx, DF_CtrlCtx *overrides);
|
||||
|
||||
//- rjf: config paths
|
||||
internal String8 df_cfg_path_from_src(DF_CfgSrc src);
|
||||
|
||||
@@ -1716,8 +1677,8 @@ internal CTRL_Unwind df_query_cached_unwind_from_thread(DF_Entity *thread);
|
||||
internal U64 df_query_cached_rip_from_thread(DF_Entity *thread);
|
||||
internal U64 df_query_cached_rip_from_thread_unwind(DF_Entity *thread, U64 unwind_count);
|
||||
internal U64 df_query_cached_tls_base_vaddr_from_process_root_rip(DF_Entity *process, U64 root_vaddr, U64 rip_vaddr);
|
||||
internal EVAL_String2NumMap *df_query_cached_locals_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
|
||||
internal EVAL_String2NumMap *df_query_cached_member_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
|
||||
internal E_String2NumMap *df_query_cached_locals_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
|
||||
internal E_String2NumMap *df_query_cached_member_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
|
||||
|
||||
//- rjf: top-level command dispatch
|
||||
internal void df_push_cmd__root(DF_CmdParams *params, DF_CmdSpec *spec);
|
||||
|
||||
@@ -144,8 +144,6 @@ DF_CoreCmdTable:// | | |
|
||||
|
||||
//- rjf: debug control context management operations
|
||||
{SelectThread 0 Entity Thread 0 0 0 0 0 1 Null "select_thread" "Select Thread" "Selects a thread." "" }
|
||||
{SelectThreadWindow 0 Entity Thread 0 0 0 0 0 1 Null "select_thread_window" "Select Thread On Window" "Selects a thread for the active window, overriding the global selected thread." "" }
|
||||
{SelectThreadView 0 Entity Thread 0 0 0 0 0 1 Null "select_thread_view" "Select Thread On View" "Selects a thread for the active view, overriding the global and per-window selected threads." "" }
|
||||
{SelectUnwind 1 Null Nil 0 0 0 0 0 0 Null "select_unwind" "Select Unwind" "Selects an unwind frame number for the selected thread." "" }
|
||||
{UpOneFrame 0 Null Nil 0 0 0 0 0 0 UpArrow "up_one_frame" "Up One Frame" "Selects the call stack frame above the currently selected." "" }
|
||||
{DownOneFrame 0 Null Nil 0 0 0 0 0 0 DownArrow "down_one_frame" "Down One Frame" "Selects the call stack frame below the currently selected." "callstack,unwind" }
|
||||
|
||||
@@ -209,7 +209,7 @@ DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind_Null,
|
||||
};
|
||||
|
||||
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
|
||||
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[219] =
|
||||
{
|
||||
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*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},
|
||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {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_X},
|
||||
@@ -239,8 +239,6 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
|
||||
{ str8_lit_comp("run_to_cursor"), str8_lit_comp("Runs the selected thread to the current cursor."), str8_lit_comp(""), str8_lit_comp("Run To Cursor"), (DF_CmdSpecFlag_OmitFromLists*0), {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_Play},
|
||||
{ str8_lit_comp("set_next_statement"), str8_lit_comp("Sets the selected thread's instruction pointer to the cursor's position."), str8_lit_comp(""), str8_lit_comp("Set Next Statement"), (DF_CmdSpecFlag_OmitFromLists*0), {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_RightArrow},
|
||||
{ str8_lit_comp("select_thread"), str8_lit_comp("Selects a thread."), str8_lit_comp(""), str8_lit_comp("Select Thread"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("select_thread_window"), str8_lit_comp("Selects a thread for the active window, overriding the global selected thread."), str8_lit_comp(""), str8_lit_comp("Select Thread On Window"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("select_thread_view"), str8_lit_comp("Selects a thread for the active view, overriding the global and per-window selected threads."), str8_lit_comp(""), str8_lit_comp("Select Thread On View"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("select_unwind"), str8_lit_comp("Selects an unwind frame number for the selected thread."), str8_lit_comp(""), str8_lit_comp("Select Unwind"), (DF_CmdSpecFlag_OmitFromLists*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},
|
||||
{ str8_lit_comp("up_one_frame"), str8_lit_comp("Selects the call stack frame above the currently selected."), str8_lit_comp(""), str8_lit_comp("Up One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {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_UpArrow},
|
||||
{ str8_lit_comp("down_one_frame"), str8_lit_comp("Selects the call stack frame below the currently selected."), str8_lit_comp("callstack,unwind"), str8_lit_comp("Down One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {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_DownArrow},
|
||||
|
||||
@@ -75,8 +75,6 @@ DF_CoreCmdKind_StepOver,
|
||||
DF_CoreCmdKind_RunToCursor,
|
||||
DF_CoreCmdKind_SetNextStatement,
|
||||
DF_CoreCmdKind_SelectThread,
|
||||
DF_CoreCmdKind_SelectThreadWindow,
|
||||
DF_CoreCmdKind_SelectThreadView,
|
||||
DF_CoreCmdKind_SelectUnwind,
|
||||
DF_CoreCmdKind_UpOneFrame,
|
||||
DF_CoreCmdKind_DownOneFrame,
|
||||
|
||||
+214
-255
File diff suppressed because it is too large
Load Diff
+9
-24
@@ -202,9 +202,6 @@ struct DF_View
|
||||
TxtPt cursor;
|
||||
TxtPt mark;
|
||||
|
||||
// rjf: ctrl context overrides
|
||||
DF_CtrlCtx ctrl_ctx_overrides;
|
||||
|
||||
// rjf: allocation & user data extensions
|
||||
Arena *arena;
|
||||
DF_ArenaExt *first_arena_ext;
|
||||
@@ -324,11 +321,11 @@ enum
|
||||
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name) df_gfx_view_rule_line_stringize__##name
|
||||
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(name) internal DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_SIG(DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name))
|
||||
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, DF_Eval eval, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg)
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, E_Eval eval, struct DF_CfgNode *cfg)
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name) df_gfx_view_rule_row_ui__##name
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name))
|
||||
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, DF_Eval eval, String8 string, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg, Vec2F32 dim)
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, E_Eval eval, String8 string, struct DF_CfgNode *cfg, Vec2F32 dim)
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME(name) df_gfx_view_rule_block_ui__##name
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME(name))
|
||||
|
||||
@@ -602,7 +599,6 @@ struct DF_Window
|
||||
B32 autocomp_force_closed;
|
||||
B32 autocomp_query_dirty;
|
||||
UI_Key autocomp_root_key;
|
||||
DF_CtrlCtx autocomp_ctrl_ctx;
|
||||
Arena *autocomp_lister_params_arena;
|
||||
DF_AutoCompListerParams autocomp_lister_params;
|
||||
U64 autocomp_cursor_off;
|
||||
@@ -636,7 +632,6 @@ struct DF_Window
|
||||
U64 hover_eval_last_frame_idx;
|
||||
|
||||
// rjf: hover eval params
|
||||
DF_CtrlCtx hover_eval_ctrl_ctx;
|
||||
DF_Handle hover_eval_file;
|
||||
TxtPt hover_eval_file_pt;
|
||||
U64 hover_eval_vaddr;
|
||||
@@ -648,9 +643,6 @@ struct DF_Window
|
||||
U64 error_string_size;
|
||||
F32 error_t;
|
||||
|
||||
// rjf: context overrides
|
||||
DF_CtrlCtx ctrl_ctx_overrides;
|
||||
|
||||
// rjf: panel state
|
||||
DF_Panel *root_panel;
|
||||
DF_Panel *free_panel;
|
||||
@@ -834,7 +826,6 @@ read_only global DF_View df_g_nil_view =
|
||||
{0},
|
||||
{0},
|
||||
{0},
|
||||
{0},
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -907,7 +898,7 @@ internal void df_panel_remove_tab_view(DF_Panel *panel, DF_View *view);
|
||||
internal DF_View *df_selected_tab_from_panel(DF_Panel *panel);
|
||||
|
||||
//- rjf: icons & display strings
|
||||
internal String8 df_display_string_from_view(Arena *arena, DF_CtrlCtx ctrl_ctx, DF_View *view);
|
||||
internal String8 df_display_string_from_view(Arena *arena, DF_View *view);
|
||||
internal DF_IconKind df_icon_kind_from_view(DF_View *view);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -916,12 +907,6 @@ internal DF_IconKind df_icon_kind_from_view(DF_View *view);
|
||||
internal DF_Handle df_handle_from_window(DF_Window *window);
|
||||
internal DF_Window *df_window_from_handle(DF_Handle handle);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Control Context
|
||||
|
||||
internal DF_CtrlCtx df_ctrl_ctx_from_window(DF_Window *ws);
|
||||
internal DF_CtrlCtx df_ctrl_ctx_from_view(DF_Window *ws, DF_View *view);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Command Parameters From Context
|
||||
|
||||
@@ -998,13 +983,13 @@ internal void df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdLis
|
||||
//~ rjf: Eval Viz
|
||||
|
||||
internal String8 df_eval_escaped_from_raw_string(Arena *arena, String8 raw);
|
||||
internal String8List df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags flags, TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, U32 default_radix, F_Tag font, F32 font_size, F32 max_size, S32 depth, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table);
|
||||
internal DF_EvalVizWindowedRowList df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks);
|
||||
internal String8List df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags flags, U32 default_radix, F_Tag font, F32 font_size, F32 max_size, S32 depth, E_Eval eval, E_Member *opt_member, DF_CfgTable *cfg_table);
|
||||
internal DF_EvalVizWindowedRowList df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hover Eval
|
||||
|
||||
internal void df_set_hover_eval(DF_Window *ws, Vec2F32 pos, DF_CtrlCtx ctrl_ctx, DF_Entity *file, TxtPt pt, U64 vaddr, String8 string);
|
||||
internal void df_set_hover_eval(DF_Window *ws, Vec2F32 pos, DF_Entity *file, TxtPt pt, U64 vaddr, String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Auto-Complete Lister
|
||||
@@ -1016,7 +1001,7 @@ internal void df_autocomp_lister_item_array_sort__in_place(DF_AutoCompListerItem
|
||||
|
||||
internal String8 df_autocomp_query_word_from_input_string_off(String8 input, U64 cursor_off);
|
||||
internal DF_AutoCompListerParams df_view_rule_autocomp_lister_params_from_input_cursor(Arena *arena, String8 string, U64 cursor_off);
|
||||
internal void df_set_autocomp_lister_query(DF_Window *ws, UI_Key root_key, DF_CtrlCtx ctrl_ctx, DF_AutoCompListerParams *params, String8 input, U64 cursor_off);
|
||||
internal void df_set_autocomp_lister_query(DF_Window *ws, UI_Key root_key, DF_AutoCompListerParams *params, String8 input, U64 cursor_off);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Search Strings
|
||||
@@ -1085,8 +1070,8 @@ internal void df_entity_src_loc_button(DF_Window *ws, DF_Entity *entity, TxtPt p
|
||||
|
||||
internal UI_BOX_CUSTOM_DRAW(df_thread_box_draw_extensions);
|
||||
internal UI_BOX_CUSTOM_DRAW(df_bp_box_draw_extensions);
|
||||
internal DF_CodeSliceSignal df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *preferred_column, String8 string);
|
||||
internal DF_CodeSliceSignal df_code_slicef(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *preferred_column, char *fmt, ...);
|
||||
internal DF_CodeSliceSignal df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *preferred_column, String8 string);
|
||||
internal DF_CodeSliceSignal df_code_slicef(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *preferred_column, char *fmt, ...);
|
||||
|
||||
internal B32 df_do_txt_controls(TXT_TextInfo *info, String8 data, U64 line_count_per_page, TxtPt *cursor, TxtPt *mark, S64 *preferred_column);
|
||||
|
||||
|
||||
+137
-145
@@ -7,9 +7,9 @@
|
||||
DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
TG_Key type_key = eval.type_key;
|
||||
TG_Kind type_kind = tg_kind_from_key(type_key);
|
||||
if(type_kind == TG_Kind_Ptr || type_kind == TG_Kind_LRef || type_kind == TG_Kind_RRef)
|
||||
E_TypeKey type_key = eval.type_key;
|
||||
E_TypeKind type_kind = e_type_kind_from_key(type_key);
|
||||
if(type_kind == E_TypeKind_Ptr || type_kind == E_TypeKind_LRef || type_kind == E_TypeKind_RRef)
|
||||
{
|
||||
DF_CfgNode *array_node = val->last;
|
||||
if(array_node != &df_g_nil_cfg_node)
|
||||
@@ -23,16 +23,16 @@ DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array)
|
||||
str8_list_push(scratch.arena, &array_size_expr_strs, child->string);
|
||||
}
|
||||
String8 array_size_expr = str8_list_join(scratch.arena, &array_size_expr_strs, 0);
|
||||
DF_Eval array_size_eval = df_eval_from_string(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, array_size_expr);
|
||||
DF_Eval array_size_eval_value = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, array_size_eval);
|
||||
eval_error_list_concat_in_place(&eval.errors, &array_size_eval.errors);
|
||||
array_size = array_size_eval_value.imm_u64;
|
||||
E_Eval array_size_eval = e_eval_from_string(arena, array_size_expr);
|
||||
E_Eval array_size_eval_value = e_value_eval_from_eval(array_size_eval);
|
||||
e_msg_list_concat_in_place(&eval.msgs, &array_size_eval.msgs);
|
||||
array_size = array_size_eval_value.value.u64;
|
||||
}
|
||||
|
||||
// rjf: apply array size to type
|
||||
TG_Key pointee = tg_ptee_from_graph_rdi_key(parse_ctx->type_graph, parse_ctx->rdi, type_key);
|
||||
TG_Key array_type = tg_cons_type_make(parse_ctx->type_graph, TG_Kind_Array, pointee, array_size);
|
||||
eval.type_key = tg_cons_type_make(parse_ctx->type_graph, TG_Kind_Ptr, array_type, 0);
|
||||
E_TypeKey pointee = e_type_ptee_from_key(type_key);
|
||||
E_TypeKey array_type = e_type_key_cons(E_TypeKind_Array, pointee, array_size);
|
||||
eval.type_key = e_type_key_cons(E_TypeKind_Ptr, array_type, 0);
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
@@ -59,23 +59,23 @@ DF_GFX_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_DEF(list){}
|
||||
DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(bswap)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
TG_Key type_key = eval.type_key;
|
||||
TG_Kind type_kind = tg_kind_from_key(type_key);
|
||||
U64 type_size_bytes = tg_byte_size_from_graph_rdi_key(parse_ctx->type_graph, parse_ctx->rdi, type_key);
|
||||
if(TG_Kind_Char8 <= type_kind && type_kind <= TG_Kind_S256 &&
|
||||
E_TypeKey type_key = eval.type_key;
|
||||
E_TypeKind type_kind = e_type_kind_from_key(type_key);
|
||||
U64 type_size_bytes = e_type_byte_size_from_key(type_key);
|
||||
if(E_TypeKind_Char8 <= type_kind && type_kind <= E_TypeKind_S256 &&
|
||||
(type_size_bytes == 2 ||
|
||||
type_size_bytes == 4 ||
|
||||
type_size_bytes == 8))
|
||||
{
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
if(value_eval.mode == EVAL_EvalMode_Value)
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
if(value_eval.mode == E_Mode_Value)
|
||||
{
|
||||
switch(type_size_bytes)
|
||||
{
|
||||
default:{}break;
|
||||
case 2:{U16 v = (U16)value_eval.imm_u64; v = bswap_u16(v); value_eval.imm_u64 = (U64)v;}break;
|
||||
case 4:{U32 v = (U32)value_eval.imm_u64; v = bswap_u32(v); value_eval.imm_u64 = (U64)v;}break;
|
||||
case 8:{U64 v = value_eval.imm_u64; v = bswap_u64(v); value_eval.imm_u64 = v;}break;
|
||||
case 2:{U16 v = (U16)value_eval.value.u64; v = bswap_u16(v); value_eval.value.u64 = (U64)v;}break;
|
||||
case 4:{U32 v = (U32)value_eval.value.u64; v = bswap_u32(v); value_eval.value.u64 = (U64)v;}break;
|
||||
case 8:{U64 v = value_eval.value.u64; v = bswap_u64(v); value_eval.value.u64 = v;}break;
|
||||
}
|
||||
}
|
||||
eval = value_eval;
|
||||
@@ -127,36 +127,36 @@ DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(no_addr){}
|
||||
//~ rjf: "rgba"
|
||||
|
||||
internal Vec4F32
|
||||
df_vr_rgba_from_eval(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_Entity *process)
|
||||
df_vr_rgba_from_eval(E_Eval eval, DF_Entity *process)
|
||||
{
|
||||
Vec4F32 rgba = {0};
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
TG_Key type_key = eval.type_key;
|
||||
TG_Kind type_kind = tg_kind_from_key(type_key);
|
||||
E_TypeKey type_key = eval.type_key;
|
||||
E_TypeKind type_kind = e_type_kind_from_key(type_key);
|
||||
switch(type_kind)
|
||||
{
|
||||
default:{}break;
|
||||
|
||||
// rjf: extract r/g/b/a bytes from u32
|
||||
case TG_Kind_U32:
|
||||
case TG_Kind_S32:
|
||||
case E_TypeKind_U32:
|
||||
case E_TypeKind_S32:
|
||||
{
|
||||
U32 hex_val = (U32)eval.imm_u64;
|
||||
U32 hex_val = (U32)eval.value.u64;
|
||||
rgba = rgba_from_u32(hex_val);
|
||||
}break;
|
||||
|
||||
// rjf: extract r/g/b/a values from array
|
||||
case TG_Kind_Array:
|
||||
if(eval.mode == EVAL_EvalMode_Addr)
|
||||
case E_TypeKind_Array:
|
||||
if(eval.mode == E_Mode_Addr)
|
||||
{
|
||||
U64 array_total_size = tg_byte_size_from_graph_rdi_key(graph, raddbg, type_key);
|
||||
U64 array_total_size = e_type_byte_size_from_key(type_key);
|
||||
U64 array_total_size_capped = ClampTop(array_total_size, 64);
|
||||
Rng1U64 array_memory_vaddr_rng = r1u64(eval.offset, eval.offset + array_total_size_capped);
|
||||
Rng1U64 array_memory_vaddr_rng = r1u64(eval.value.u64, eval.value.u64 + array_total_size_capped);
|
||||
CTRL_ProcessMemorySlice array_slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, array_memory_vaddr_rng, 0);
|
||||
String8 array_memory = array_slice.data;
|
||||
TG_Key element_type_key = tg_unwrapped_direct_from_graph_rdi_key(graph, raddbg, type_key);
|
||||
TG_Kind element_type_kind = tg_kind_from_key(element_type_key);
|
||||
U64 element_type_size = tg_byte_size_from_graph_rdi_key(graph, raddbg, element_type_key);
|
||||
E_TypeKey element_type_key = e_type_unwrap(e_type_direct_from_key(e_type_unwrap(type_key)));
|
||||
E_TypeKind element_type_kind = e_type_kind_from_key(element_type_key);
|
||||
U64 element_type_size = e_type_byte_size_from_key(element_type_key);
|
||||
for(U64 element_idx = 0; element_idx < 4; element_idx += 1)
|
||||
{
|
||||
U64 offset = element_idx*element_type_size;
|
||||
@@ -167,12 +167,12 @@ df_vr_rgba_from_eval(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_Entit
|
||||
switch(element_type_kind)
|
||||
{
|
||||
default:{}break;
|
||||
case TG_Kind_U8:
|
||||
case E_TypeKind_U8:
|
||||
{
|
||||
U8 byte = array_memory.str[offset];
|
||||
rgba.v[element_idx] = byte/255.f;
|
||||
}break;
|
||||
case TG_Kind_F32:
|
||||
case E_TypeKind_F32:
|
||||
{
|
||||
rgba.v[element_idx] = *(F32 *)(array_memory.str+offset);
|
||||
}break;
|
||||
@@ -181,33 +181,33 @@ df_vr_rgba_from_eval(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_Entit
|
||||
}break;
|
||||
|
||||
// rjf: extract r/g/b/a values from struct
|
||||
case TG_Kind_Struct:
|
||||
case TG_Kind_Class:
|
||||
case TG_Kind_Union:
|
||||
if(eval.mode == EVAL_EvalMode_Addr)
|
||||
case E_TypeKind_Struct:
|
||||
case E_TypeKind_Class:
|
||||
case E_TypeKind_Union:
|
||||
if(eval.mode == E_Mode_Addr)
|
||||
{
|
||||
U64 struct_total_size = tg_byte_size_from_graph_rdi_key(graph, raddbg, type_key);
|
||||
U64 struct_total_size = e_type_byte_size_from_key(type_key);
|
||||
U64 struct_total_size_capped = ClampTop(struct_total_size, 64);
|
||||
Rng1U64 struct_memory_vaddr_rng = r1u64(eval.offset, eval.offset + struct_total_size_capped);
|
||||
Rng1U64 struct_memory_vaddr_rng = r1u64(eval.value.u64, eval.value.u64 + struct_total_size_capped);
|
||||
CTRL_ProcessMemorySlice struct_slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, struct_memory_vaddr_rng, 0);
|
||||
String8 struct_memory = struct_slice.data;
|
||||
TG_Type *type = tg_type_from_graph_rdi_key(scratch.arena, graph, raddbg, type_key);
|
||||
E_Type *type = e_type_from_key(scratch.arena, type_key);
|
||||
for(U64 element_idx = 0, member_idx = 0;
|
||||
element_idx < 4 && member_idx < type->count;
|
||||
member_idx += 1)
|
||||
{
|
||||
TG_Member *member = &type->members[member_idx];
|
||||
TG_Key member_type_key = member->type_key;
|
||||
TG_Kind member_type_kind = tg_kind_from_key(member_type_key);
|
||||
E_Member *member = &type->members[member_idx];
|
||||
E_TypeKey member_type_key = member->type_key;
|
||||
E_TypeKind member_type_kind = e_type_kind_from_key(member_type_key);
|
||||
B32 member_is_component = 1;
|
||||
switch(member_type_kind)
|
||||
{
|
||||
default:{member_is_component = 0;}break;
|
||||
case TG_Kind_U8:
|
||||
case E_TypeKind_U8:
|
||||
{
|
||||
rgba.v[element_idx] = struct_memory.str[member->off]/255.f;
|
||||
}break;
|
||||
case TG_Kind_F32:
|
||||
case E_TypeKind_F32:
|
||||
{
|
||||
rgba.v[element_idx] = *(F32 *)(struct_memory.str + member->off);
|
||||
}break;
|
||||
@@ -224,37 +224,37 @@ df_vr_rgba_from_eval(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_Entit
|
||||
}
|
||||
|
||||
internal void
|
||||
df_vr_eval_commit_rgba(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_CtrlCtx *ctrl_ctx, Vec4F32 rgba)
|
||||
df_vr_eval_commit_rgba(E_Eval eval, Vec4F32 rgba)
|
||||
{
|
||||
TG_Key type_key = eval.type_key;
|
||||
TG_Kind type_kind = tg_kind_from_key(type_key);
|
||||
E_TypeKey type_key = eval.type_key;
|
||||
E_TypeKind type_kind = e_type_kind_from_key(type_key);
|
||||
switch(type_kind)
|
||||
{
|
||||
default:{}break;
|
||||
|
||||
// rjf: extract r/g/b/a bytes from u32
|
||||
case TG_Kind_U32:
|
||||
case TG_Kind_S32:
|
||||
case E_TypeKind_U32:
|
||||
case E_TypeKind_S32:
|
||||
{
|
||||
U32 val = u32_from_rgba(rgba);
|
||||
DF_Eval src_eval = eval;
|
||||
src_eval.mode = EVAL_EvalMode_Value;
|
||||
src_eval.imm_u64 = (U64)val;
|
||||
df_commit_eval_value(graph, raddbg, ctrl_ctx, eval, src_eval);
|
||||
E_Eval src_eval = eval;
|
||||
src_eval.mode = E_Mode_Value;
|
||||
src_eval.value.u64 = (U64)val;
|
||||
df_commit_eval_value(eval, src_eval);
|
||||
}break;
|
||||
|
||||
#if 0
|
||||
// rjf: extract r/g/b/a values from array
|
||||
case TG_Kind_Array:
|
||||
if(eval.mode == EVAL_EvalMode_Addr)
|
||||
case E_TypeKind_Array:
|
||||
if(eval.mode == E_Mode_Addr)
|
||||
{
|
||||
U64 array_total_size = tg_byte_size_from_graph_rdi_key(graph, raddbg, type_key);
|
||||
U64 array_total_size = e_type_byte_size_from_key(type_key);
|
||||
U64 array_total_size_capped = ClampTop(array_total_size, 64);
|
||||
Rng1U64 array_memory_vaddr_rng = r1u64(eval.offset, eval.offset + array_total_size_capped);
|
||||
String8 array_memory = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, array_memory_vaddr_rng);
|
||||
TG_Key element_type_key = tg_unwrapped_direct_from_graph_rdi_key(graph, raddbg, type_key);
|
||||
TG_Kind element_type_kind = tg_kind_from_key(element_type_key);
|
||||
U64 element_type_size = tg_byte_size_from_graph_rdi_key(graph, raddbg, element_type_key);
|
||||
E_TypeKey element_type_key = e_type_unwrap(e_type_direct_from_key(e_type_unwrap(type_key)));
|
||||
E_TypeKind element_type_kind = e_type_kind_from_key(element_type_key);
|
||||
U64 element_type_size = e_type_byte_size_from_key(element_type_key);
|
||||
for(U64 element_idx = 0; element_idx < 4; element_idx += 1)
|
||||
{
|
||||
U64 offset = element_idx*element_type_size;
|
||||
@@ -265,12 +265,12 @@ df_vr_eval_commit_rgba(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_Ctr
|
||||
switch(element_type_kind)
|
||||
{
|
||||
default:{}break;
|
||||
case TG_Kind_U8:
|
||||
case E_TypeKind_U8:
|
||||
{
|
||||
U8 byte = array_memory.str[offset];
|
||||
rgba.v[element_idx] = byte/255.f;
|
||||
}break;
|
||||
case TG_Kind_F32:
|
||||
case E_TypeKind_F32:
|
||||
{
|
||||
rgba.v[element_idx] = *(F32 *)(array_memory.str+offset);
|
||||
}break;
|
||||
@@ -279,32 +279,32 @@ df_vr_eval_commit_rgba(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_Ctr
|
||||
}break;
|
||||
|
||||
// rjf: extract r/g/b/a values from struct
|
||||
case TG_Kind_Struct:
|
||||
case TG_Kind_Class:
|
||||
case TG_Kind_Union:
|
||||
if(eval.mode == EVAL_EvalMode_Addr)
|
||||
case E_TypeKind_Struct:
|
||||
case E_TypeKind_Class:
|
||||
case E_TypeKind_Union:
|
||||
if(eval.mode == E_Mode_Addr)
|
||||
{
|
||||
U64 struct_total_size = tg_byte_size_from_graph_rdi_key(graph, raddbg, type_key);
|
||||
U64 struct_total_size = e_type_byte_size_from_key(type_key);
|
||||
U64 struct_total_size_capped = ClampTop(struct_total_size, 64);
|
||||
Rng1U64 struct_memory_vaddr_rng = r1u64(eval.offset, eval.offset + struct_total_size_capped);
|
||||
String8 struct_memory = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, struct_memory_vaddr_rng);
|
||||
TG_Type *type = tg_type_from_graph_rdi_key(scratch.arena, graph, raddbg, type_key);
|
||||
E_Type *type = e_type_from_key(scratch.arena, graph, raddbg, type_key);
|
||||
for(U64 element_idx = 0, member_idx = 0;
|
||||
element_idx < 4 && member_idx < type->count;
|
||||
member_idx += 1)
|
||||
{
|
||||
TG_Member *member = &type->members[member_idx];
|
||||
TG_Key member_type_key = member->type_key;
|
||||
TG_Kind member_type_kind = tg_kind_from_key(member_type_key);
|
||||
E_Member *member = &type->members[member_idx];
|
||||
E_TypeKey member_type_key = member->type_key;
|
||||
E_TypeKind member_type_kind = e_type_kind_from_key(member_type_key);
|
||||
B32 member_is_component = 1;
|
||||
switch(member_type_kind)
|
||||
{
|
||||
default:{member_is_component = 0;}break;
|
||||
case TG_Kind_U8:
|
||||
case E_TypeKind_U8:
|
||||
{
|
||||
rgba.v[element_idx] = struct_memory.str[member->off]/255.f;
|
||||
}break;
|
||||
case TG_Kind_F32:
|
||||
case E_TypeKind_F32:
|
||||
{
|
||||
rgba.v[element_idx] = *(F32 *)(struct_memory.str + member->off);
|
||||
}break;
|
||||
@@ -333,12 +333,12 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(rgba)
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
|
||||
//- rjf: grab hsva
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
Vec4F32 rgba = df_vr_rgba_from_eval(value_eval, parse_ctx->type_graph, parse_ctx->rdi, process);
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
Vec4F32 rgba = df_vr_rgba_from_eval(value_eval, process);
|
||||
Vec4F32 hsva = hsva_from_rgba(rgba);
|
||||
|
||||
//- rjf: build text box
|
||||
@@ -396,7 +396,7 @@ DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba)
|
||||
DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_VR_RGBAState *state = df_view_rule_block_user_state(key, DF_VR_RGBAState);
|
||||
|
||||
@@ -411,8 +411,8 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
|
||||
}
|
||||
else
|
||||
{
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
rgba = df_vr_rgba_from_eval(value_eval, parse_ctx->type_graph, parse_ctx->rdi, process);
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
rgba = df_vr_rgba_from_eval(value_eval, process);
|
||||
state->hsva = hsva = hsva_from_rgba(rgba);
|
||||
state->memgen_idx = ctrl_mem_gen();
|
||||
}
|
||||
@@ -462,7 +462,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
|
||||
if(commit)
|
||||
{
|
||||
Vec4F32 rgba = rgba_from_hsva(hsva);
|
||||
df_vr_eval_commit_rgba(eval, parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, rgba);
|
||||
df_vr_eval_commit_rgba(eval, rgba);
|
||||
state->memgen_idx = ctrl_mem_gen();
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
|
||||
//~ rjf: "text"
|
||||
|
||||
internal DF_TxtTopologyInfo
|
||||
df_vr_txt_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_txt_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_TxtTopologyInfo result = zero_struct;
|
||||
@@ -493,10 +493,10 @@ df_vr_txt_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_Par
|
||||
}
|
||||
lang_string = lang_cfg->first->string;
|
||||
String8 size_expr = str8_list_join(scratch.arena, &size_expr_strs, &join);
|
||||
DF_Eval size_eval = df_eval_from_string(scratch.arena, scope, ctrl_ctx, parse_ctx, macro_map, size_expr);
|
||||
DF_Eval size_val_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, size_eval);
|
||||
E_Eval size_eval = e_eval_from_string(scratch.arena, size_expr);
|
||||
E_Eval size_val_eval = e_value_eval_from_eval(size_eval);
|
||||
result.lang = txt_lang_kind_from_extension(lang_string);
|
||||
result.size_cap = size_val_eval.imm_u64;
|
||||
result.size_cap = size_val_eval.value.u64;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
@@ -532,11 +532,11 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
//////////////////////////////
|
||||
//- rjf: unpack evaluation / view rule params
|
||||
//
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(cfg);
|
||||
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));
|
||||
|
||||
//////////////////////////////
|
||||
@@ -600,7 +600,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
//- rjf: build code slice
|
||||
UI_WidthFill UI_HeightFill UI_Parent(container)
|
||||
{
|
||||
DF_CodeSliceSignal slice_sig = df_code_slice(ws, ctrl_ctx, parse_ctx, &code_slice_params, &state->cursor, &state->mark, &state->preferred_column, str8_lit("###slice"));
|
||||
DF_CodeSliceSignal slice_sig = df_code_slice(ws, &code_slice_params, &state->cursor, &state->mark, &state->preferred_column, str8_lit("###slice"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ DF_VIEW_UI_FUNCTION_DEF(text)
|
||||
//~ rjf: "disasm"
|
||||
|
||||
internal DF_DisasmTopologyInfo
|
||||
df_vr_disasm_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_disasm_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_DisasmTopologyInfo result = zero_struct;
|
||||
@@ -637,13 +637,13 @@ df_vr_disasm_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_
|
||||
}
|
||||
arch_string = arch_cfg->first->string;
|
||||
String8 size_expr = str8_list_join(scratch.arena, &size_expr_strs, &join);
|
||||
DF_Eval size_eval = df_eval_from_string(scratch.arena, scope, ctrl_ctx, parse_ctx, macro_map, size_expr);
|
||||
DF_Eval size_val_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, size_eval);
|
||||
E_Eval size_eval = e_eval_from_string(scratch.arena, size_expr);
|
||||
E_Eval size_val_eval = e_value_eval_from_eval(size_eval);
|
||||
if(str8_match(arch_string, str8_lit("x64"), StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
result.arch = Architecture_x64;
|
||||
}
|
||||
result.size_cap = size_val_eval.imm_u64;
|
||||
result.size_cap = size_val_eval.value.u64;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
@@ -679,15 +679,15 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
state->last_open_frame_idx = df_frame_index();
|
||||
{
|
||||
//- rjf: unpack params
|
||||
DF_DisasmTopologyInfo top = df_vr_disasm_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_DisasmTopologyInfo top = df_vr_disasm_topology_info_from_cfg(cfg);
|
||||
|
||||
//- rjf: resolve to address value & range
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
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(ctrl_ctx->thread);
|
||||
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
|
||||
@@ -752,7 +752,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
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, ctrl_ctx, parse_ctx, &code_slice_params, &state->cursor, &state->mark, &state->preferred_column, str8_lit("###code_slice"));
|
||||
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);
|
||||
@@ -833,7 +833,7 @@ df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 r
|
||||
}
|
||||
|
||||
internal DF_BitmapTopologyInfo
|
||||
df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_bitmap_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_BitmapTopologyInfo info = {0};
|
||||
@@ -857,12 +857,12 @@ df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_
|
||||
String8 width_expr = str8_list_join(scratch.arena, &width_expr_strs, 0);
|
||||
String8 height_expr = str8_list_join(scratch.arena, &height_expr_strs, 0);
|
||||
String8 fmt_string = fmt_cfg->first->string;
|
||||
DF_Eval width_eval = df_eval_from_string(scratch.arena, scope, ctrl_ctx, parse_ctx, macro_map, width_expr);
|
||||
DF_Eval width_eval_value = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, width_eval);
|
||||
info.width = width_eval_value.imm_u64;
|
||||
DF_Eval height_eval = df_eval_from_string(scratch.arena, scope, ctrl_ctx, parse_ctx, macro_map, height_expr);
|
||||
DF_Eval height_eval_value = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, height_eval);
|
||||
info.height = height_eval_value.imm_u64;
|
||||
E_Eval width_eval = e_eval_from_string(scratch.arena, width_expr);
|
||||
E_Eval width_eval_value = e_value_eval_from_eval(width_eval);
|
||||
info.width = width_eval_value.value.u64;
|
||||
E_Eval height_eval = e_eval_from_string(scratch.arena, height_expr);
|
||||
E_Eval height_eval_value = e_value_eval_from_eval(height_eval);
|
||||
info.height = height_eval_value.value.u64;
|
||||
if(fmt_string.size != 0)
|
||||
{
|
||||
for(R_Tex2DFormat fmt = (R_Tex2DFormat)0; fmt < R_Tex2DFormat_COUNT; fmt = (R_Tex2DFormat)(fmt+1))
|
||||
@@ -926,9 +926,9 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(bitmap)
|
||||
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
DF_BitmapTopologyInfo topology = df_vr_bitmap_topology_info_from_cfg(scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
DF_BitmapTopologyInfo topology = df_vr_bitmap_topology_info_from_cfg(cfg);
|
||||
U64 expected_size = topology.width*topology.height*r_tex2d_format_bytes_per_pixel_table[topology.fmt];
|
||||
DF_Font(ws, DF_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
ui_labelf("0x%I64x -> Bitmap (%I64u x %I64u)", base_vaddr, topology.width, topology.height);
|
||||
@@ -949,15 +949,15 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
|
||||
//////////////////////////////
|
||||
//- rjf: unpack context
|
||||
//
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: evaluate expression
|
||||
//
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
DF_BitmapTopologyInfo topology_info = df_vr_bitmap_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
DF_BitmapTopologyInfo topology_info = df_vr_bitmap_topology_info_from_cfg(cfg);
|
||||
U64 expected_size = topology_info.width*topology_info.height*r_tex2d_format_bytes_per_pixel_table[topology_info.fmt];
|
||||
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr+expected_size);
|
||||
|
||||
@@ -1012,24 +1012,20 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
DF_BitmapViewState *bvs = df_view_user_state(view, DF_BitmapViewState);
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
DF_CfgNode *view_center_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("view_center"), StringMatchFlag_CaseInsensitive);
|
||||
DF_CfgNode *zoom_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("zoom"), StringMatchFlag_CaseInsensitive);
|
||||
DF_CfgNode *bitmap_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("bitmap"), StringMatchFlag_CaseInsensitive);
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, thread_unwind_rip_vaddr);
|
||||
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, df_interact_regs()->unwind_count);
|
||||
bvs->view_center_pos.x = (F32)f64_from_str8(bitmap_cfg->first->string);
|
||||
bvs->view_center_pos.y = (F32)f64_from_str8(bitmap_cfg->first->next->string);
|
||||
bvs->zoom = (F32)f64_from_str8(zoom_cfg->first->string);
|
||||
bvs->top = df_vr_bitmap_topology_info_from_cfg(di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, bitmap_cfg);
|
||||
bvs->top = df_vr_bitmap_topology_info_from_cfg(bitmap_cfg);
|
||||
if(bvs->zoom == 0)
|
||||
{
|
||||
bvs->zoom = 1.f;
|
||||
}
|
||||
di_scope_close(di_scope);
|
||||
}
|
||||
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(bitmap)
|
||||
@@ -1080,26 +1076,23 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
DF_BitmapViewState *bvs = df_view_user_state(view, DF_BitmapViewState);
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
TEX_Scope *tex_scope = tex_scope_open();
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack context
|
||||
//
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, thread_unwind_rip_vaddr);
|
||||
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, df_interact_regs()->unwind_count);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: evaluate expression
|
||||
//
|
||||
String8 expr = str8(view->query_buffer, view->query_string_size);
|
||||
DF_Eval eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx.type_graph, parse_ctx.rdi, &ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
E_Eval eval = e_eval_from_string(scratch.arena, expr);
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
U64 expected_size = bvs->top.width*bvs->top.height*r_tex2d_format_bytes_per_pixel_table[bvs->top.fmt];
|
||||
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr+expected_size);
|
||||
|
||||
@@ -1245,7 +1238,6 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
|
||||
hs_scope_close(hs_scope);
|
||||
tex_scope_close(tex_scope);
|
||||
di_scope_close(di_scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -1253,7 +1245,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
//~ rjf: "geo"
|
||||
|
||||
internal DF_GeoTopologyInfo
|
||||
df_vr_geo_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_geo_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_GeoTopologyInfo result = {0};
|
||||
@@ -1281,15 +1273,15 @@ df_vr_geo_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_Par
|
||||
String8 count_expr = str8_list_join(scratch.arena, &count_expr_strs, &join);
|
||||
String8 vertices_base_expr = str8_list_join(scratch.arena, &vertices_base_expr_strs, &join);
|
||||
String8 vertices_size_expr = str8_list_join(scratch.arena, &vertices_size_expr_strs, &join);
|
||||
DF_Eval count_eval = df_eval_from_string(scratch.arena, scope, ctrl_ctx, parse_ctx, macro_map, count_expr);
|
||||
DF_Eval vertices_base_eval = df_eval_from_string(scratch.arena, scope, ctrl_ctx, parse_ctx, macro_map, vertices_base_expr);
|
||||
DF_Eval vertices_size_eval = df_eval_from_string(scratch.arena, scope, ctrl_ctx, parse_ctx, macro_map, vertices_size_expr);
|
||||
DF_Eval count_val_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, count_eval);
|
||||
DF_Eval vertices_base_val_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, vertices_base_eval);
|
||||
DF_Eval vertices_size_val_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, vertices_size_eval);
|
||||
U64 vertices_base_vaddr = vertices_base_val_eval.imm_u64 ? vertices_base_val_eval.imm_u64 : vertices_base_val_eval.offset;
|
||||
result.index_count = count_val_eval.imm_u64;
|
||||
result.vertices_vaddr_range = r1u64(vertices_base_vaddr, vertices_base_vaddr+vertices_size_val_eval.imm_u64);
|
||||
E_Eval count_eval = e_eval_from_string(scratch.arena, count_expr);
|
||||
E_Eval vertices_base_eval = e_eval_from_string(scratch.arena, vertices_base_expr);
|
||||
E_Eval vertices_size_eval = e_eval_from_string(scratch.arena, vertices_size_expr);
|
||||
E_Eval count_val_eval = e_value_eval_from_eval(count_eval);
|
||||
E_Eval vertices_base_val_eval = e_value_eval_from_eval(vertices_base_eval);
|
||||
E_Eval vertices_size_val_eval = e_value_eval_from_eval(vertices_size_eval);
|
||||
U64 vertices_base_vaddr = vertices_base_val_eval.value.u64;
|
||||
result.index_count = count_val_eval.value.u64;
|
||||
result.vertices_vaddr_range = r1u64(vertices_base_vaddr, vertices_base_vaddr+vertices_size_val_eval.value.u64);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
@@ -1344,8 +1336,8 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(geo)
|
||||
|
||||
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(geo)
|
||||
{
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
DF_Font(ws, DF_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
ui_labelf("0x%I64x -> Geometry", base_vaddr);
|
||||
}
|
||||
@@ -1369,16 +1361,16 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(geo)
|
||||
state->last_open_frame_idx = df_frame_index();
|
||||
|
||||
//- rjf: resolve to address value
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
|
||||
//- rjf: extract extra geo topology info from view rule
|
||||
DF_GeoTopologyInfo top = df_vr_geo_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_GeoTopologyInfo top = df_vr_geo_topology_info_from_cfg(cfg);
|
||||
Rng1U64 index_buffer_vaddr_range = r1u64(base_vaddr, base_vaddr+top.index_count*sizeof(U32));
|
||||
Rng1U64 vertex_buffer_vaddr_range = top.vertices_vaddr_range;
|
||||
|
||||
//- rjf: unpack thread/process of eval
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
|
||||
//- rjf: obtain keys for index buffer & vertex buffer memory
|
||||
|
||||
@@ -14,8 +14,8 @@ struct DF_VR_RGBAState
|
||||
U64 memgen_idx;
|
||||
};
|
||||
|
||||
internal Vec4F32 df_vr_rgba_from_eval(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_Entity *process);
|
||||
internal void df_vr_eval_commit_rgba(DF_Eval eval, TG_Graph *graph, RDI_Parsed *raddbg, DF_CtrlCtx *ctrl_ctx, Vec4F32 rgba);
|
||||
internal Vec4F32 df_vr_rgba_from_eval(E_Eval eval, DF_Entity *process);
|
||||
internal void df_vr_eval_commit_rgba(E_Eval eval, Vec4F32 rgba);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "text"
|
||||
@@ -38,7 +38,7 @@ struct DF_VR_TextState
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_TxtTopologyInfo df_vr_txt_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_TxtTopologyInfo df_vr_txt_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "disasm"
|
||||
@@ -61,7 +61,7 @@ struct DF_VR_DisasmState
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_DisasmTopologyInfo df_vr_disasm_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_DisasmTopologyInfo df_vr_disasm_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "bitmap"
|
||||
@@ -104,7 +104,7 @@ internal Vec2F32 df_bitmap_view_state__screen_from_canvas_pos(DF_BitmapViewState
|
||||
internal Rng2F32 df_bitmap_view_state__screen_from_canvas_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 cvs);
|
||||
internal Vec2F32 df_bitmap_view_state__canvas_from_screen_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 scr);
|
||||
internal Rng2F32 df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 scr);
|
||||
internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "geo"
|
||||
@@ -139,6 +139,6 @@ struct DF_VR_GeoBoxDrawData
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DF_CfgNode *cfg);
|
||||
|
||||
#endif // DF_VIEW_RULES_H
|
||||
|
||||
+122
-180
@@ -464,13 +464,11 @@ df_code_view_build(Arena *arena, DF_Window *ws, DF_Panel *panel, DF_View *view,
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: extract invariants
|
||||
//
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
F_Tag code_font = df_font_from_slot(DF_FontSlot_Code);
|
||||
F32 code_font_size = df_font_size_from_slot(ws, DF_FontSlot_Code);
|
||||
F32 code_tab_size = f_column_size_from_tag_size(code_font, code_font_size)*df_setting_val_from_code(ws, DF_SettingCode_TabWidth).s32;
|
||||
@@ -481,15 +479,8 @@ df_code_view_build(Arena *arena, DF_Window *ws, DF_Panel *panel, DF_View *view,
|
||||
F32 scroll_bar_dim = floor_f32(ui_top_font_size()*1.5f);
|
||||
Vec2F32 code_area_dim = v2f32(panel_box_dim.x - scroll_bar_dim, panel_box_dim.y - scroll_bar_dim);
|
||||
S64 num_possible_visible_lines = (S64)(code_area_dim.y/code_line_height)+1;
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack ctrl ctx & make parse ctx
|
||||
//
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
U64 unwind_count = ctrl_ctx.unwind_count;
|
||||
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, rip_vaddr);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: determine visible line range / count
|
||||
@@ -616,14 +607,14 @@ df_code_view_build(Arena *arena, DF_Window *ws, DF_Panel *panel, DF_View *view,
|
||||
ProfScope("find live threads mapping to this file")
|
||||
{
|
||||
DF_Entity *file = df_entity_from_handle(df_interact_regs()->file);
|
||||
DF_Entity *selected_thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *selected_thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_EntityList threads = df_query_cached_entity_list_with_kind(DF_EntityKind_Thread);
|
||||
for(DF_EntityNode *thread_n = threads.first; thread_n != 0; thread_n = thread_n->next)
|
||||
{
|
||||
DF_Entity *thread = thread_n->entity;
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 unwind_count = (thread == selected_thread) ? ctrl_ctx.unwind_count : 0;
|
||||
U64 inline_depth = (thread == selected_thread) ? ctrl_ctx.inline_depth : 0;
|
||||
U64 unwind_count = (thread == selected_thread) ? df_interact_regs()->unwind_count : 0;
|
||||
U64 inline_depth = (thread == selected_thread) ? df_interact_regs()->inline_depth : 0;
|
||||
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
U64 last_inst_on_unwound_rip_vaddr = rip_vaddr - !!unwind_count;
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, last_inst_on_unwound_rip_vaddr);
|
||||
@@ -671,12 +662,12 @@ df_code_view_build(Arena *arena, DF_Window *ws, DF_Panel *panel, DF_View *view,
|
||||
// rjf: find live threads mapping to disasm
|
||||
if(dasm_lines) ProfScope("find live threads mapping to this disassembly")
|
||||
{
|
||||
DF_Entity *selected_thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *selected_thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_EntityList threads = df_query_cached_entity_list_with_kind(DF_EntityKind_Thread);
|
||||
for(DF_EntityNode *thread_n = threads.first; thread_n != 0; thread_n = thread_n->next)
|
||||
{
|
||||
DF_Entity *thread = thread_n->entity;
|
||||
U64 unwind_count = (thread == selected_thread) ? ctrl_ctx.unwind_count : 0;
|
||||
U64 unwind_count = (thread == selected_thread) ? df_interact_regs()->unwind_count : 0;
|
||||
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
if(df_entity_ancestor_from_kind(thread, DF_EntityKind_Process) == process && contains_1u64(dasm_vaddr_range, rip_vaddr))
|
||||
{
|
||||
@@ -945,7 +936,7 @@ df_code_view_build(Arena *arena, DF_Window *ws, DF_Panel *panel, DF_View *view,
|
||||
DF_CodeSliceSignal sig = {0};
|
||||
UI_Focus(UI_FocusKind_On)
|
||||
{
|
||||
sig = df_code_slicef(ws, &ctrl_ctx, &parse_ctx, &code_slice_params, &view->cursor, &view->mark, &cv->preferred_column, "txt_view_%p", view);
|
||||
sig = df_code_slicef(ws, &code_slice_params, &view->cursor, &view->mark, &cv->preferred_column, "txt_view_%p", view);
|
||||
}
|
||||
|
||||
//- rjf: press code slice? -> focus panel
|
||||
@@ -1159,7 +1150,6 @@ df_code_view_build(Arena *arena, DF_Window *ws, DF_Panel *panel, DF_View *view,
|
||||
}
|
||||
|
||||
txt_scope_close(txt_scope);
|
||||
di_scope_close(di_scope);
|
||||
hs_scope_close(hs_scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
@@ -1301,7 +1291,7 @@ df_tbl_from_watch_view_point(DF_EvalVizBlockList *blocks, DF_WatchViewPoint pt)
|
||||
//- rjf: table coordinates -> strings
|
||||
|
||||
internal String8
|
||||
df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalView *ev, TG_Graph *graph, RDI_Parsed *rdi, DF_EvalVizRow *row, DF_WatchViewColumnKind col_kind, B32 editable)
|
||||
df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalView *ev, DF_EvalVizRow *row, DF_WatchViewColumnKind col_kind, B32 editable)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(col_kind)
|
||||
@@ -1309,7 +1299,7 @@ df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalView *ev, TG_Graph
|
||||
default:{}break;
|
||||
case DF_WatchViewColumnKind_Expr: {result = editable ? row->edit_expr : row->display_expr;}break;
|
||||
case DF_WatchViewColumnKind_Value: {result = editable ? row->edit_value : row->display_value;}break;
|
||||
case DF_WatchViewColumnKind_Type: {result = !tg_key_match(row->eval.type_key, tg_key_zero()) ? tg_string_from_key(arena, graph, rdi, row->eval.type_key) : str8_zero();}break;
|
||||
case DF_WatchViewColumnKind_Type: {result = !e_type_key_match(row->eval.type_key, e_type_key_zero()) ? e_type_string_from_key(arena, row->eval.type_key) : str8_zero();}break;
|
||||
case DF_WatchViewColumnKind_ViewRule:{result = df_eval_view_rule_from_key(ev, row->key);}break;
|
||||
}
|
||||
return result;
|
||||
@@ -1340,7 +1330,7 @@ df_watch_view_text_edit_state_from_pt(DF_WatchViewState *wv, DF_WatchViewPoint p
|
||||
//- rjf: windowed watch tree visualization (both single-line and multi-line)
|
||||
|
||||
internal DF_EvalVizBlockList
|
||||
df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, FZY_Scope *fzy_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews)
|
||||
df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, FZY_Scope *fzy_scope, DF_View *view, DF_WatchViewState *ews)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
@@ -1348,7 +1338,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
DF_EvalViewKey eval_view_key = df_eval_view_key_from_eval_watch_view(ews);
|
||||
DF_EvalView *eval_view = df_eval_view_from_key(eval_view_key);
|
||||
String8 filter = str8(view->query_buffer, view->query_string_size);
|
||||
FZY_Target fzy_target = FZY_Target_UDTs;
|
||||
RDI_SectionKind fzy_target = RDI_SectionKind_UDTs;
|
||||
switch(ews->fill_kind)
|
||||
{
|
||||
////////////////////////////
|
||||
@@ -1365,7 +1355,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
{
|
||||
DF_ExpandKey parent_key = df_parent_expand_key_from_eval_root(root);
|
||||
DF_ExpandKey key = df_expand_key_from_eval_root(root);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, eval_view, root_expr_string, parent_key, key);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, eval_view, root_expr_string, parent_key, key);
|
||||
df_eval_viz_block_list_concat__in_place(&blocks, &root_blocks);
|
||||
}
|
||||
}
|
||||
@@ -1376,7 +1366,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
//
|
||||
case DF_WatchViewFillKind_Registers:
|
||||
{
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
Architecture arch = df_architecture_from_entity(thread);
|
||||
U64 reg_count = regs_reg_code_count_from_architecture(arch);
|
||||
String8 *reg_strings = regs_reg_code_string_table_from_architecture(arch);
|
||||
@@ -1391,7 +1381,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
{
|
||||
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
|
||||
DF_ExpandKey key = df_expand_key_make(df_hash_from_expand_key(parent_key), num);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, eval_view, root_expr_string, parent_key, key);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, eval_view, root_expr_string, parent_key, key);
|
||||
df_eval_viz_block_list_concat__in_place(&blocks, &root_blocks);
|
||||
}
|
||||
}
|
||||
@@ -1403,7 +1393,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
{
|
||||
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
|
||||
DF_ExpandKey key = df_expand_key_make(df_hash_from_expand_key(parent_key), num);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, eval_view, root_expr_string, parent_key, key);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, eval_view, root_expr_string, parent_key, key);
|
||||
df_eval_viz_block_list_concat__in_place(&blocks, &root_blocks);
|
||||
}
|
||||
}
|
||||
@@ -1414,18 +1404,18 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
//
|
||||
case DF_WatchViewFillKind_Locals:
|
||||
{
|
||||
EVAL_String2NumMapNodeArray nodes = eval_string2num_map_node_array_from_map(scratch.arena, parse_ctx->locals_map);
|
||||
eval_string2num_map_node_array_sort__in_place(&nodes);
|
||||
E_String2NumMapNodeArray nodes = e_string2num_map_node_array_from_map(scratch.arena, e_state->ctx->locals_map);
|
||||
e_string2num_map_node_array_sort__in_place(&nodes);
|
||||
for(U64 idx = 0; idx < nodes.count; idx += 1)
|
||||
{
|
||||
EVAL_String2NumMapNode *n = nodes.v[idx];
|
||||
E_String2NumMapNode *n = nodes.v[idx];
|
||||
String8 root_expr_string = n->string;
|
||||
FuzzyMatchRangeList matches = fuzzy_match_find(arena, filter, root_expr_string);
|
||||
if(matches.count == matches.needle_part_count)
|
||||
{
|
||||
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
|
||||
DF_ExpandKey key = df_expand_key_make(df_hash_from_expand_key(parent_key), idx+1);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, eval_view, root_expr_string, parent_key, key);
|
||||
DF_EvalVizBlockList root_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(arena, di_scope, eval_view, root_expr_string, parent_key, key);
|
||||
df_eval_viz_block_list_concat__in_place(&blocks, &root_blocks);
|
||||
}
|
||||
}
|
||||
@@ -1434,18 +1424,23 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
////////////////////////////
|
||||
//- rjf: debug info table fill -> build split debug info table blocks
|
||||
//
|
||||
case DF_WatchViewFillKind_Globals: fzy_target = FZY_Target_GlobalVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_ThreadLocals: fzy_target = FZY_Target_ThreadVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Types: fzy_target = FZY_Target_UDTs; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Procedures: fzy_target = FZY_Target_Procedures; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Globals: fzy_target = RDI_SectionKind_GlobalVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_ThreadLocals: fzy_target = RDI_SectionKind_ThreadVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Types: fzy_target = RDI_SectionKind_UDTs; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Procedures: fzy_target = RDI_SectionKind_Procedures; goto dbgi_table;
|
||||
dbgi_table:;
|
||||
{
|
||||
U64 endt_us = os_now_microseconds()+200;
|
||||
|
||||
//- rjf: unpack context
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_rip_unwind_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx->unwind_count);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, thread_rip_unwind_vaddr);
|
||||
DI_Key dbgi_key = df_dbgi_key_from_module(module);
|
||||
DI_KeyList dbgi_keys_list = df_push_active_dbgi_key_list(scratch.arena);
|
||||
DI_KeyArray dbgi_keys = di_key_array_from_list(scratch.arena, &dbgi_keys_list);
|
||||
U64 rdis_count = dbgi_keys.count;
|
||||
RDI_Parsed **rdis = push_array(scratch.arena, RDI_Parsed *, rdis_count);
|
||||
for(U64 idx = 0; idx < rdis_count; idx += 1)
|
||||
{
|
||||
rdis[idx] = di_rdi_from_key(di_scope, &dbgi_keys.v[idx], endt_us);
|
||||
}
|
||||
|
||||
//- rjf: calculate top-level keys, expand root-level, grab root expansion node
|
||||
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
|
||||
@@ -1456,12 +1451,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
//- rjf: query all filtered items from dbgi searching system
|
||||
U128 fuzzy_search_key = {(U64)view, df_hash_from_string(str8_struct(&view))};
|
||||
B32 items_stale = 0;
|
||||
FZY_Params params = {fzy_target};
|
||||
{
|
||||
params.dbgi_keys.count = 1;
|
||||
params.dbgi_keys.v = &dbgi_key;
|
||||
}
|
||||
FZY_ItemArray items = fzy_items_from_key_params_query(fzy_scope, fuzzy_search_key, ¶ms, filter, os_now_microseconds()+100, &items_stale);
|
||||
FZY_Params params = {fzy_target, dbgi_keys};
|
||||
FZY_ItemArray items = fzy_items_from_key_params_query(fzy_scope, fuzzy_search_key, ¶ms, filter, endt_us, &items_stale);
|
||||
if(items_stale)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
@@ -1537,11 +1528,30 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
}
|
||||
for(U64 sub_expand_idx = 0; sub_expand_idx < sub_expand_keys_count; sub_expand_idx += 1)
|
||||
{
|
||||
FZY_Item *item = &items.v[sub_expand_item_idxs[sub_expand_idx]];
|
||||
|
||||
// rjf: form split: truncate & complete last block; begin next block
|
||||
last_vb = df_eval_viz_block_split_and_continue(arena, &blocks, last_vb, sub_expand_item_idxs[sub_expand_idx]);
|
||||
|
||||
// rjf: grab rdi for this item
|
||||
RDI_Parsed *rdi = &di_rdi_parsed_nil;
|
||||
U64 base_idx = 0;
|
||||
{
|
||||
for(U64 rdi_idx = 0; rdi_idx < rdis_count; rdi_idx += 1)
|
||||
{
|
||||
U64 procedures_count = 0;
|
||||
rdi_section_raw_table_from_kind(rdis[rdi_idx], RDI_SectionKind_Procedures, &procedures_count);
|
||||
if(base_idx <= item->idx && item->idx < base_idx + procedures_count)
|
||||
{
|
||||
rdi = rdis[rdi_idx];
|
||||
break;
|
||||
}
|
||||
base_idx += procedures_count;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: grab name for the expanded row
|
||||
String8 name = fzy_item_string_from_rdi_target_element_idx(parse_ctx->rdi, fzy_target, sub_expand_keys[sub_expand_idx].child_num);
|
||||
String8 name = fzy_item_string_from_rdi_target_element_idx(rdi, fzy_target, sub_expand_keys[sub_expand_idx].child_num-base_idx);
|
||||
|
||||
// rjf: recurse for sub-expansion
|
||||
{
|
||||
@@ -1553,8 +1563,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
|
||||
df_cfg_table_push_unparsed_string(arena, &child_cfg, view_rule_string, DF_CfgSrc_User);
|
||||
}
|
||||
}
|
||||
DF_Eval eval = df_eval_from_string(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, name);
|
||||
df_append_viz_blocks_for_parent__rec(arena, di_scope, eval_view, ctrl_ctx, parse_ctx, macro_map, parent_key, sub_expand_keys[sub_expand_idx], name, eval, 0, &child_cfg, 0, &blocks);
|
||||
E_Eval eval = e_eval_from_string(arena, name);
|
||||
df_append_viz_blocks_for_parent__rec(arena, di_scope, eval_view, parent_key, sub_expand_keys[sub_expand_idx], name, eval, 0, &child_cfg, 0, &blocks);
|
||||
}
|
||||
}
|
||||
df_eval_viz_block_end(&blocks, last_vb);
|
||||
@@ -1626,21 +1636,15 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
//- rjf: unpack arguments
|
||||
//
|
||||
F_Tag code_font = df_font_from_slot(DF_FontSlot_Code);
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_ip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
U64 thread_ip_vaddr = df_query_cached_rip_from_thread_unwind(thread, df_interact_regs()->unwind_count);
|
||||
DF_EvalViewKey eval_view_key = df_eval_view_key_from_eval_watch_view(ewv);
|
||||
DF_EvalView *eval_view = df_eval_view_from_key(eval_view_key);
|
||||
String8 filter = str8(view->query_buffer, view->query_string_size);
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
S64 num_possible_visible_rows = (S64)(dim_2f32(rect).y/row_height_px);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: process * thread info -> parse_ctx
|
||||
//
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, thread_ip_vaddr);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: determine autocompletion string
|
||||
//
|
||||
@@ -1660,7 +1664,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
//////////////////////////////
|
||||
//- rjf: consume events & perform navigations/edits - calculate state
|
||||
//
|
||||
EVAL_String2ExprMap macro_map = {0};
|
||||
E_String2ExprMap macro_map = {0};
|
||||
DF_EvalVizBlockList blocks = {0};
|
||||
UI_ScrollListRowBlockArray row_blocks = {0};
|
||||
Vec2S64 cursor_tbl = {0};
|
||||
@@ -1679,14 +1683,14 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
//
|
||||
if(state_dirty)
|
||||
{
|
||||
macro_map = eval_string2expr_map_make(scratch.arena, 256);
|
||||
macro_map = e_string2expr_map_make(scratch.arena, 256);
|
||||
for(DF_EvalRoot *root = ewv->first_root; root != 0; root = root->next)
|
||||
{
|
||||
String8 root_expr = str8(root->expr_buffer, root->expr_buffer_string_size);
|
||||
|
||||
//- rjf: unpack arguments
|
||||
DF_Entity *process = thread->parent;
|
||||
U64 unwind_count = ctrl_ctx.unwind_count;
|
||||
U64 unwind_count = df_interact_regs()->unwind_count;
|
||||
CTRL_Unwind unwind = df_query_cached_unwind_from_thread(thread);
|
||||
Architecture arch = df_architecture_from_entity(thread);
|
||||
U64 reg_size = regs_block_size_from_architecture(arch);
|
||||
@@ -1699,12 +1703,11 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
}
|
||||
|
||||
//- rjf: lex & parse
|
||||
EVAL_TokenArray tokens = eval_token_array_from_text(scratch.arena, root_expr);
|
||||
EVAL_ParseResult parse = eval_parse_expr_from_text_tokens(scratch.arena, &parse_ctx, root_expr, &tokens);
|
||||
EVAL_ErrorList errors = parse.errors;
|
||||
if(errors.count == 0)
|
||||
E_TokenArray tokens = e_token_array_from_text(scratch.arena, root_expr);
|
||||
E_Parse parse = e_parse_expr_from_text_tokens(scratch.arena, root_expr, &tokens);
|
||||
if(parse.msgs.max_kind == E_MsgKind_Null)
|
||||
{
|
||||
eval_push_leaf_ident_exprs_from_expr__in_place(scratch.arena, ¯o_map, parse.expr, &errors);
|
||||
e_push_leaf_ident_exprs_from_expr__in_place(scratch.arena, ¯o_map, parse.expr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1714,7 +1717,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
//
|
||||
if(state_dirty)
|
||||
{
|
||||
blocks = df_eval_viz_block_list_from_watch_view_state(scratch.arena, di_scope, fzy_scope, &ctrl_ctx, &parse_ctx, ¯o_map, view, ewv);
|
||||
blocks = df_eval_viz_block_list_from_watch_view_state(scratch.arena, di_scope, fzy_scope, view, ewv);
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
@@ -1852,7 +1855,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
ewv->text_edit_state_slots_count = u64_up_to_pow2(selection_dim.y+1);
|
||||
ewv->text_edit_state_slots_count = Max(ewv->text_edit_state_slots_count, 64);
|
||||
ewv->text_edit_state_slots = push_array(ewv->text_edit_arena, DF_WatchViewTextEditState*, ewv->text_edit_state_slots_count);
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
r1s64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y-1),
|
||||
ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y-1)+1), &blocks);
|
||||
DF_EvalVizRow *row = rows.first;
|
||||
@@ -1860,7 +1863,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
{
|
||||
for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1)
|
||||
{
|
||||
String8 string = df_string_from_eval_viz_row_column_kind(scratch.arena, eval_view, parse_ctx.type_graph, parse_ctx.rdi, row, (DF_WatchViewColumnKind)x, 1);
|
||||
String8 string = df_string_from_eval_viz_row_column_kind(scratch.arena, eval_view, row, (DF_WatchViewColumnKind)x, 1);
|
||||
string.size = Min(string.size, sizeof(ewv->dummy_text_edit_state.input_buffer));
|
||||
DF_WatchViewPoint pt = {(DF_WatchViewColumnKind)x, row->parent_key, row->key};
|
||||
U64 hash = df_hash_from_expand_key(pt.key);
|
||||
@@ -1884,7 +1887,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
if(!ewv->text_editing && evt->slot == UI_EventActionSlot_Accept && selection_tbl.min.x <= 0)
|
||||
{
|
||||
taken = 1;
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
r1s64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y-1),
|
||||
ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y-1)+1), &blocks);
|
||||
DF_EvalVizRow *row = rows.first;
|
||||
@@ -1926,15 +1929,13 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
selection_tbl.min.x == 1)
|
||||
{
|
||||
taken = 1;
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
r1s64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y-1),
|
||||
ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y-1)+1), &blocks);
|
||||
DF_EvalVizRow *row = rows.first;
|
||||
if(!(row->flags & DF_EvalVizRowFlag_CanEditValue))
|
||||
{
|
||||
U64 vaddr = 0;
|
||||
if(vaddr == 0) { vaddr = row->eval.offset; }
|
||||
if(vaddr == 0) { vaddr = row->eval.imm_u64; }
|
||||
U64 vaddr = row->eval.value.u64;
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = df_dbgi_key_from_module(module);
|
||||
U64 voff = df_voff_from_vaddr(module, vaddr);
|
||||
@@ -2042,14 +2043,14 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
case DF_WatchViewColumnKind_Value:
|
||||
if(editing_complete && evt->slot != UI_EventActionSlot_Cancel)
|
||||
{
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
r1s64(ui_scroll_list_row_from_item(&row_blocks, y-1),
|
||||
ui_scroll_list_row_from_item(&row_blocks, y-1)+1), &blocks);
|
||||
B32 success = 0;
|
||||
if(rows.first != 0)
|
||||
{
|
||||
DF_Eval write_eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, new_string);
|
||||
success = df_commit_eval_value(parse_ctx.type_graph, parse_ctx.rdi, &ctrl_ctx, rows.first->eval, write_eval);
|
||||
E_Eval write_eval = e_eval_from_string(scratch.arena, new_string);
|
||||
success = df_commit_eval_value(rows.first->eval, write_eval);
|
||||
}
|
||||
if(!success)
|
||||
{
|
||||
@@ -2084,7 +2085,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
{
|
||||
taken = 1;
|
||||
String8List strs = {0};
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
DF_EvalVizWindowedRowList rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, eval_view, default_radix, code_font, ui_top_font_size(),
|
||||
r1s64(ui_scroll_list_row_from_item(&row_blocks, selection_tbl.min.y-1),
|
||||
ui_scroll_list_row_from_item(&row_blocks, selection_tbl.max.y-1)+1), &blocks);
|
||||
DF_EvalVizRow *row = rows.first;
|
||||
@@ -2092,7 +2093,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
{
|
||||
for(S64 x = selection_tbl.min.x; x <= selection_tbl.max.x; x += 1)
|
||||
{
|
||||
String8 cell_string = df_string_from_eval_viz_row_column_kind(scratch.arena, eval_view, parse_ctx.type_graph, parse_ctx.rdi, row, (DF_WatchViewColumnKind)x, 0);
|
||||
String8 cell_string = df_string_from_eval_viz_row_column_kind(scratch.arena, eval_view, row, (DF_WatchViewColumnKind)x, 0);
|
||||
cell_string = str8_skip_chop_whitespace(cell_string);
|
||||
U64 comma_pos = str8_find_needle(cell_string, 0, str8_lit(","), 0);
|
||||
if(selection_tbl.min.x != selection_tbl.max.x || selection_tbl.min.y != selection_tbl.max.y)
|
||||
@@ -2431,7 +2432,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
//
|
||||
DF_EvalVizWindowedRowList rows = {0};
|
||||
{
|
||||
rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, eval_view, default_radix, code_font, ui_top_font_size(), r1s64(visible_row_rng.min-1, visible_row_rng.max), &blocks);
|
||||
rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, di_scope, eval_view, default_radix, code_font, ui_top_font_size(), r1s64(visible_row_rng.min-1, visible_row_rng.max), &blocks);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
@@ -2458,11 +2459,11 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
switch(row->eval.mode)
|
||||
{
|
||||
default:{}break;
|
||||
case EVAL_EvalMode_Addr:
|
||||
case E_Mode_Addr:
|
||||
{
|
||||
U64 size = tg_byte_size_from_graph_rdi_key(parse_ctx.type_graph, parse_ctx.rdi, row->eval.type_key);
|
||||
U64 size = e_type_byte_size_from_key(row->eval.type_key);
|
||||
size = Min(size, 64);
|
||||
Rng1U64 vaddr_rng = r1u64(row->eval.offset, row->eval.offset+size);
|
||||
Rng1U64 vaddr_rng = r1u64(row->eval.value.u64, row->eval.value.u64+size);
|
||||
CTRL_ProcessMemorySlice slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, vaddr_rng, 0);
|
||||
for(U64 idx = 0; idx < (slice.data.size+63)/64; idx += 1)
|
||||
{
|
||||
@@ -2519,7 +2520,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
{
|
||||
Vec2F32 canvas_dim = v2f32(scroll_list_params.dim_px.x - ui_top_font_size()*1.5f,
|
||||
(row->skipped_size_in_rows+row->size_in_rows+row->chopped_size_in_rows)*scroll_list_params.row_height_px);
|
||||
row->expand_ui_rule_spec->info.block_ui(ws, row->key, row->eval, row->edit_expr, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, row->expand_ui_rule_node, canvas_dim);
|
||||
row->expand_ui_rule_spec->info.block_ui(ws, row->key, row->eval, row->edit_expr, row->expand_ui_rule_node, canvas_dim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2566,9 +2567,9 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
////////////////////
|
||||
//- rjf: draw start of cache lines in expansions
|
||||
//
|
||||
if((row->eval.mode == EVAL_EvalMode_Addr || row->eval.mode == EVAL_EvalMode_NULL) &&
|
||||
row->eval.errors.count == 0 &&
|
||||
row->eval.offset%64 == 0 && row->depth > 0 &&
|
||||
if((row->eval.mode == E_Mode_Addr || row->eval.mode == E_Mode_Null) &&
|
||||
row->eval.msgs.count == 0 &&
|
||||
row->eval.value.u64%64 == 0 && row->depth > 0 &&
|
||||
!row_expanded)
|
||||
{
|
||||
ui_set_next_fixed_x(0);
|
||||
@@ -2581,14 +2582,14 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
////////////////////
|
||||
//- rjf: draw mid-row cache line boundaries in expansions
|
||||
//
|
||||
if((row->eval.mode == EVAL_EvalMode_Addr || row->eval.mode == EVAL_EvalMode_NULL) &&
|
||||
row->eval.errors.count == 0 &&
|
||||
row->eval.offset%64 != 0 &&
|
||||
if((row->eval.mode == E_Mode_Addr || row->eval.mode == E_Mode_Null) &&
|
||||
row->eval.msgs.max_kind == E_MsgKind_Null &&
|
||||
row->eval.value.u64%64 != 0 &&
|
||||
row->depth > 0 &&
|
||||
!row_expanded)
|
||||
{
|
||||
U64 next_off = (row->eval.offset + tg_byte_size_from_graph_rdi_key(parse_ctx.type_graph, parse_ctx.rdi, row->eval.type_key));
|
||||
if(next_off%64 != 0 && row->eval.offset/64 < next_off/64)
|
||||
U64 next_off = (row->eval.value.u64 + e_type_byte_size_from_key(row->eval.type_key));
|
||||
if(next_off%64 != 0 && row->eval.value.u64/64 < next_off/64)
|
||||
{
|
||||
ui_set_next_fixed_x(0);
|
||||
ui_set_next_fixed_y(scroll_list_params.row_height_px - ui_top_font_size()*0.5f);
|
||||
@@ -2641,9 +2642,9 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
if(is_inherited && ui_hovering(sig)) UI_Tooltip
|
||||
{
|
||||
String8List inheritance_chain_type_names = {0};
|
||||
for(TG_KeyNode *n = row->inherited_type_key_chain.first; n != 0; n = n->next)
|
||||
for(E_TypeKeyNode *n = row->inherited_type_key_chain.first; n != 0; n = n->next)
|
||||
{
|
||||
String8 inherited_type_name = tg_string_from_key(scratch.arena, parse_ctx.type_graph, parse_ctx.rdi, n->v);
|
||||
String8 inherited_type_name = e_type_string_from_key(scratch.arena, n->v);
|
||||
inherited_type_name = str8_skip_chop_whitespace(inherited_type_name);
|
||||
str8_list_push(scratch.arena, &inheritance_chain_type_names, inherited_type_name);
|
||||
}
|
||||
@@ -2657,53 +2658,6 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
DF_Font(ws, DF_FontSlot_Code) df_code_label(1.f, 1.f, df_rgba_from_theme_color(DF_ThemeColor_CodeType), inheritance_type);
|
||||
}
|
||||
}
|
||||
if(DEV_eval_watch_key_tooltips && ui_hovering(sig)) UI_Tooltip DF_Font(ws, DF_FontSlot_Code)
|
||||
{
|
||||
ui_labelf("Parent Key: %I64x, %I64x", row->parent_key.parent_hash, row->parent_key.child_num);
|
||||
ui_labelf("Hover Key: %I64x, %I64x", row->key.parent_hash, row->key.child_num);
|
||||
ui_labelf("Cursor Key: %I64x, %I64x", ewv->cursor.key.parent_hash, ewv->cursor.key.child_num);
|
||||
}
|
||||
if(DEV_eval_compiler_tooltips && row->depth == 0 && ui_hovering(sig)) UI_Tooltip
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 string = row->display_expr;
|
||||
|
||||
// rjf: lex & parse
|
||||
EVAL_TokenArray tokens = eval_token_array_from_text(scratch.arena, string);
|
||||
EVAL_ParseResult parse = eval_parse_expr_from_text_tokens(scratch.arena, &parse_ctx, string, &tokens);
|
||||
EVAL_ErrorList errors = parse.errors;
|
||||
ui_labelf("Tokens:");
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) for(U64 idx = 0; idx < tokens.count; idx += 1)
|
||||
{
|
||||
EVAL_Token *token = tokens.v+idx;
|
||||
String8 token_string = str8_substr(string, token->range);
|
||||
String8 token_kind_name = str8_lit("Token");
|
||||
switch(token->kind)
|
||||
{
|
||||
default:break;
|
||||
case EVAL_TokenKind_Identifier: {token_kind_name = str8_lit("Identifier");}break;
|
||||
case EVAL_TokenKind_Numeric: {token_kind_name = str8_lit("Numeric");}break;
|
||||
case EVAL_TokenKind_StringLiteral:{token_kind_name = str8_lit("StringLiteral");}break;
|
||||
case EVAL_TokenKind_CharLiteral: {token_kind_name = str8_lit("CharLiteral");}break;
|
||||
case EVAL_TokenKind_Symbol: {token_kind_name = str8_lit("Symbol");}break;
|
||||
}
|
||||
ui_labelf("%S -> \"%S\"", token_kind_name, token_string);
|
||||
}
|
||||
|
||||
// rjf: produce IR tree & type
|
||||
EVAL_IRTreeAndType ir_tree_and_type = {&eval_irtree_nil};
|
||||
if(parse.expr != &eval_expr_nil && errors.count == 0)
|
||||
{
|
||||
ui_labelf("Type:");
|
||||
ir_tree_and_type = eval_irtree_and_type_from_expr(scratch.arena, parse_ctx.type_graph, parse_ctx.rdi, &eval_string2expr_map_nil, parse.expr, &errors);
|
||||
TG_Key type_key = ir_tree_and_type.type_key;
|
||||
String8 type_string = tg_string_from_key(scratch.arena, parse_ctx.type_graph, parse_ctx.rdi, type_key);
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
ui_label(type_string);
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
// rjf: autocomplete lister
|
||||
if(expr_editing_active &&
|
||||
@@ -2712,7 +2666,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
{
|
||||
String8 input = str8(edit_state->input_buffer, edit_state->input_size);
|
||||
DF_AutoCompListerParams params = {DF_AutoCompListerFlag_Locals};
|
||||
df_set_autocomp_lister_query(ws, sig.box->key, ctrl_ctx, ¶ms, input, edit_state->cursor.column-1);
|
||||
df_set_autocomp_lister_query(ws, sig.box->key, ¶ms, input, edit_state->cursor.column-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2746,7 +2700,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
DF_WatchViewPoint pt = {DF_WatchViewColumnKind_Value, row->parent_key, row->key};
|
||||
DF_WatchViewTextEditState *edit_state = df_watch_view_text_edit_state_from_pt(ewv, pt);
|
||||
B32 cell_selected = (row_selected && selection_tbl.min.x <= pt.column_kind && pt.column_kind <= selection_tbl.max.x);
|
||||
B32 value_is_error = (row->eval.errors.count != 0);
|
||||
B32 value_is_error = (row->eval.msgs.max_kind != E_MsgKind_Null);
|
||||
B32 value_is_hook = (!value_is_error && row->value_ui_rule_spec != &df_g_nil_gfx_view_rule_spec && row->value_ui_rule_spec != 0);
|
||||
B32 value_is_complex = (!value_is_error && !value_is_hook && !(row->flags & DF_EvalVizRowFlag_CanEditValue));
|
||||
B32 value_is_simple = (!value_is_error && !value_is_hook && (row->flags & DF_EvalVizRowFlag_CanEditValue));
|
||||
@@ -2773,9 +2727,9 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
if(value_is_error) DF_Font(ws, DF_FontSlot_Main)
|
||||
{
|
||||
String8List strings = {0};
|
||||
for(EVAL_Error *error = row->eval.errors.first; error != 0; error = error->next)
|
||||
for(E_Msg *msg = row->eval.msgs.first; msg != 0; msg = msg->next)
|
||||
{
|
||||
str8_list_push(scratch.arena, &strings, error->text);
|
||||
str8_list_push(scratch.arena, &strings, msg->text);
|
||||
}
|
||||
StringJoin join = {str8_lit(""), str8_lit(" "), str8_lit("")};
|
||||
String8 error_string = str8_list_join(scratch.arena, &strings, &join);
|
||||
@@ -2788,7 +2742,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###val_%I64x", row_hash);
|
||||
UI_Parent(box)
|
||||
{
|
||||
row->value_ui_rule_spec->info.row_ui(ws, row->key, row->eval, di_scope, &ctrl_ctx, &parse_ctx, ¯o_map, row->value_ui_rule_node);
|
||||
row->value_ui_rule_spec->info.row_ui(ws, row->key, row->eval, row->value_ui_rule_node);
|
||||
}
|
||||
sig = ui_signal_from_box(box);
|
||||
}
|
||||
@@ -2835,9 +2789,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
// rjf: double-click, not editable -> go-to-location
|
||||
if(ui_double_clicked(sig) && !(row->flags & DF_EvalVizRowFlag_CanEditValue))
|
||||
{
|
||||
U64 vaddr = 0;
|
||||
if(vaddr == 0) { vaddr = row->eval.offset; }
|
||||
if(vaddr == 0) { vaddr = row->eval.imm_u64; }
|
||||
U64 vaddr = row->eval.value.u64;
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = df_dbgi_key_from_module(module);
|
||||
U64 voff = df_voff_from_vaddr(module, vaddr);
|
||||
@@ -2866,11 +2818,11 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
UI_FocusHot(cell_selected ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_FocusActive((cell_selected && ewv->text_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
{
|
||||
TG_Key key = row->eval.type_key;
|
||||
String8 string = tg_string_from_key(scratch.arena, parse_ctx.type_graph, parse_ctx.rdi, key);
|
||||
E_TypeKey key = row->eval.type_key;
|
||||
String8 string = e_type_string_from_key(scratch.arena, key);
|
||||
string = str8_skip_chop_whitespace(string);
|
||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###type_%I64x", row_hash);
|
||||
if(!tg_key_match(key, tg_key_zero())) UI_Parent(box)
|
||||
if(!e_type_key_match(key, e_type_key_zero())) UI_Parent(box)
|
||||
{
|
||||
df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeType), string);
|
||||
}
|
||||
@@ -2923,7 +2875,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
{
|
||||
params.flags = DF_AutoCompListerFlag_ViewRules;
|
||||
}
|
||||
df_set_autocomp_lister_query(ws, sig.box->key, ctrl_ctx, ¶ms, input, edit_state->cursor.column-1);
|
||||
df_set_autocomp_lister_query(ws, sig.box->key, ¶ms, input, edit_state->cursor.column-1);
|
||||
}
|
||||
|
||||
// rjf: double-click -> begin editing
|
||||
@@ -4098,20 +4050,18 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
String8 query = str8(view->query_buffer, view->query_string_size);
|
||||
DI_KeyList dbgi_keys_list = df_push_active_dbgi_key_list(scratch.arena);
|
||||
DI_KeyArray dbgi_keys = di_key_array_from_list(scratch.arena, &dbgi_keys_list);
|
||||
FZY_Params params = {FZY_Target_Procedures, dbgi_keys};
|
||||
FZY_Params params = {RDI_SectionKind_Procedures, dbgi_keys};
|
||||
U64 endt_us = os_now_microseconds()+200;
|
||||
|
||||
//- rjf: grab rdis, make type graphs for each
|
||||
U64 rdis_count = dbgi_keys.count;
|
||||
RDI_Parsed **rdis = push_array(scratch.arena, RDI_Parsed *, rdis_count);
|
||||
TG_Graph **graphs = push_array(scratch.arena, TG_Graph *, rdis_count);
|
||||
{
|
||||
for(U64 idx = 0; idx < rdis_count; idx += 1)
|
||||
{
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_keys.v[idx], endt_us);
|
||||
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
|
||||
rdis[idx] = rdi;
|
||||
graphs[idx] = tg_graph_begin(rdi_addr_size_from_arch(tli->arch), 256);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4195,7 +4145,6 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
//- rjf: determine dbgi/rdi to which this item belongs
|
||||
DI_Key dbgi_key = {0};
|
||||
RDI_Parsed *rdi = &di_rdi_parsed_nil;
|
||||
TG_Graph *graph = 0;
|
||||
U64 base_idx = 0;
|
||||
{
|
||||
for(U64 rdi_idx = 0; rdi_idx < rdis_count; rdi_idx += 1)
|
||||
@@ -4206,7 +4155,6 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
{
|
||||
dbgi_key = dbgi_keys.v[rdi_idx];
|
||||
rdi = rdis[rdi_idx];
|
||||
graph = graphs[rdi_idx];
|
||||
break;
|
||||
}
|
||||
base_idx += procedures_count;
|
||||
@@ -4219,7 +4167,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
U8 *name_base = rdi_string_from_idx(rdi, procedure->name_string_idx, &name_size);
|
||||
String8 name = str8(name_base, name_size);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, procedure->type_idx);
|
||||
TG_Key type_key = tg_key_ext(tg_kind_from_rdi_type_kind(type_node->kind), procedure->type_idx);
|
||||
E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), procedure->type_idx, e_idx_from_rdi(rdi));
|
||||
|
||||
//- rjf: build item button
|
||||
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
|
||||
@@ -4234,9 +4182,9 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
{
|
||||
UI_Box *box = df_code_label(1.f, 0, df_rgba_from_theme_color(DF_ThemeColor_CodeSymbol), name);
|
||||
ui_box_equip_fuzzy_match_ranges(box, &item->match_ranges);
|
||||
if(!tg_key_match(tg_key_zero(), type_key) && graph != 0)
|
||||
if(!e_type_key_match(e_type_key_zero(), type_key))
|
||||
{
|
||||
String8 type_string = tg_string_from_key(scratch.arena, graph, rdi, type_key);
|
||||
String8 type_string = e_type_string_from_key(scratch.arena, type_key);
|
||||
df_code_label(0.5f, 0, df_rgba_from_theme_color(DF_ThemeColor_TextWeak), type_string);
|
||||
}
|
||||
}
|
||||
@@ -5430,7 +5378,6 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 query = str8(view->query_buffer, view->query_string_size);
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
|
||||
//- rjf: get state
|
||||
typedef struct DF_SchedulerViewState DF_SchedulerViewState;
|
||||
@@ -5672,10 +5619,9 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DI_Scope *scope = di_scope_open();
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
Architecture arch = df_architecture_from_entity(thread);
|
||||
DF_Entity *process = thread->parent;
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
Vec4F32 thread_color = ui_top_palette()->text;
|
||||
if(thread->flags & DF_EntityFlag_HasColor)
|
||||
{
|
||||
@@ -5812,20 +5758,19 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(thread->arch, row->regs);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
|
||||
B32 frame_valid = (rip_vaddr != 0);
|
||||
TG_Graph *graph = tg_graph_begin(bit_size_from_arch(thread->arch)/8, 256);
|
||||
String8 symbol_name = {0};
|
||||
String8 symbol_type_string = {0};
|
||||
if(row->procedure != 0)
|
||||
{
|
||||
symbol_name.str = rdi_name_from_procedure(row->rdi, row->procedure, &symbol_name.size);
|
||||
RDI_TypeNode *type = rdi_element_from_name_idx(row->rdi, TypeNodes, row->procedure->type_idx);
|
||||
symbol_type_string = tg_string_from_key(scratch.arena, graph, row->rdi, tg_key_ext(tg_kind_from_rdi_type_kind(type->kind), row->procedure->type_idx));
|
||||
symbol_type_string = e_type_string_from_key(scratch.arena, e_type_key_ext(e_type_kind_from_rdi(type->kind), row->procedure->type_idx, e_idx_from_rdi(row->rdi)));
|
||||
}
|
||||
if(row->inline_site != 0)
|
||||
{
|
||||
symbol_name.str = rdi_string_from_idx(row->rdi, row->inline_site->name_string_idx, &symbol_name.size);
|
||||
RDI_TypeNode *type = rdi_element_from_name_idx(row->rdi, TypeNodes, row->inline_site->type_idx);
|
||||
symbol_type_string = tg_string_from_key(scratch.arena, graph, row->rdi, tg_key_ext(tg_kind_from_rdi_type_kind(type->kind), row->inline_site->type_idx));
|
||||
symbol_type_string = e_type_string_from_key(scratch.arena, e_type_key_ext(e_type_kind_from_rdi(type->kind), row->inline_site->type_idx, e_idx_from_rdi(row->rdi)));
|
||||
}
|
||||
|
||||
// rjf: build row
|
||||
@@ -5840,8 +5785,8 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
|
||||
UI_FocusHot((row_selected && cs->cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
{
|
||||
String8 selected_string = {0};
|
||||
if(ctrl_ctx.unwind_count == row->unwind_idx &&
|
||||
ctrl_ctx.inline_depth == row->inline_depth)
|
||||
if(df_interact_regs()->unwind_count == row->unwind_idx &&
|
||||
df_interact_regs()->inline_depth == row->inline_depth)
|
||||
{
|
||||
selected_string = df_g_icon_kind_text_table[DF_IconKind_RightArrow];
|
||||
ui_set_next_palette(ui_build_palette(ui_top_palette(), .text = thread_color));
|
||||
@@ -7259,8 +7204,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
//////////////////////////////
|
||||
//- rjf: unpack entity params
|
||||
//
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
|
||||
//////////////////////////////
|
||||
@@ -7586,6 +7530,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
|
||||
//- rjf: fill local variable annotations
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Vec4F32 color_gen_table[] =
|
||||
{
|
||||
df_rgba_from_theme_color(DF_ThemeColor_Thread0),
|
||||
@@ -7597,19 +7542,16 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
df_rgba_from_theme_color(DF_ThemeColor_Thread6),
|
||||
df_rgba_from_theme_color(DF_ThemeColor_Thread7),
|
||||
};
|
||||
DI_Scope *scope = di_scope_open();
|
||||
U64 thread_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(scope, process, thread_rip_vaddr);
|
||||
RDI_Parsed *rdi = parse_ctx.rdi;
|
||||
for(EVAL_String2NumMapNode *n = parse_ctx.locals_map->first; n != 0; n = n->order_next)
|
||||
U64 thread_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, df_interact_regs()->unwind_count);
|
||||
for(E_String2NumMapNode *n = e_ctx()->locals_map->first; n != 0; n = n->order_next)
|
||||
{
|
||||
String8 local_name = n->string;
|
||||
DF_Eval local_eval = df_eval_from_string(scratch.arena, scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, local_name);
|
||||
if(local_eval.mode == EVAL_EvalMode_Addr)
|
||||
E_Eval local_eval = e_eval_from_string(scratch.arena, local_name);
|
||||
if(local_eval.mode == E_Mode_Addr)
|
||||
{
|
||||
TG_Kind local_eval_type_kind = tg_kind_from_key(local_eval.type_key);
|
||||
U64 local_eval_type_size = tg_byte_size_from_graph_rdi_key(parse_ctx.type_graph, rdi, local_eval.type_key);
|
||||
Rng1U64 vaddr_rng = r1u64(local_eval.offset, local_eval.offset+local_eval_type_size);
|
||||
E_TypeKind local_eval_type_kind = e_type_kind_from_key(local_eval.type_key);
|
||||
U64 local_eval_type_size = e_type_byte_size_from_key(local_eval.type_key);
|
||||
Rng1U64 vaddr_rng = r1u64(local_eval.value.u64, local_eval.value.u64+local_eval_type_size);
|
||||
Rng1U64 vaddr_rng_in_visible = intersect_1u64(viz_range_bytes, vaddr_rng);
|
||||
if(vaddr_rng_in_visible.max != vaddr_rng_in_visible.min)
|
||||
{
|
||||
@@ -7617,7 +7559,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
{
|
||||
annotation->name_string = push_str8_copy(scratch.arena, local_name);
|
||||
annotation->kind_string = str8_lit("Local");
|
||||
annotation->type_string = tg_string_from_key(scratch.arena, parse_ctx.type_graph, parse_ctx.rdi, local_eval.type_key);
|
||||
annotation->type_string = e_type_string_from_key(scratch.arena, local_eval.type_key);
|
||||
annotation->color = color_gen_table[(vaddr_rng.min/8)%ArrayCount(color_gen_table)];
|
||||
annotation->vaddr_range = vaddr_rng;
|
||||
}
|
||||
|
||||
@@ -555,13 +555,13 @@ internal DF_WatchViewPoint df_watch_view_point_from_tbl(DF_EvalVizBlockList *blo
|
||||
internal Vec2S64 df_tbl_from_watch_view_point(DF_EvalVizBlockList *blocks, DF_WatchViewPoint pt);
|
||||
|
||||
//- rjf: table coordinates -> strings
|
||||
internal String8 df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalView *ev, TG_Graph *graph, RDI_Parsed *rdi, DF_EvalVizRow *row, DF_WatchViewColumnKind col_kind, B32 editable);
|
||||
internal String8 df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalView *ev, DF_EvalVizRow *row, DF_WatchViewColumnKind col_kind, B32 editable);
|
||||
|
||||
//- rjf: table coordinates -> text edit state
|
||||
internal DF_WatchViewTextEditState *df_watch_view_text_edit_state_from_pt(DF_WatchViewState *wv, DF_WatchViewPoint pt);
|
||||
|
||||
//- rjf: windowed watch tree visualization
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, FZY_Scope *fzy_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews);
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, FZY_Scope *fzy_scope, DF_View *view, DF_WatchViewState *ews);
|
||||
|
||||
//- rjf: eval/watch views main hooks
|
||||
internal void df_watch_view_init(DF_WatchViewState *ewv, DF_View *view, DF_WatchViewFillKind fill_kind);
|
||||
|
||||
Reference in New Issue
Block a user