selected-thread-only breakpoints; user setting for adding that by default; do this for 'run-to-line' operations

This commit is contained in:
Ryan Fleury committed 2026-09-25 14:28:54 -06:00
1 parent 315175e34d
commit 2c226d8a4b
8 files changed
+66 -15

No files matched your search

+4 -3
View File
@@ -77,9 +77,10 @@ struct D_HandleArray
typedef U32 D_BreakpointFlags;
enum
{
D_BreakpointFlag_BreakOnWrite = (1<<0),
D_BreakpointFlag_BreakOnRead = (1<<1),
D_BreakpointFlag_BreakOnExecute = (1<<2),
D_BreakpointFlag_BreakOnWrite = (1<<0),
D_BreakpointFlag_BreakOnRead = (1<<1),
D_BreakpointFlag_BreakOnExecute = (1<<2),
D_BreakpointFlag_BreakSelectedThreadOnly = (1<<3),
};
typedef struct D_Breakpoint D_Breakpoint;
+18
View File
@@ -5346,6 +5346,7 @@ d_ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
{
Temp temp = temp_begin(scratch.arena);
String8List conditions = {0};
B32 filter_unselected_threads = 0;
// rjf: entry breakpoints
for(DMN_TrapChunkNode *n = entry_traps.first; n != 0; n = n->next)
@@ -5383,6 +5384,10 @@ d_ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
{
str8_list_push(temp.arena, &conditions, user_bp->condition);
}
if(user_bp != 0 && !(trap->id & bit64) && user_bp->flags & D_BreakpointFlag_BreakSelectedThreadOnly)
{
filter_unselected_threads = 1;
}
}
}
}
@@ -5396,6 +5401,19 @@ d_ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
hit_user_bp = 1;
}
// rjf: if this breakpoint filters unselected threads, check that the current thread matches
// the selected, *or* that we have no selected thread at all.
if(!hit_conditional_bp_but_filtered && filter_unselected_threads)
{
B32 thread_is_selected = (d_handle_match(thread->handle, msg->entity) || d_handle_match(msg->entity, d_handle_zero()));
if(!thread_is_selected)
{
hit_user_bp = 0;
hit_conditional_bp_but_filtered = 1;
log_infof("thread_filtered_breakpoint_hit: 'not selected thread, and so filtered'\n");
}
}
// rjf: evaluate hit stop conditions
if(conditions.node_count != 0) ProfScope("evaluate hit stop conditions")
{
+6 -4
View File
@@ -1569,7 +1569,7 @@ d_next_cmd(D_Cmd **cmd)
//~ rjf: Main Layer Top-Level Calls
internal D_EventList
d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_PathMapArray *path_maps, U64 exception_code_filters[(D_ExceptionCodeKind_COUNT+63)/64], B32 auto_download_debug_info)
d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_PathMapArray *path_maps, D_Handle selected_thread, U64 exception_code_filters[(D_ExceptionCodeKind_COUNT+63)/64], B32 auto_download_debug_info)
{
ProfBeginFunction();
Temp scratch = scratch_begin(&arena, 1);
@@ -1683,6 +1683,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
// rjf: build data strings of all param data
String8List strings = {0};
{
str8_list_push(scratch.arena, &strings, str8_struct(&selected_thread));
D_EntityArray threads = d_entity_array_from_kind(D_EntityKind_Thread);
for EachIndex(idx, threads.count)
{
@@ -1696,6 +1697,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
for(U64 idx = 0; idx < breakpoints->count; idx += 1)
{
D_Breakpoint *bp = &breakpoints->v[idx];
str8_list_push(scratch.arena, &strings, str8_struct(&bp->flags));
str8_list_push(scratch.arena, &strings, bp->file_path);
str8_list_push(scratch.arena, &strings, str8_struct(&bp->pt));
str8_list_push(scratch.arena, &strings, bp->vaddr_expr);
@@ -1994,7 +1996,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
{
need_run = 1;
run_kind = d_user_state->ctrl_last_run_kind;
run_thread = d_entity_from_handle(d_user_state->ctrl_last_run_thread_handle);
run_thread = d_entity_from_handle(selected_thread);
run_flags = d_user_state->ctrl_last_run_flags;
run_traps = d_user_state->ctrl_last_run_traps;
}break;
@@ -2030,6 +2032,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
{
run_extra_bps.v[0].vaddr_expr = push_str8f(scratch.arena, "0x%I64x", params->vaddr);
}
run_extra_bps.v[0].flags |= D_BreakpointFlag_BreakSelectedThreadOnly;
d_cmd(D_CmdKind_Run);
}break;
case D_CmdKind_RunToName:
@@ -2130,7 +2133,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
{
need_run = 1;
run_kind = d_user_state->ctrl_last_run_kind;
run_thread = d_entity_from_handle(d_user_state->ctrl_last_run_thread_handle);
run_thread = d_entity_from_handle(selected_thread);
run_flags = d_user_state->ctrl_last_run_flags;
run_traps = d_user_state->ctrl_last_run_traps;
}
@@ -2252,7 +2255,6 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
arena_clear(d_user_state->ctrl_last_run_arena);
d_user_state->ctrl_last_run_kind = run_kind;
d_user_state->ctrl_last_run_frame_idx = d_frame_index();
d_user_state->ctrl_last_run_thread_handle = run_thread->handle;
d_user_state->ctrl_last_run_flags = run_flags;
d_user_state->ctrl_last_run_traps = d_trap_list_copy(d_user_state->ctrl_last_run_arena, &run_traps_copy);
d_user_state->ctrl_last_run_extra_bps = d_breakpoint_array_copy(d_user_state->ctrl_last_run_arena, &run_extra_bps_copy);
+1 -2
View File
@@ -366,7 +366,6 @@ struct D_UserState
Arena *ctrl_last_run_arena;
D_RunKind ctrl_last_run_kind;
U64 ctrl_last_run_frame_idx;
D_Handle ctrl_last_run_thread_handle;
D_RunFlags ctrl_last_run_flags;
D_TrapList ctrl_last_run_traps;
D_BreakpointArray ctrl_last_run_extra_bps;
@@ -481,6 +480,6 @@ internal B32 d_next_cmd(D_Cmd **cmd);
////////////////////////////////
//~ rjf: Main Layer Top-Level Calls
internal D_EventList d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_PathMapArray *path_maps, U64 exception_code_filters[(D_ExceptionCodeKind_COUNT+63)/64], B32 auto_download_debug_info);
internal D_EventList d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_PathMapArray *path_maps, D_Handle selected_thread, U64 exception_code_filters[(D_ExceptionCodeKind_COUNT+63)/64], B32 auto_download_debug_info);
#endif // DBG_ENGINE_USER_H