mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-20 15:36:47 +00:00
preserve whole chain of parent irtrees, do not simply apply only to autohook overrides; straighten out some event consumption weirdness in interaction between autocompletion floating view & query floating view; ensure we mark the cfg space as dirty when modifying strings
This commit is contained in:
+7
-4
@@ -1602,11 +1602,14 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
if(qualifier.size == 0 && !string_mapped && str8_match(string, str8_lit("$"), 0) && parent != 0 && (parent->root != &e_irnode_nil || parent->msgs.first != 0))
|
||||
{
|
||||
E_IRTreeAndType *parent_irtree = parent;
|
||||
if(disallow_autohooks)
|
||||
{
|
||||
for(E_IRTreeAndType *prev = parent_irtree->prev; prev != 0; prev = prev->prev)
|
||||
for(E_IRTreeAndType *prev = parent_irtree; prev != 0; prev = prev->prev)
|
||||
{
|
||||
parent_irtree = prev;
|
||||
if(prev->root != &e_irnode_nil)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
E_OpList oplist = e_oplist_from_irtree(arena, parent_irtree->root);
|
||||
@@ -2331,10 +2334,10 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
}
|
||||
|
||||
//- rjf: equip previous task's irtree
|
||||
if(t->overridden != 0)
|
||||
if(parent != 0)
|
||||
{
|
||||
result.prev = push_array(arena, E_IRTreeAndType, 1);
|
||||
result.prev[0] = *t->overridden;
|
||||
result.prev[0] = *parent;
|
||||
}
|
||||
|
||||
//- rjf: find any auto hooks according to this generation's type
|
||||
|
||||
@@ -417,8 +417,8 @@ RD_NameSchemaInfo rd_name_schema_info_table[24] =
|
||||
{str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @override @display_name('Tab Row Height') @description(\"Controls the tab's row height, in multiples of the font size.\")\n 'row_height': @range[1.75f, 5.f] f32,\n 'label': code_string,\n @description(\"The root expression which is evaluated to produce the watch window.\")\n 'expression': expr_string,\n @no_expand 'watches': query,\n}\n")},
|
||||
{str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': expr_string,\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': code_string,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @no_callee_helper @default(0) @display_name('Scroll To Bottom On Change') @description(\"Scrolls to the bottom if the text is changed.\")\n 'scroll_to_bottom_on_change':bool,\n @no_callee_helper @no_revert @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n}\n")},
|
||||
{str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the disassembly.\")\n 'expression': expr_string,\n 'arch': code_string,\n 'syntax': code_string,\n 'size': expr_string,\n @no_callee_helper @default(1) @description(\"Controls whether or not addresses are shown in the disassembly text.\")\n 'show_addresses': bool,\n @no_callee_helper @default(0) @description(\"Controls whether or not code bytes are shown in the disassembly text.\")\n 'show_code_bytes': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not source lines, corresponding to disassembly instruction ranges, are shown in the disassembly text.\")\n 'show_source_lines': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not disassembly text is decorated with symbol names.\")\n 'show_symbol_names': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers': bool,\n}\n")},
|
||||
{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Base Address\") @description(\"An expression to describe the base address or offset of the memory view.\")\n 'expression': expr_string,\n @display_name(\"Address Range Size\") @description(\"The number of bytes of the viewed memory range.\")\n 'size': expr_string,\n @display_name(\"Cursor Address\") @description(\"The address of the cursor.\")\n 'cursor': expr_string,\n @display_name(\"Cursor Size\") @description(\"The size, in bytes, of the cursor.\")\n 'cursor_size': @range[1, 16] u64,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n}\n")},
|
||||
{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Base Pointer\") @description(\"An expression to describe the base address or offset of the bitmap data.\")\n 'expression': expr_string,\n @description(\"An expression describing the width of the bitmap, in pixels.\") @order(0) 'w': u64,\n @description(\"An expression describing the height of the bitmap, in pixels.\") @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': code_string,\n}\n")},
|
||||
{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the data which should be viewed as memory.\")\n 'expression': expr_string,\n @display_name(\"Address Range Size\") @description(\"The number of bytes of the viewed memory range.\")\n 'size': expr_string,\n @display_name(\"Cursor Address\") @description(\"The address of the cursor.\")\n 'cursor': expr_string,\n @display_name(\"Cursor Size\") @description(\"The size, in bytes, of the cursor.\")\n 'cursor_size': @range[1, 16] u64,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n}\n")},
|
||||
{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the data which should be viewed as a bitmap.\")\n 'expression': expr_string,\n @description(\"An expression describing the width of the bitmap, in pixels.\") @order(0) 'w': u64,\n @description(\"An expression describing the height of the bitmap, in pixels.\") @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': code_string,\n}\n")},
|
||||
{str8_lit_comp("color"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Value\") @description(\"An expression to describe the value or location of the color.\")\n 'expression': expr_string,\n}\n")},
|
||||
{str8_lit_comp("geo3d"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Expression\") @description(\"An expression to describe the base address of the index buffer.\")\n 'expression': expr_string,\n 'count': expr_string,\n 'vtx': expr_string,\n 'vtx_size': expr_string,\n 'yaw': @range[0, 1] f32,\n 'pitch': @range[-0.5, 0] f32,\n 'zoom': @range[0, 100] f32,\n}\n")},
|
||||
{str8_lit_comp("getting_started"), str8_lit_comp("@inherit(tab) x:\n{\n}\n")},
|
||||
|
||||
@@ -503,7 +503,7 @@ RD_VocabTable:
|
||||
```
|
||||
@inherit(tab) x:
|
||||
{
|
||||
@display_name("Base Address") @description("An expression to describe the base address or offset of the memory view.")
|
||||
@description("An expression which refers to the data which should be viewed as memory.")
|
||||
'expression': expr_string,
|
||||
@display_name("Address Range Size") @description("The number of bytes of the viewed memory range.")
|
||||
'size': expr_string,
|
||||
@@ -521,7 +521,7 @@ RD_VocabTable:
|
||||
```
|
||||
@inherit(tab) x:
|
||||
{
|
||||
@display_name("Base Pointer") @description("An expression to describe the base address or offset of the bitmap data.")
|
||||
@description("An expression which refers to the data which should be viewed as a bitmap.")
|
||||
'expression': expr_string,
|
||||
@description("An expression describing the width of the bitmap, in pixels.") @order(0) 'w': u64,
|
||||
@description("An expression describing the height of the bitmap, in pixels.") @order(1) 'h': u64,
|
||||
|
||||
+99
-89
@@ -483,6 +483,7 @@ rd_cfg_equip_string(RD_Cfg *cfg, String8 string)
|
||||
{
|
||||
rd_name_release(cfg->string);
|
||||
cfg->string = rd_name_alloc(string);
|
||||
rd_state->cfg_change_gen += 1;
|
||||
}
|
||||
|
||||
internal void
|
||||
@@ -1847,10 +1848,15 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
|
||||
if(child_key.size != 0)
|
||||
{
|
||||
MD_NodePtrList schemas = rd_schemas_from_name(root_cfg->string);
|
||||
MD_Node *expr_child_schema = &md_nil_node;
|
||||
MD_Node *child_schema = &md_nil_node;
|
||||
for(MD_NodePtrNode *n = schemas.first; n != 0 && child_schema == &md_nil_node; n = n->next)
|
||||
{
|
||||
child_schema = md_child_from_string(n->v, child_key, 0);
|
||||
if(child_schema != &md_nil_node)
|
||||
{
|
||||
expr_child_schema = md_child_from_string(n->v, str8_lit("expression"), 0);
|
||||
}
|
||||
}
|
||||
String8 child_type_name = child_schema->first->string;
|
||||
if(str8_match(child_type_name, str8_lit("path"), 0) ||
|
||||
@@ -1885,25 +1891,33 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(str8_match(child_type_name, str8_lit("bool"), 0))
|
||||
E_Key parent_key = {0};
|
||||
if(expr_child_schema != &md_nil_node && child_schema != expr_child_schema)
|
||||
{
|
||||
B32 value = !!e_value_from_stringf("(bool)(%S)", value_string).u64;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
parent_key = e_key_from_string(rd_cfg_child_from_string(root_cfg, expr_child_schema->string)->first->string);
|
||||
}
|
||||
else if(str8_match(child_type_name, str8_lit("u64"), 0))
|
||||
E_ParentKey(parent_key)
|
||||
{
|
||||
U64 value = e_value_from_stringf("(uint64)(%S)", value_string).u64;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
}
|
||||
else if(str8_match(child_type_name, str8_lit("u32"), 0))
|
||||
{
|
||||
U64 value = e_value_from_stringf("(uint32)(%S)", value_string).u64;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
}
|
||||
else if(str8_match(child_type_name, str8_lit("f32"), 0))
|
||||
{
|
||||
F32 value = e_value_from_stringf("(float32)(%S)", value_string).f32;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
if(str8_match(child_type_name, str8_lit("bool"), 0))
|
||||
{
|
||||
B32 value = !!e_value_from_stringf("(bool)(%S)", value_string).u64;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
}
|
||||
else if(str8_match(child_type_name, str8_lit("u64"), 0))
|
||||
{
|
||||
U64 value = e_value_from_stringf("(uint64)(%S)", value_string).u64;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
}
|
||||
else if(str8_match(child_type_name, str8_lit("u32"), 0))
|
||||
{
|
||||
U64 value = e_value_from_stringf("(uint32)(%S)", value_string).u64;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
}
|
||||
else if(str8_match(child_type_name, str8_lit("f32"), 0))
|
||||
{
|
||||
F32 value = e_value_from_stringf("(float32)(%S)", value_string).f32;
|
||||
read_data = push_str8_copy(scratch.arena, str8_struct(&value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3677,6 +3691,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
{
|
||||
B32 success = 0;
|
||||
success = rd_commit_eval_value_string(cell->eval, new_string);
|
||||
state_dirty = 1;
|
||||
if(!success)
|
||||
{
|
||||
log_user_error(str8_lit("Could not commit value successfully."));
|
||||
@@ -7394,87 +7409,82 @@ rd_window_frame(void)
|
||||
{
|
||||
UI_TagF("inactive") UI_Transparency(1-open_t) UI_Rect(content_rect) ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_Floating, ui_key_zero());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: @window_ui_part do special handling of floating view interactions
|
||||
//
|
||||
{
|
||||
//- rjf: autocompletion view early-closing rules
|
||||
if(autocomp_floating_view_task)
|
||||
{
|
||||
B32 has_autocomplete_hint = ui_autocomplete_string().size != 0;
|
||||
B32 has_accept_operation = 0;
|
||||
for(UI_Event *evt = 0; ui_next_event(&evt);)
|
||||
|
||||
//- rjf: autocompletion view early-closing rules
|
||||
if(t == autocomp_floating_view_task)
|
||||
{
|
||||
if(evt->kind == UI_EventKind_Press && evt->slot == UI_EventActionSlot_Accept)
|
||||
B32 has_autocomplete_hint = ui_autocomplete_string().size != 0;
|
||||
B32 has_accept_operation = 0;
|
||||
for(UI_Event *evt = 0; ui_next_event(&evt);)
|
||||
{
|
||||
has_accept_operation = 1;
|
||||
break;
|
||||
if(evt->kind == UI_EventKind_Press && evt->slot == UI_EventActionSlot_Accept)
|
||||
{
|
||||
has_accept_operation = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(has_autocomplete_hint && has_accept_operation)
|
||||
{
|
||||
autocomp_floating_view_task->signal.box->fixed_position = v2f32(10000, 10000);
|
||||
}
|
||||
}
|
||||
if(has_autocomplete_hint && has_accept_operation)
|
||||
{
|
||||
autocomp_floating_view_task->signal.box->fixed_position = v2f32(10000, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: hover eval focus rules
|
||||
if(hover_eval_floating_view_task)
|
||||
{
|
||||
UI_Signal sig = hover_eval_floating_view_task->signal;
|
||||
if(ui_pressed(sig) || hover_eval_floating_view_task->pressed)
|
||||
{
|
||||
ws->hover_eval_focused = 1;
|
||||
}
|
||||
if(ui_mouse_over(sig) || ws->hover_eval_focused)
|
||||
{
|
||||
ws->hover_eval_lastt_us = rd_state->time_in_us;
|
||||
}
|
||||
else if(ws->hover_eval_lastt_us+1000000 < rd_state->time_in_us)
|
||||
{
|
||||
rd_request_frame();
|
||||
}
|
||||
if(hover_eval_floating_view_task->pressed_outside || ui_slot_press(UI_EventActionSlot_Cancel))
|
||||
{
|
||||
ws->hover_eval_focused = 0;
|
||||
MemoryZeroStruct(&ws->hover_eval_string);
|
||||
arena_clear(ws->hover_eval_arena);
|
||||
rd_request_frame();
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: query interactions
|
||||
if(query_floating_view_task)
|
||||
{
|
||||
RD_Cfg *view = query_floating_view_task->view;
|
||||
RD_ViewState *vs = rd_view_state_from_cfg(query_floating_view_task->view);
|
||||
String8 cmd_name = ws->query_regs->cmd_name;
|
||||
RD_CmdKindInfo *cmd_kind_info = rd_cmd_kind_info_from_string(cmd_name);
|
||||
|
||||
// rjf: close queries
|
||||
if(query_floating_view_task->pressed_outside ||
|
||||
(rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg && !vs->query_is_open) ||
|
||||
(cmd_name.size != 0 && !vs->query_is_open) ||
|
||||
ui_slot_press(UI_EventActionSlot_Cancel))
|
||||
//- rjf: hover eval focus rules
|
||||
if(t == hover_eval_floating_view_task)
|
||||
{
|
||||
rd_cmd(RD_CmdKind_CancelQuery);
|
||||
}
|
||||
|
||||
// rjf: any queries which take a file path mutate the debugger's "current path"
|
||||
if(cmd_kind_info->query.slot == RD_RegSlot_FilePath)
|
||||
{
|
||||
RD_Cfg *query = rd_cfg_child_from_string(view, str8_lit("query"));
|
||||
RD_Cfg *input = rd_cfg_child_from_string(query, str8_lit("input"));
|
||||
if(input != &rd_nil_cfg)
|
||||
UI_Signal sig = hover_eval_floating_view_task->signal;
|
||||
if(ui_pressed(sig) || hover_eval_floating_view_task->pressed)
|
||||
{
|
||||
String8 path_chopped = str8_chop_last_slash(input->first->string);
|
||||
RD_Cfg *user = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"));
|
||||
RD_Cfg *current_path = rd_cfg_child_from_string_or_alloc(user, str8_lit("current_path"));
|
||||
if(!str8_match(current_path->first->string, path_chopped, 0))
|
||||
ws->hover_eval_focused = 1;
|
||||
}
|
||||
if(ui_mouse_over(sig) || ws->hover_eval_focused)
|
||||
{
|
||||
ws->hover_eval_lastt_us = rd_state->time_in_us;
|
||||
}
|
||||
else if(ws->hover_eval_lastt_us+1000000 < rd_state->time_in_us)
|
||||
{
|
||||
rd_request_frame();
|
||||
}
|
||||
if(hover_eval_floating_view_task->pressed_outside || ui_slot_press(UI_EventActionSlot_Cancel))
|
||||
{
|
||||
ws->hover_eval_focused = 0;
|
||||
MemoryZeroStruct(&ws->hover_eval_string);
|
||||
arena_clear(ws->hover_eval_arena);
|
||||
rd_request_frame();
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: query interactions
|
||||
if(t == query_floating_view_task)
|
||||
{
|
||||
RD_Cfg *view = query_floating_view_task->view;
|
||||
RD_ViewState *vs = rd_view_state_from_cfg(query_floating_view_task->view);
|
||||
String8 cmd_name = ws->query_regs->cmd_name;
|
||||
RD_CmdKindInfo *cmd_kind_info = rd_cmd_kind_info_from_string(cmd_name);
|
||||
|
||||
// rjf: close queries
|
||||
if(query_floating_view_task->pressed_outside ||
|
||||
(rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg && !vs->query_is_open) ||
|
||||
(cmd_name.size != 0 && !vs->query_is_open) ||
|
||||
ui_slot_press(UI_EventActionSlot_Cancel))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_CancelQuery);
|
||||
}
|
||||
|
||||
// rjf: any queries which take a file path mutate the debugger's "current path"
|
||||
if(cmd_kind_info->query.slot == RD_RegSlot_FilePath)
|
||||
{
|
||||
RD_Cfg *query = rd_cfg_child_from_string(view, str8_lit("query"));
|
||||
RD_Cfg *input = rd_cfg_child_from_string(query, str8_lit("input"));
|
||||
if(input != &rd_nil_cfg)
|
||||
{
|
||||
rd_cmd(RD_CmdKind_SetCurrentPath, .file_path = path_chopped);
|
||||
String8 path_chopped = str8_chop_last_slash(input->first->string);
|
||||
RD_Cfg *user = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"));
|
||||
RD_Cfg *current_path = rd_cfg_child_from_string_or_alloc(user, str8_lit("current_path"));
|
||||
if(!str8_match(current_path->first->string, path_chopped, 0))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_SetCurrentPath, .file_path = path_chopped);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user