mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-12-01 01:53:20 -08:00
dbg_engine: shift thread register reads / process memory reads -> abstraction layer, rather than directly calling into demon; cache crash dump info, like thread info & memory ranges; implement thread reg reads & memory reads for dumps by using this acceleration structure when we have a dump handle, instead of regular demon reads.
This commit is contained in:
1 parent
463a4f8565
commit
4840b46b84
23 files changed
+1035
-401
No files matched your search
+52
-51
@@ -696,7 +696,7 @@ rd_ctrl_entity_from_eval_space(E_Space space)
|
||||
handle.machine_id = (U32)((space.u64s[0] & 0xffffffff00000000ull) >> 32);
|
||||
handle.controller_kind = (U32)((space.u64s[0] & 0x00000000ffffffffull) >> 0);
|
||||
handle.entity_id = space.u64s[1];
|
||||
entity = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, handle);
|
||||
entity = d_entity_from_handle(handle);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
@@ -793,7 +793,7 @@ rd_eval_space_read(E_Space space, void *out, E_SpaceRangeInfo *out_range_info, R
|
||||
void *regs_block = 0;
|
||||
if(e_interpret_ctx->reg_unwind_count == 0)
|
||||
{
|
||||
regs_block = d_reg_block_from_thread(scratch.arena, &d_user_state->ctrl_entity_store->ctx, entity->handle);
|
||||
regs_block = d_reg_block_from_thread(scratch.arena, entity->handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1042,7 +1042,7 @@ rd_eval_space_write(E_Space space, void *in, Rng1U64 range)
|
||||
Rng1U64 legal_range = r1u64(0, regs_size);
|
||||
Rng1U64 write_range = intersect_1u64(legal_range, range);
|
||||
U64 write_size = dim_1u64(write_range);
|
||||
void *new_regs = d_reg_block_from_thread(scratch.arena, &d_user_state->ctrl_entity_store->ctx, entity->handle);
|
||||
void *new_regs = d_reg_block_from_thread(scratch.arena, entity->handle);
|
||||
MemoryCopy((U8 *)new_regs + write_range.min, in, write_size);
|
||||
result = d_thread_write_reg_block(entity->handle, new_regs);
|
||||
scratch_end(scratch);
|
||||
@@ -1739,7 +1739,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
UI_Padding(ui_pct(1, 0)) UI_Focus(UI_FocusKind_Null)
|
||||
{
|
||||
CFG_NodePtrList targets = cfg_node_top_level_list_from_string(scratch.arena, str8_lit("target"));
|
||||
D_EntityArray processes = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Process);
|
||||
D_EntityArray processes = d_entity_array_from_kind(D_EntityKind_Process);
|
||||
|
||||
//- rjf: icon & info
|
||||
UI_Padding(ui_em(2.f, 1.f)) UI_TagF("weak")
|
||||
@@ -2397,7 +2397,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
String8 name = {0};
|
||||
{
|
||||
U64 vaddr = eval.value.u64;
|
||||
D_Entity *process = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->process);
|
||||
D_Entity *process = d_entity_from_handle(rd_regs()->process);
|
||||
D_Entity *module = d_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = d_dbgi_key_from_module(module);
|
||||
U64 voff = d_voff_from_vaddr(module, vaddr);
|
||||
@@ -4772,7 +4772,7 @@ rd_arch_from_eval(E_Eval eval)
|
||||
D_Entity *process = d_process_from_entity(ctrl_entity);
|
||||
if(process == &d_entity_nil)
|
||||
{
|
||||
process = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->process);
|
||||
process = d_entity_from_handle(rd_regs()->process);
|
||||
}
|
||||
Arch arch = process->arch;
|
||||
if(arch == Arch_Null)
|
||||
@@ -5530,11 +5530,11 @@ rd_window_frame(void)
|
||||
////////////////////////
|
||||
//- rjf: control entity tooltips
|
||||
//
|
||||
case RD_RegSlot_Machine: {ctrl_entity = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, regs->machine); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Process: {ctrl_entity = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, regs->process); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Module: {ctrl_entity = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, regs->module); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Thread: {ctrl_entity = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, regs->thread); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_CtrlEntity:{ctrl_entity = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, regs->ctrl_entity); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Machine: {ctrl_entity = d_entity_from_handle(regs->machine); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Process: {ctrl_entity = d_entity_from_handle(regs->process); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Module: {ctrl_entity = d_entity_from_handle(regs->module); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_Thread: {ctrl_entity = d_entity_from_handle(regs->thread); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_CtrlEntity:{ctrl_entity = d_entity_from_handle(regs->ctrl_entity); }goto ctrl_entity_tooltip;
|
||||
ctrl_entity_tooltip:;
|
||||
UI_Tooltip
|
||||
{
|
||||
@@ -7080,7 +7080,7 @@ rd_window_frame(void)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
CFG_NodePtrList targets = cfg_node_top_level_list_from_string(scratch.arena, str8_lit("target"));
|
||||
D_EntityArray processes = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Process);
|
||||
D_EntityArray processes = d_entity_array_from_kind(D_EntityKind_Process);
|
||||
B32 can_send_signal = !d_ctrl_targets_running();
|
||||
typedef struct CenterButtonTask CenterButtonTask;
|
||||
struct CenterButtonTask
|
||||
@@ -9624,7 +9624,7 @@ rd_string_from_exception_code(U32 code)
|
||||
internal DR_FStrList
|
||||
rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, D_Event *event)
|
||||
{
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, event->entity);
|
||||
D_Entity *thread = d_entity_from_handle(event->entity);
|
||||
DR_FStrList thread_fstrs = rd_title_fstrs_from_ctrl_entity(arena, thread, 0);
|
||||
DR_FStrList fstrs = {0};
|
||||
DR_FStrParams params = {ui_top_font(), ui_top_text_raster_flags(), ui_color_from_name(str8_lit("text")), ui_top_font_size()};
|
||||
@@ -9836,14 +9836,14 @@ rd_gather_auto_exprs(Arena *arena)
|
||||
U64 seen_expr_slots_count = 16;
|
||||
String8Node **seen_expr_slots = push_array(scratch.arena, String8Node *, seen_expr_slots_count);
|
||||
D_Handle thread_handle = rd_regs()->thread;
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, thread_handle);
|
||||
D_Entity *thread = d_entity_from_handle(thread_handle);
|
||||
D_CallStack call_stack = d_call_stack_from_thread(access, thread->handle, 0, 0);
|
||||
if(call_stack.frames_count != 0)
|
||||
{
|
||||
//- rjf: unpack thread / module / debug info / lines
|
||||
ARCH_Info *arch_info = arch_info_from_arch(thread->arch);
|
||||
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
|
||||
U64 thread_ip_vaddr = d_rip_from_thread(&d_user_state->ctrl_entity_store->ctx, thread_handle);
|
||||
U64 thread_ip_vaddr = d_rip_from_thread(thread_handle);
|
||||
D_Entity *module = d_module_from_process_vaddr(process, thread_ip_vaddr);
|
||||
DI_Key dbgi_key = d_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
@@ -11348,14 +11348,15 @@ rd_frame(void)
|
||||
//- rjf: unpack basic evaluation context
|
||||
//
|
||||
ProfBegin("unpack eval-dependent info");
|
||||
D_Entity *process = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->process);
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
D_Entity *process = d_entity_from_handle(rd_regs()->process);
|
||||
D_Entity *thread = d_entity_from_handle(rd_regs()->thread);
|
||||
Arch arch = thread->arch;
|
||||
E_Space primary_space = rd_eval_space_from_ctrl_entity(process, D_EvalSpaceKind_Entity);
|
||||
U64 unwind_count = rd_regs()->unwind_count;
|
||||
U64 rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
D_Entity *module = d_module_from_process_vaddr(process, rip_vaddr);
|
||||
U64 rip_voff = d_voff_from_vaddr(module, rip_vaddr);
|
||||
U64 tls_root_vaddr = d_tls_root_vaddr_from_thread(&d_user_state->ctrl_entity_store->ctx, thread->handle);
|
||||
U64 tls_root_vaddr = d_tls_root_vaddr_from_thread(thread->handle);
|
||||
ProfEnd();
|
||||
|
||||
////////////////////////////
|
||||
@@ -11378,7 +11379,7 @@ rd_frame(void)
|
||||
////////////////////////////
|
||||
//- rjf: produce all eval modules
|
||||
//
|
||||
D_EntityArray all_modules = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Module);
|
||||
D_EntityArray all_modules = d_entity_array_from_kind(D_EntityKind_Module);
|
||||
U64 eval_modules_count = Max(1, all_modules.count);
|
||||
E_Module *eval_modules = push_array(scratch.arena, E_Module, eval_modules_count);
|
||||
E_Module *eval_modules_primary = &e_module_nil;
|
||||
@@ -11787,7 +11788,7 @@ rd_frame(void)
|
||||
{
|
||||
String8 name = evallable_ctrl_names[idx];
|
||||
D_EntityKind kind = d_entity_kind_from_string(name);
|
||||
D_EntityArray array = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, kind);
|
||||
D_EntityArray array = d_entity_array_from_kind(kind);
|
||||
E_TypeKey type_key = e_string2typekey_map_lookup(rd_state->meta_name2type_map, name);
|
||||
for EachIndex(idx, array.count)
|
||||
{
|
||||
@@ -12158,7 +12159,7 @@ rd_frame(void)
|
||||
//- rjf: gather config from loaded modules
|
||||
//
|
||||
CFG_NodePtrList immediate_type_views = {0};
|
||||
D_EntityArray modules = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Module);
|
||||
D_EntityArray modules = d_entity_array_from_kind(D_EntityKind_Module);
|
||||
ProfScope("gather config from loaded modules")
|
||||
{
|
||||
for EachIndex(idx, modules.count)
|
||||
@@ -12262,7 +12263,7 @@ rd_frame(void)
|
||||
E_IRCtx *ir_ctx = push_array(scratch.arena, E_IRCtx, 1);
|
||||
{
|
||||
E_IRCtx *ctx = ir_ctx;
|
||||
ctx->regs_map = d_string2reg_from_arch(eval_base_ctx->primary_module->arch);
|
||||
ctx->regs_map = d_string2reg_from_arch(arch);
|
||||
ctx->locals_map = d_query_cached_locals_map_from_dbgi_key_voff(eval_base_ctx->primary_dbg_info->dbgi_key, rip_voff);
|
||||
ctx->member_map = d_query_cached_member_map_from_dbgi_key_voff(eval_base_ctx->primary_dbg_info->dbgi_key, rip_voff);
|
||||
ctx->macro_map = macro_map;
|
||||
@@ -12276,8 +12277,8 @@ rd_frame(void)
|
||||
E_InterpretCtx *interpret_ctx = push_array(scratch.arena, E_InterpretCtx, 1);
|
||||
{
|
||||
E_InterpretCtx *ctx = interpret_ctx;
|
||||
ctx->primary_space = eval_modules_primary->space;
|
||||
ctx->reg_arch = eval_modules_primary->arch;
|
||||
ctx->primary_space = primary_space;
|
||||
ctx->reg_arch = arch;
|
||||
ctx->reg_space = rd_eval_space_from_ctrl_entity(thread, D_EvalSpaceKind_Entity);
|
||||
ctx->reg_unwind_count = unwind_count;
|
||||
ctx->module_base = push_array(scratch.arena, U64, 1);
|
||||
@@ -12349,7 +12350,7 @@ rd_frame(void)
|
||||
case RD_CmdKind_Restart:
|
||||
{
|
||||
// rjf: reset hit counts
|
||||
D_EntityArray processes = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Process);
|
||||
D_EntityArray processes = d_entity_array_from_kind(D_EntityKind_Process);
|
||||
if(processes.count == 0 || kind == RD_CmdKind_Restart)
|
||||
{
|
||||
CFG_NodePtrList bps = cfg_node_top_level_list_from_string(scratch.arena, str8_lit("breakpoint"));
|
||||
@@ -12569,7 +12570,7 @@ rd_frame(void)
|
||||
{
|
||||
// rjf: if control processes are live, but this is not force-confirmed, then
|
||||
// get confirmation from user
|
||||
D_EntityArray processes = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Process);
|
||||
D_EntityArray processes = d_entity_array_from_kind(D_EntityKind_Process);
|
||||
UI_Key key = ui_key_from_string(ui_key_zero(), str8_lit("lossy_exit_confirmation"));
|
||||
if(processes.count != 0 && !rd_regs()->force_confirm && !ui_key_match(rd_state->popup_key, key))
|
||||
{
|
||||
@@ -13907,12 +13908,12 @@ rd_frame(void)
|
||||
//- rjf: source <-> disasm
|
||||
case RD_CmdKind_GoToDisassembly:
|
||||
{
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
D_Entity *thread = d_entity_from_handle(rd_regs()->thread);
|
||||
U64 vaddr = 0;
|
||||
for(D_LineNode *n = rd_regs()->lines.first; n != 0; n = n->next)
|
||||
{
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, &d_user_state->ctrl_entity_store->ctx, n->v.dbgi_key);
|
||||
D_Entity *module = d_module_from_thread_candidates(&d_user_state->ctrl_entity_store->ctx, thread, &modules);
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, n->v.dbgi_key);
|
||||
D_Entity *module = d_module_from_thread_candidates(thread, &modules);
|
||||
if(module != &d_entity_nil)
|
||||
{
|
||||
vaddr = d_vaddr_from_voff(module, n->v.voff_range.min);
|
||||
@@ -14195,7 +14196,7 @@ rd_frame(void)
|
||||
Access *access = access_open();
|
||||
|
||||
//- rjf: unpack thread info
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
D_Entity *thread = d_entity_from_handle(rd_regs()->thread);
|
||||
U64 unwind_index = rd_regs()->unwind_count;
|
||||
U64 inline_depth = rd_regs()->inline_depth;
|
||||
U64 rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_index);
|
||||
@@ -14259,7 +14260,7 @@ rd_frame(void)
|
||||
}break;
|
||||
case RD_CmdKind_FindSelectedThread:
|
||||
{
|
||||
D_Entity *selected_thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_base_regs()->thread);
|
||||
D_Entity *selected_thread = d_entity_from_handle(rd_base_regs()->thread);
|
||||
rd_cmd(RD_CmdKind_FindThread,
|
||||
.thread = selected_thread->handle,
|
||||
.unwind_count = rd_base_regs()->unwind_count,
|
||||
@@ -14368,7 +14369,7 @@ rd_frame(void)
|
||||
{
|
||||
D_Entity *process = &d_entity_nil;
|
||||
U64 vaddr = 0;
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, &d_user_state->ctrl_entity_store->ctx, voff_dbgi_key);
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, voff_dbgi_key);
|
||||
D_Entity *module = d_entity_list_first(&modules);
|
||||
process = d_entity_ancestor_from_kind(module, D_EntityKind_Process);
|
||||
if(process != &d_entity_nil)
|
||||
@@ -14448,8 +14449,8 @@ rd_frame(void)
|
||||
{
|
||||
file_path = rd_mapped_from_file_path(scratch.arena, rd_regs()->file_path);
|
||||
point = rd_regs()->cursor;
|
||||
thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
process = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->process);
|
||||
thread = d_entity_from_handle(rd_regs()->thread);
|
||||
process = d_entity_from_handle(rd_regs()->process);
|
||||
vaddr = rd_regs()->vaddr;
|
||||
prefer_new_tab = rd_regs()->prefer_new_tab;
|
||||
if(file_path.size == 0)
|
||||
@@ -14471,8 +14472,8 @@ rd_frame(void)
|
||||
D_LineList lines = d_lines_from_file_path_line_num(scratch.arena, file_path, point.line, max_U64);
|
||||
for(D_LineNode *n = lines.first; n != 0; n = n->next)
|
||||
{
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, &d_user_state->ctrl_entity_store->ctx, n->v.dbgi_key);
|
||||
D_Entity *module = d_module_from_thread_candidates(&d_user_state->ctrl_entity_store->ctx, thread, &modules);
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, n->v.dbgi_key);
|
||||
D_Entity *module = d_module_from_thread_candidates(thread, &modules);
|
||||
vaddr = d_vaddr_from_voff(module, n->v.voff_range.min);
|
||||
break;
|
||||
}
|
||||
@@ -15685,7 +15686,7 @@ rd_frame(void)
|
||||
}break;
|
||||
case RD_CmdKind_SetNextStatement:
|
||||
{
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
D_Entity *thread = d_entity_from_handle(rd_regs()->thread);
|
||||
String8 file_path = rd_regs()->file_path;
|
||||
U64 new_rip_vaddr = rd_regs()->vaddr_range.min;
|
||||
if(file_path.size != 0)
|
||||
@@ -15693,8 +15694,8 @@ rd_frame(void)
|
||||
D_LineList *lines = &rd_regs()->lines;
|
||||
for(D_LineNode *n = lines->first; n != 0; n = n->next)
|
||||
{
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, &d_user_state->ctrl_entity_store->ctx, n->v.dbgi_key);
|
||||
D_Entity *module = d_module_from_thread_candidates(&d_user_state->ctrl_entity_store->ctx, thread, &modules);
|
||||
D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, n->v.dbgi_key);
|
||||
D_Entity *module = d_module_from_thread_candidates(thread, &modules);
|
||||
if(module != &d_entity_nil)
|
||||
{
|
||||
new_rip_vaddr = d_vaddr_from_voff(module, n->v.voff_range.min);
|
||||
@@ -15810,9 +15811,9 @@ rd_frame(void)
|
||||
}break;
|
||||
case RD_CmdKind_SelectThread:
|
||||
{
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
D_Entity *thread = d_entity_from_handle(rd_regs()->thread);
|
||||
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
|
||||
D_Entity *module = d_module_from_process_vaddr(process, d_rip_from_thread(&d_user_state->ctrl_entity_store->ctx, thread->handle));
|
||||
D_Entity *module = d_module_from_process_vaddr(process, d_rip_from_thread(thread->handle));
|
||||
D_Entity *machine = d_entity_ancestor_from_kind(process, D_EntityKind_Machine);
|
||||
rd_state->base_regs.v.unwind_count = 0;
|
||||
rd_state->base_regs.v.inline_depth = 0;
|
||||
@@ -15825,7 +15826,7 @@ rd_frame(void)
|
||||
case RD_CmdKind_SelectUnwind:
|
||||
{
|
||||
Access *access = access_open();
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_base_regs()->thread);
|
||||
D_Entity *thread = d_entity_from_handle(rd_base_regs()->thread);
|
||||
D_CallStack call_stack = d_call_stack_from_thread(access, thread->handle, 1, now_time_us()+10000);
|
||||
D_CallStackFrame *frame = d_call_stack_frame_from_unwind_and_inline_depth(&call_stack, rd_regs()->unwind_count, rd_regs()->inline_depth);
|
||||
if(frame == 0)
|
||||
@@ -15844,7 +15845,7 @@ rd_frame(void)
|
||||
case RD_CmdKind_DownOneFrame:
|
||||
{
|
||||
Access *access = access_open();
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_base_regs()->thread);
|
||||
D_Entity *thread = d_entity_from_handle(rd_base_regs()->thread);
|
||||
D_CallStack call_stack = d_call_stack_from_thread(access, thread->handle, 1, now_time_us()+10000);
|
||||
D_CallStackFrame *current_frame = d_call_stack_frame_from_unwind_and_inline_depth(&call_stack, rd_regs()->unwind_count, rd_regs()->inline_depth);
|
||||
D_CallStackFrame *next_frame = current_frame;
|
||||
@@ -16576,7 +16577,7 @@ rd_frame(void)
|
||||
default:{}break;
|
||||
case D_EventKind_NewProc:
|
||||
{
|
||||
D_EntityArray all_processes = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Process);
|
||||
D_EntityArray all_processes = d_entity_array_from_kind(D_EntityKind_Process);
|
||||
if(all_processes.count == 1)
|
||||
{
|
||||
MemoryZeroStruct(&rd_state->prestop_focused_window);
|
||||
@@ -16593,7 +16594,7 @@ rd_frame(void)
|
||||
}break;
|
||||
case D_EventKind_NewModule:
|
||||
{
|
||||
D_Entity *module = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, evt->entity);
|
||||
D_Entity *module = d_entity_from_handle(evt->entity);
|
||||
D_Entity *debug_info_path = d_entity_child_from_kind(module, D_EntityKind_DebugInfoPath);
|
||||
String8 new_path = debug_info_path->string;
|
||||
if(new_path.size != 0 && file_path_exists(new_path))
|
||||
@@ -16637,7 +16638,7 @@ rd_frame(void)
|
||||
case D_EventKind_EndProc:
|
||||
if(rd_state->quit_after_success)
|
||||
{
|
||||
D_EntityArray processes = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Process);
|
||||
D_EntityArray processes = d_entity_array_from_kind(D_EntityKind_Process);
|
||||
if(evt->u64_code == 0 && processes.count == 0)
|
||||
{
|
||||
rd_cmd(RD_CmdKind_Exit);
|
||||
@@ -16650,12 +16651,12 @@ rd_frame(void)
|
||||
case D_EventKind_Stopped:
|
||||
{
|
||||
B32 need_refocus = (evt->cause != D_EventCause_InterruptedByHalt || !soft_halt_issued);
|
||||
D_Entity *thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, evt->entity);
|
||||
D_Entity *thread = d_entity_from_handle(evt->entity);
|
||||
U64 vaddr = evt->rip_vaddr;
|
||||
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
|
||||
D_Entity *module = d_module_from_process_vaddr(process, vaddr);
|
||||
U64 voff = d_voff_from_vaddr(module, vaddr);
|
||||
U64 test_cached_vaddr = d_rip_from_thread(&d_user_state->ctrl_entity_store->ctx, thread->handle);
|
||||
U64 test_cached_vaddr = d_rip_from_thread(thread->handle);
|
||||
|
||||
// rjf: valid stop thread? -> select & snap
|
||||
if(need_refocus && thread->kind == D_EntityKind_Thread && evt->cause != D_EventCause_InterruptedByHalt)
|
||||
@@ -16664,7 +16665,7 @@ rd_frame(void)
|
||||
}
|
||||
|
||||
// rjf: no stop-causing thread, but have selected thread? -> snap to selected
|
||||
D_Entity *selected_thread = d_entity_from_handle(&d_user_state->ctrl_entity_store->ctx, rd_base_regs()->thread);
|
||||
D_Entity *selected_thread = d_entity_from_handle(rd_base_regs()->thread);
|
||||
if(need_refocus && (evt->cause == D_EventCause_InterruptedByHalt || thread->kind != D_EntityKind_Thread) && selected_thread != &d_entity_nil)
|
||||
{
|
||||
rd_cmd(RD_CmdKind_SelectThread, .thread = selected_thread->handle);
|
||||
@@ -16673,7 +16674,7 @@ rd_frame(void)
|
||||
// rjf: no stop-causing thread, but don't have selected thread? -> snap to first available thread
|
||||
if(need_refocus && thread->kind != D_EntityKind_Thread && selected_thread == &d_entity_nil)
|
||||
{
|
||||
D_EntityArray threads = d_entity_array_from_kind(&d_user_state->ctrl_entity_store->ctx, D_EntityKind_Thread);
|
||||
D_EntityArray threads = d_entity_array_from_kind(D_EntityKind_Thread);
|
||||
D_Entity *first_available_thread = d_entity_array_first(&threads);
|
||||
rd_cmd(RD_CmdKind_SelectThread, .thread = first_available_thread->handle);
|
||||
}
|
||||
@@ -16725,7 +16726,7 @@ rd_frame(void)
|
||||
// rjf: update the autos-determining code range
|
||||
{
|
||||
D_Handle new_thread_handle = thread->handle;
|
||||
U64 new_sp = d_rsp_from_thread(&d_user_state->ctrl_entity_store->ctx, new_thread_handle);
|
||||
U64 new_sp = d_rsp_from_thread(new_thread_handle);
|
||||
if(thread == &d_entity_nil)
|
||||
{
|
||||
new_thread_handle = selected_thread->handle;
|
||||
|
||||
Reference in new issue
Block a user