mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 05:18:40 +00:00
sketch out tline -> vline text wrapping cache types; first pass of async call stack tree builder
This commit is contained in:
@@ -424,7 +424,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[24] =
|
||||
{str8_lit_comp("window"), str8_lit_comp("x:\n{\n //- rjf: text rasterization settings\n @default(1) @display_name('Smooth UI Text') @description(\"Controls whether or not UI text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_ui_text': bool,\n @default(1) @display_name('Hint UI Text') @description(\"Controls whether or not UI text is hinted, for better text readability at small sizes.\")\n 'hint_ui_text': bool,\n @default(0) @display_name('Smooth Code Text') @description(\"Controls whether or not code text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_code_text': bool,\n @default(1) @display_name('Hint Code Text') @description(\"Controls whether or not code text is hinted, for better text readability at small sizes.\")\n 'hint_code_text': bool,\n @default(11) @display_name('Window Font Size') @description(\"Controls the window's default font size. Does not apply to tabs with their own font size set.\")\n 'font_size': @range[6, 72] u64,\n\n //- rjf: size settings\n @default(3.f) @display_name('Window Row Height') @description(\"Controls the window's default row height, in multiples of the font size. Does not apply to tabs with their own row height set.\")\n 'row_height': @range[1.75f, 5.f] f32,\n @default(3.f) @description(\"Controls the height of tabs, in multiples of the font size.\")\n 'tab_height': @range[1.75f, 5.f] f32,\n\n //- rjf: theme settings\n @default(1) @display_name('Use Project Theme') @description(\"Prefer using the project theme for this window, if any. If off, only the user's theme settings will be used.\")\n 'use_project_theme': bool,\n}\n")},
|
||||
{str8_lit_comp("tab"), str8_lit_comp("@row_commands(@file copy_tab_full_path, @file show_file_in_explorer, duplicate_tab, close_tab)\nx:\n{\n @override @display_name('Tab Font Size') @description(\"Controls the tab's font size.\") @no_callee_helper\n 'font_size': @range[6, 72] u64,\n}\n")},
|
||||
{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) @expand_commands(@output clear_output) 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("text"), str8_lit_comp("@inherit(tab) @expand_commands(@output clear_output) 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(1) @display_name('Line Wrapping') @description(\"Splits textual lines into multiple visual lines, so that all text is within the visible area.\")\n 'line_wrapping': 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}\n")},
|
||||
{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the base address of 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 @default(1) @display_name(\"Track Mark To Cursor\") @description(\"Ensures that the mark always follows the cursor, if the cursor value is updated.\")\n 'track_mark_to_cursor': bool,\n}\n")},
|
||||
{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the base address of 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")},
|
||||
|
||||
@@ -481,8 +481,10 @@ RD_VocabTable:
|
||||
'lang': code_string,
|
||||
@default(1) @description("Controls whether or not line numbers are shown.")
|
||||
'show_line_numbers':bool,
|
||||
@no_callee_helper @default(1) @display_name('Line Wrapping') @description("Splits textual lines into multiple visual lines, so that all text is within the visible area.")
|
||||
'line_wrapping': bool,
|
||||
@no_callee_helper @default(0) @display_name('Scroll To Bottom On Change') @description("Scrolls to the bottom if the text is changed.")
|
||||
'scroll_to_bottom_on_change':bool,
|
||||
'scroll_to_bottom_on_change': bool,
|
||||
@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.")
|
||||
'auto': bool,
|
||||
}
|
||||
|
||||
@@ -1817,7 +1817,7 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
|
||||
case CTRL_EntityKind_Thread:
|
||||
{
|
||||
CTRL_Scope *ctrl_scope = ctrl_scope_open();
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, entity, 1, rd_state->frame_eval_memread_endt_us);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, entity->handle, 1, rd_state->frame_eval_memread_endt_us);
|
||||
U64 concrete_frame_idx = e_interpret_ctx->reg_unwind_count;
|
||||
if(concrete_frame_idx < call_stack.concrete_frames_count)
|
||||
{
|
||||
@@ -6469,7 +6469,7 @@ rd_window_frame(void)
|
||||
Vec4F32 symbol_color = ui_color_from_name(str8_lit("code_symbol"));
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(ctrl_entity, CTRL_EntityKind_Process);
|
||||
B32 call_stack_high_priority = ctrl_handle_match(ctrl_entity->handle, rd_base_regs()->thread);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, ctrl_entity, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, ctrl_entity->handle, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
if(call_stack.frames_count != 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
@@ -16231,7 +16231,7 @@ rd_frame(void)
|
||||
{
|
||||
CTRL_Scope *ctrl_scope = ctrl_scope_open();
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_base_regs()->thread);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, thread, 1, os_now_microseconds()+10000);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, thread->handle, 1, os_now_microseconds()+10000);
|
||||
CTRL_CallStackFrame *frame = ctrl_call_stack_frame_from_unwind_and_inline_depth(&call_stack, rd_regs()->unwind_count, rd_regs()->inline_depth);
|
||||
if(frame == 0)
|
||||
{
|
||||
@@ -16250,7 +16250,7 @@ rd_frame(void)
|
||||
{
|
||||
CTRL_Scope *ctrl_scope = ctrl_scope_open();
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_base_regs()->thread);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, thread, 1, os_now_microseconds()+10000);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, thread->handle, 1, os_now_microseconds()+10000);
|
||||
CTRL_CallStackFrame *current_frame = ctrl_call_stack_frame_from_unwind_and_inline_depth(&call_stack, rd_regs()->unwind_count, rd_regs()->inline_depth);
|
||||
CTRL_CallStackFrame *next_frame = current_frame;
|
||||
if(current_frame != 0) switch(kind)
|
||||
|
||||
@@ -968,7 +968,7 @@ E_TYPE_IREXT_FUNCTION_DEF(call_stack)
|
||||
B32 call_stack_high_priority = ctrl_handle_match(entity->handle, rd_base_regs()->thread);
|
||||
accel->arch = entity->arch;
|
||||
accel->process = ctrl_process_from_entity(entity)->handle;
|
||||
accel->call_stack = ctrl_call_stack_from_thread(rd_state->frame_ctrl_scope, &d_state->ctrl_entity_store->ctx, entity, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
accel->call_stack = ctrl_call_stack_from_thread(rd_state->frame_ctrl_scope, entity->handle, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
@@ -1538,6 +1538,19 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(ctrl_entities)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Call Stack Tree Type Hooks
|
||||
|
||||
E_TYPE_EXPAND_INFO_FUNCTION_DEF(call_stack_tree)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
E_TYPE_EXPAND_RANGE_FUNCTION_DEF(call_stack_tree)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Tables Eval Hooks
|
||||
|
||||
|
||||
@@ -100,6 +100,12 @@ E_TYPE_ACCESS_FUNCTION_DEF(ctrl_entities);
|
||||
E_TYPE_EXPAND_INFO_FUNCTION_DEF(ctrl_entities);
|
||||
E_TYPE_EXPAND_RANGE_FUNCTION_DEF(ctrl_entities);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Call Stack Tree Type Hooks
|
||||
|
||||
E_TYPE_EXPAND_INFO_FUNCTION_DEF(call_stack_tree);
|
||||
E_TYPE_EXPAND_RANGE_FUNCTION_DEF(call_stack_tree);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Tables Eval Hooks
|
||||
|
||||
|
||||
@@ -104,6 +104,21 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: set up wrap cache
|
||||
//
|
||||
if(cv->wrap_arena == 0)
|
||||
{
|
||||
cv->wrap_arena = rd_push_view_arena();
|
||||
}
|
||||
if(cv->wrap_total_vline_count == 0)
|
||||
{
|
||||
arena_clear(cv->wrap_arena);
|
||||
cv->wrap_total_vline_count = text_info->lines_count;
|
||||
cv->wrap_cache_slots_count = text_info->lines_count/64;
|
||||
cv->wrap_cache_slots = push_array(cv->wrap_arena, RD_CodeViewTLineWrapCacheSlot, cv->wrap_cache_slots_count);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: determine visible line range / count
|
||||
//
|
||||
@@ -1015,7 +1030,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
info.callstack_thread = entity;
|
||||
U64 frame_num = ev_block_num_from_id(block, key.child_id);
|
||||
B32 call_stack_high_priority = ctrl_handle_match(entity->handle, rd_base_regs()->thread);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, entity, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, entity->handle, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
if(1 <= frame_num && frame_num <= call_stack.frames_count)
|
||||
{
|
||||
CTRL_CallStackFrame *f = &call_stack.frames[frame_num-1];
|
||||
@@ -2924,7 +2939,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
CTRL_Scope *ctrl_scope = ctrl_scope_open();
|
||||
CTRL_Entity *selected_thread = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
CTRL_Entity *selected_process = ctrl_entity_ancestor_from_kind(selected_thread, CTRL_EntityKind_Process);
|
||||
CTRL_CallStack selected_call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, selected_thread, 1, 0);
|
||||
CTRL_CallStack selected_call_stack = ctrl_call_stack_from_thread(ctrl_scope, selected_thread->handle, 1, 0);
|
||||
CTRL_Entity *eval_process = &ctrl_entity_nil;
|
||||
if(eval.space.kind == RD_EvalSpaceKind_CtrlEntity)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,30 @@ enum
|
||||
RD_CodeViewBuildFlag_All = 0xffffffff,
|
||||
};
|
||||
|
||||
typedef struct RD_CodeViewTLineSplitNode RD_CodeViewTLineSplitNode;
|
||||
struct RD_CodeViewTLineSplitNode
|
||||
{
|
||||
RD_CodeViewTLineSplitNode *next;
|
||||
U64 off;
|
||||
};
|
||||
|
||||
typedef struct RD_CodeViewTLineWrapCacheNode RD_CodeViewTLineWrapCacheNode;
|
||||
struct RD_CodeViewTLineWrapCacheNode
|
||||
{
|
||||
RD_CodeViewTLineWrapCacheNode *hash_next;
|
||||
RD_CodeViewTLineWrapCacheNode *hash_prev;
|
||||
S64 line_num;
|
||||
RD_CodeViewTLineSplitNode *first_split;
|
||||
RD_CodeViewTLineSplitNode *last_split;
|
||||
};
|
||||
|
||||
typedef struct RD_CodeViewTLineWrapCacheSlot RD_CodeViewTLineWrapCacheSlot;
|
||||
struct RD_CodeViewTLineWrapCacheSlot
|
||||
{
|
||||
RD_CodeViewTLineWrapCacheNode *first;
|
||||
RD_CodeViewTLineWrapCacheNode *last;
|
||||
};
|
||||
|
||||
typedef struct RD_CodeViewState RD_CodeViewState;
|
||||
struct RD_CodeViewState
|
||||
{
|
||||
@@ -32,6 +56,12 @@ struct RD_CodeViewState
|
||||
Arena *find_text_arena;
|
||||
String8 find_text_fwd;
|
||||
String8 find_text_bwd;
|
||||
|
||||
// rjf: line wrapping cache & info
|
||||
Arena *wrap_arena;
|
||||
RD_CodeViewTLineWrapCacheSlot *wrap_cache_slots;
|
||||
U64 wrap_cache_slots_count;
|
||||
U64 wrap_total_vline_count;
|
||||
};
|
||||
|
||||
typedef struct RD_CodeViewBuildResult RD_CodeViewBuildResult;
|
||||
|
||||
@@ -552,7 +552,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(entity, CTRL_EntityKind_Process);
|
||||
Arch arch = entity->arch;
|
||||
B32 call_stack_high_priority = ctrl_handle_match(entity->handle, rd_base_regs()->thread);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, entity, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, entity->handle, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
|
||||
B32 did_first_known = 0;
|
||||
for(U64 idx = 0, limit = 10;
|
||||
idx < call_stack.frames_count && idx < limit;
|
||||
|
||||
Reference in New Issue
Block a user