Skip to content

Commit

Permalink
rd: eliminate old entity code pertaining to mirroring ctrl entities -…
Browse files Browse the repository at this point in the history
… we just use ctrl entities directly now, and rd entities are just used for frontend debugger state
  • Loading branch information
ryanfleury committed Jan 7, 2025
1 parent 64aa068 commit ee9961c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 161 deletions.
17 changes: 0 additions & 17 deletions src/dbg_engine/dbg_engine_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1689,23 +1689,6 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
log_user_error(str8_zero());
}

// rjf: kill all entities which are marked to die on stop
{
RD_Entity *request = rd_entity_from_id(event->msg_id);
if(rd_entity_is_nil(request))
{
for(RD_Entity *entity = rd_entity_root();
!rd_entity_is_nil(entity);
entity = rd_entity_rec_depth_first_pre(entity, rd_entity_root()).next)
{
if(entity->flags & RD_EntityFlag_DiesOnRunStop)
{
rd_entity_mark_for_deletion(entity);
}
}
}
}

// rjf: gather stop info
{
arena_clear(d_state->ctrl_stop_arena);
Expand Down
82 changes: 2 additions & 80 deletions src/raddbg/raddbg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,35 +444,6 @@ rd_parent_ev_key_from_entity(RD_Entity *entity)
return parent_key;
}

//- rjf: entity -> evaluation

internal RD_EntityEval *
rd_eval_from_entity(Arena *arena, RD_Entity *entity)
{
RD_EntityEval *eval = push_array(arena, RD_EntityEval, 1);
{
RD_Entity *loc = rd_entity_child_from_kind(entity, RD_EntityKind_Location);
RD_Entity *cnd = rd_entity_child_from_kind(entity, RD_EntityKind_Condition);
String8 label_string = push_str8_copy(arena, entity->string);
String8 loc_string = {0};
if(loc->flags & RD_EntityFlag_HasTextPoint)
{
loc_string = push_str8f(arena, "%S:%I64u:%I64u", loc->string, loc->text_point.line, loc->text_point.column);
}
else if(loc->flags & RD_EntityFlag_HasVAddr)
{
loc_string = push_str8f(arena, "0x%I64x", loc->vaddr);
}
String8 cnd_string = push_str8_copy(arena, cnd->string);
eval->enabled = !entity->disabled;
eval->hit_count = entity->u64;
eval->label_off = (U64)((U8 *)label_string.str - (U8 *)eval);
eval->location_off = (U64)((U8 *)loc_string.str - (U8 *)eval);
eval->condition_off= (U64)((U8 *)cnd_string.str - (U8 *)eval);
}
return eval;
}

////////////////////////////////
//~ rjf: View Type Functions

Expand Down Expand Up @@ -1362,14 +1333,6 @@ rd_entity_equip_txt_pt(RD_Entity *entity, TxtPt point)
entity->flags |= RD_EntityFlag_HasTextPoint;
}

internal void
rd_entity_equip_entity_handle(RD_Entity *entity, RD_Handle handle)
{
rd_require_entity_nonnil(entity, return);
entity->entity_handle = handle;
entity->flags |= RD_EntityFlag_HasEntityHandle;
}

internal void
rd_entity_equip_disabled(RD_Entity *entity, B32 value)
{
Expand Down Expand Up @@ -1419,46 +1382,6 @@ rd_entity_equip_timestamp(RD_Entity *entity, U64 timestamp)

//- rjf: control layer correllation equipment

internal void
rd_entity_equip_ctrl_handle(RD_Entity *entity, CTRL_Handle handle)
{
rd_require_entity_nonnil(entity, return);
entity->ctrl_handle = handle;
entity->flags |= RD_EntityFlag_HasCtrlHandle;
}

internal void
rd_entity_equip_arch(RD_Entity *entity, Arch arch)
{
rd_require_entity_nonnil(entity, return);
entity->arch = arch;
entity->flags |= RD_EntityFlag_HasArch;
}

internal void
rd_entity_equip_ctrl_id(RD_Entity *entity, U32 id)
{
rd_require_entity_nonnil(entity, return);
entity->ctrl_id = id;
entity->flags |= RD_EntityFlag_HasCtrlID;
}

internal void
rd_entity_equip_stack_base(RD_Entity *entity, U64 stack_base)
{
rd_require_entity_nonnil(entity, return);
entity->stack_base = stack_base;
entity->flags |= RD_EntityFlag_HasStackBase;
}

internal void
rd_entity_equip_vaddr_rng(RD_Entity *entity, Rng1U64 range)
{
rd_require_entity_nonnil(entity, return);
entity->vaddr_rng = range;
entity->flags |= RD_EntityFlag_HasVAddrRng;
}

internal void
rd_entity_equip_vaddr(RD_Entity *entity, U64 vaddr)
{
Expand Down Expand Up @@ -15232,10 +15155,9 @@ rd_frame(void)
if(src_n->flags & RD_EntityFlag_HasTextPoint) {rd_entity_equip_txt_pt(dst_n, src_n->text_point);}
if(src_n->flags & RD_EntityFlag_HasU64) {rd_entity_equip_u64(dst_n, src_n->u64);}
if(src_n->flags & RD_EntityFlag_HasColor) {rd_entity_equip_color_hsva(dst_n, rd_hsva_from_entity(src_n));}
if(src_n->flags & RD_EntityFlag_HasVAddrRng) {rd_entity_equip_vaddr_rng(dst_n, src_n->vaddr_rng);}
if(src_n->flags & RD_EntityFlag_HasVAddr) {rd_entity_equip_vaddr(dst_n, src_n->vaddr);}
if(src_n->disabled) {rd_entity_equip_disabled(dst_n, 1);}
if(src_n->string.size != 0) {rd_entity_equip_name(dst_n, src_n->string);}
if(src_n->disabled) {rd_entity_equip_disabled(dst_n, 1);}
if(src_n->string.size != 0) {rd_entity_equip_name(dst_n, src_n->string);}
dst_n->cfg_src = src_n->cfg_src;
for(RD_Entity *src_child = task->src_n->first; !rd_entity_is_nil(src_child); src_child = src_child->next)
{
Expand Down
64 changes: 2 additions & 62 deletions src/raddbg/raddbg_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,8 @@ enum
RD_EntityFlag_HasEntityHandle = (1<<2),
RD_EntityFlag_HasU64 = (1<<4),
RD_EntityFlag_HasColor = (1<<6),
RD_EntityFlag_DiesOnRunStop = (1<<8),

//- rjf: ctrl entity equipment
RD_EntityFlag_HasCtrlHandle = (1<<9),
RD_EntityFlag_HasArch = (1<<10),
RD_EntityFlag_HasCtrlID = (1<<11),
RD_EntityFlag_HasStackBase = (1<<12),
RD_EntityFlag_HasTLSRoot = (1<<13),
RD_EntityFlag_HasVAddrRng = (1<<14),
RD_EntityFlag_HasVAddr = (1<<15),

//- rjf: file properties
RD_EntityFlag_IsFolder = (1<<16),
RD_EntityFlag_IsMissing = (1<<17),

//- rjf: deletion
RD_EntityFlag_MarkedForDeletion = (1<<31),
};
Expand Down Expand Up @@ -413,22 +400,14 @@ struct RD_Entity

// rjf: basic equipment
TxtPt text_point;
RD_Handle entity_handle;
B32 disabled;
B32 debug_subprocesses;
U64 u64;
U64 u64;
U64 vaddr;
Vec4F32 color_hsva;
RD_CfgSrc cfg_src;
U64 timestamp;

// rjf: ctrl equipment
CTRL_Handle ctrl_handle;
Arch arch;
U32 ctrl_id;
U64 stack_base;
Rng1U64 vaddr_rng;
U64 vaddr;

// rjf: string equipment
String8 string;

Expand Down Expand Up @@ -467,36 +446,6 @@ struct RD_EntityRec
S32 pop_count;
};

////////////////////////////////
//~ rjf: Entity Evaluation Types

typedef struct RD_EntityEval RD_EntityEval;
struct RD_EntityEval
{
B64 enabled;
U64 hit_count;
U64 label_off;
U64 location_off;
U64 condition_off;
};

////////////////////////////////
//~ rjf: Entity Fuzzy Listing Types

typedef struct RD_EntityFuzzyItem RD_EntityFuzzyItem;
struct RD_EntityFuzzyItem
{
RD_Entity *entity;
FuzzyMatchRangeList matches;
};

typedef struct RD_EntityFuzzyItemArray RD_EntityFuzzyItemArray;
struct RD_EntityFuzzyItemArray
{
RD_EntityFuzzyItem *v;
U64 count;
};

////////////////////////////////
//~ rjf: Command Types

Expand Down Expand Up @@ -1082,9 +1031,6 @@ internal Vec4F32 rd_rgba_from_entity(RD_Entity *entity);
internal EV_Key rd_ev_key_from_entity(RD_Entity *entity);
internal EV_Key rd_parent_ev_key_from_entity(RD_Entity *entity);

//- rjf: entity -> evaluation
internal RD_EntityEval *rd_eval_from_entity(Arena *arena, RD_Entity *entity);

////////////////////////////////
//~ rjf: View Type Functions

Expand Down Expand Up @@ -1174,7 +1120,6 @@ internal RD_Entity *rd_entity_child_from_kind_or_alloc(RD_Entity *entity, RD_Ent

//- rjf: entity simple equipment
internal void rd_entity_equip_txt_pt(RD_Entity *entity, TxtPt point);
internal void rd_entity_equip_entity_handle(RD_Entity *entity, RD_Handle handle);
internal void rd_entity_equip_disabled(RD_Entity *entity, B32 b32);
internal void rd_entity_equip_u64(RD_Entity *entity, U64 u64);
internal void rd_entity_equip_color_rgba(RD_Entity *entity, Vec4F32 rgba);
Expand All @@ -1183,11 +1128,6 @@ internal void rd_entity_equip_cfg_src(RD_Entity *entity, RD_CfgSrc cfg_src);
internal void rd_entity_equip_timestamp(RD_Entity *entity, U64 timestamp);

//- rjf: control layer correllation equipment
internal void rd_entity_equip_ctrl_handle(RD_Entity *entity, CTRL_Handle handle);
internal void rd_entity_equip_arch(RD_Entity *entity, Arch arch);
internal void rd_entity_equip_ctrl_id(RD_Entity *entity, U32 id);
internal void rd_entity_equip_stack_base(RD_Entity *entity, U64 stack_base);
internal void rd_entity_equip_vaddr_rng(RD_Entity *entity, Rng1U64 range);
internal void rd_entity_equip_vaddr(RD_Entity *entity, U64 vaddr);

//- rjf: name equipment
Expand Down
3 changes: 1 addition & 2 deletions src/raddbg/raddbg_views.c
Original file line number Diff line number Diff line change
Expand Up @@ -4895,7 +4895,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(entity_lister)
RD_Window *window = rd_window_from_handle(rd_regs()->window);
RD_CmdKindInfo *cmd_kind_info = rd_cmd_kind_info_from_string(window->query_cmd_name);
RD_EntityKind entity_kind = cmd_kind_info->query.entity_kind;
RD_EntityFlags entity_flags_omit = RD_EntityFlag_IsFolder;
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
F32 scroll_bar_dim = floor_f32(ui_top_font_size()*1.5f);

Expand All @@ -4911,7 +4910,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(entity_lister)
RD_Entity *selected_entity = rd_entity_from_handle(selected_entity_handle);

//- rjf: build filtered array of entities
RD_EntityListerItemList ent_list = rd_entity_lister_item_list_from_needle(scratch.arena, entity_kind, entity_flags_omit, string);
RD_EntityListerItemList ent_list = rd_entity_lister_item_list_from_needle(scratch.arena, entity_kind, 0, string);
RD_EntityListerItemArray ent_arr = rd_entity_lister_item_array_from_list(scratch.arena, ent_list);
rd_entity_lister_item_array_sort_by_strength__in_place(ent_arr);

Expand Down

0 comments on commit ee9961c

Please sign in to comment.