reimplement run-to-line and run-to-address with temporary user breakpoints which die-on-stop, which provides the desired flow for e.g. run-to-line while nothing runs

This commit is contained in:
Ryan Fleury
2024-01-25 07:07:22 -08:00
parent ed7d31d7ea
commit 7cf0854178
7 changed files with 83 additions and 76 deletions
+43 -8
View File
@@ -1621,7 +1621,7 @@ df_entity_notify_mutation(DF_Entity *entity)
DF_CmdParams p = {0};
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_WriteProfileData));
}
if(e == entity && flags & DF_EntityKindFlag_LeafMutationSoftHalt)
if(e == entity && flags & DF_EntityKindFlag_LeafMutationSoftHalt && df_ctrl_targets_running())
{
df_state->entities_mut_soft_halt = 1;
}
@@ -1629,7 +1629,7 @@ df_entity_notify_mutation(DF_Entity *entity)
{
df_state->entities_mut_dbg_info_map = 1;
}
if(flags & DF_EntityKindFlag_TreeMutationSoftHalt)
if(flags & DF_EntityKindFlag_TreeMutationSoftHalt && df_ctrl_targets_running())
{
df_state->entities_mut_soft_halt = 1;
}
@@ -6440,6 +6440,23 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
DF_CmdParams params = df_cmd_params_zero();
df_cmd_list_push(arena, cmds, &params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Error));
}
// rjf: kill all entities which are marked to die on stop
{
DF_Entity *request = df_entity_from_id(event->msg_id);
if(df_entity_is_nil(request))
{
for(DF_Entity *entity = df_entity_root();
!df_entity_is_nil(entity);
entity = df_entity_rec_df_pre(entity, df_entity_root()).next)
{
if(entity->flags & DF_EntityFlag_DiesOnRunStop)
{
df_entity_mark_for_deletion(entity);
}
}
}
}
}break;
//- rjf: entity creation/deletion
@@ -7036,7 +7053,6 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
case DF_CoreCmdKind_StepIntoLine:
case DF_CoreCmdKind_StepOverLine:
case DF_CoreCmdKind_StepOut:
case DF_CoreCmdKind_RunToAddress:
{
DF_Entity *thread = df_entity_from_handle(params.entity);
if(df_ctrl_targets_running())
@@ -7088,11 +7104,6 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
good = 0;
}
}break;
case DF_CoreCmdKind_RunToAddress:
{
CTRL_Trap trap = {CTRL_TrapFlag_EndStepping|CTRL_TrapFlag_IgnoreStackPointerCheck, params.vaddr};
ctrl_trap_list_push(scratch.arena, &traps, &trap);
}break;
}
if(good && traps.count != 0)
{
@@ -7127,6 +7138,30 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
}break;
//- rjf: high-level composite target control operations
case DF_CoreCmdKind_RunToLine:
{
DF_Entity *file = df_entity_from_handle(params.entity);
TxtPt point = params.text_point;
if(file->kind == DF_EntityKind_File)
{
DF_Entity *bp = df_entity_alloc(0, file, DF_EntityKind_Breakpoint);
bp->flags |= DF_EntityFlag_DiesOnRunStop;
df_entity_equip_b32(bp, 1);
df_entity_equip_txt_pt(bp, point);
df_entity_equip_cfg_src(bp, DF_CfgSrc_Transient);
DF_CmdParams p = df_cmd_params_zero();
df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Run));
}
}break;
case DF_CoreCmdKind_RunToAddress:
{
DF_Entity *bp = df_entity_alloc(0, df_entity_root(), DF_EntityKind_Breakpoint);
bp->flags |= DF_EntityFlag_DiesOnRunStop;
df_entity_equip_vaddr(bp, params.vaddr);
df_entity_equip_cfg_src(bp, DF_CfgSrc_Transient);
DF_CmdParams p = df_cmd_params_zero();
df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Run));
}break;
case DF_CoreCmdKind_Run:
{
DF_CmdParams params = df_cmd_params_zero();